This question is admittedly artificial. Its purpose is only to help me understand aspects of gnupg
that I can't figure out from reading the documentation.
One thing that puzzles me about gnupg
is that the passphrase plays qualitatively very different roles in asymmetric and symmetric encryption.
In gnupg
's asymmetric encryption scheme, the passphrase is used only to protect the private key. It is not used for encryption and decryption per se; for that one uses the public and private keys, respectively. These keys, in turn, are generated by gpg2
itself (i.e. gpg2 ... --gen-key ...
), using what appear to be pretty high cryptographic standards. In particulars, in contrast to the passphrase, these keys are not of the user's invention.
The situation is very different gnupg
's symmetric encryption scheme, where the (user-invented) passphrase is used to actually carry out the encryption and decryption. In contrast to the cryptographic-grade keys that one generates with gpg2 ... --gen-key ...
, and uses for asymmetric encryption/decryption, the passphrase used for symmetric encryption/decryption can be any old silly passphrase, like "mysecret".
As I said, I find this difference really confusing.
My question is: what is the most direct way to have gpg2 generate a passphrase for symmetric encryption that is comparable in cryptographic strength to the keys that one would generate using gpg2 ... --gen-key ...
?
Here's at least one way to do it: generate a a standard asymmetric encryption keypair using gpg2 ... --gen-key ...
, discard the private key, dump the public key of the pair with --armor
, and use this as one's passphrase for symmetric encryption.
Does gpg2 support a less convoluted approach?