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?


1 Answer 1


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?

  • $\begingroup$ 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? $\endgroup$
    – jiboutin
    Dec 1, 2013 at 12:25
  • $\begingroup$ @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. $\endgroup$
    – user4982
    Dec 1, 2013 at 20:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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