1
$\begingroup$

The output of command fortune | gpg -vaer <receipent-id> has a line that begins with:

gpg: RSA/AES256.CFB encrypted for ...

What is AES256.CFB doing here when the key is a RSA key? Isn't the data supposed to be encrypted with RSA given this is public key cryptography?

$\endgroup$
1

1 Answer 1

3
$\begingroup$

For Elgamal and RSA, it's only generally possible to encrypt a small amount of data. For ECDH and other DH variants, no data is encrypted at all; only a set of shared keys can be generated.

As a result, when we encrypt data with a public key cryptosystem, we usually use a hybrid method (called “hybrid encryption”), where the bulk of the data is encrypted with a symmetric key algorithm, and we either derive the symmetric key from a DH or ECDH approach or we derive the secret key randomly and encrypt it with the RSA or Elgamal public key.

In this case, what GnuPG is telling you is that this a hybrid of RSA for the public key and AES256 with CFB (and, presumably, the modification detection code). You may also see “OCB” instead of “CFB” if you're using a newer version of GnuPG. The data here is then encrypted with AES256 in the specified mode, and the symmetric key is encrypted with RSA.

$\endgroup$
3
  • $\begingroup$ It is probably worth mentioning this paradigm is called "Hybrid Encryption". Your answer includes these words separately, but it's a useful term to know to search on for things like this. $\endgroup$
    – Mark Schultz-Wu
    Commented Mar 8 at 23:48
  • $\begingroup$ Thanks for your answer. In newer gpg version uses "OCB"? In version 2.4.5 I still see "CFB". $\endgroup$
    – aackmann
    Commented Mar 9 at 11:17
  • 1
    $\begingroup$ If the key has a preference for supporting AEAD, then it will say “OCB” because that will be used. Otherwise, it will probably default to CFB. $\endgroup$
    – bk2204
    Commented Mar 9 at 16:15

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.