Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Encrypting a very small message using public key cryptography always result in larger encrypted messages. Is it possible to deduce the algorithm used, key length, etc just by looking at the minimum encrypted message length?

More specifically, if I have black box system and when I input a small number of characters to encrypt I get the encrypted version back. Can I deduce anything about the algorithm in the black box using the encrypted message length?

share|improve this question

For the most common public key encryption mechanisms such as RSA PKCS#1 encryption mechanism, it is indeed possible to deduce the key length from encrypted length.

In addition to encrypted length, you may want to look at encrypted data. In case of RSA observing encrypted data will reveal e.g. modulus, i.e. basically the public key.

This is generally the case with public key encryption: observing encrypted messages eventually allow to learn the public key.

It is not usually not possible to detect what one of of PKCS#1 paddings was used. However, occasionally, the encrypted message is encapsulated so that it conveys more information on the message. Have you been able to examine encrypted bytes produced by the device, to check if there are e.g. some DER encoded header or other additional information?

share|improve this answer
Do you have references explaining how to retrieve public key from encrypted data and/or how to know if there is a header with the encrypted data and how to interpret it? – jiboutin Dec 1 '13 at 12:25
@jean-ian: Earlier reply Is it possible to figure out the public key from encrypted text? is concerned with retrieving public key from encrypted data. You are able to control input, using that should greatly enhance how fast you can recover public key. For examining if there is header: just check if the data length is little bit over N, where N is 128, 196, 256, 384, 512 bytes. In this case, there usually is some header. Common DER encoding can be parsed with openssl as1parse cmd. – user4982 Dec 1 '13 at 20:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.