Verifying Encryption Algorithms
crimer at crimer90.co.cc
Tue Sep 20 21:04:24 CEST 2011
-----BEGIN PGP SIGNED MESSAGE-----
First of all:
The following answer is about "how to get those informations from an
If you need to force some algorithms, you can use the --cipher-algo,
--digest-algo, --compress-algo and --cert-digest-algo options.
> My main question is: how can i get a warm fuzzy that a file has
> [i]really[/i] been encrypted
> using the cipher and digest that i specify and not something else? I was
> thinking there might be some kind of -vv decrypt mode that would show in
> detail what it's using to decrypt a file or some file metadata or something.
The informations you're seeking for are inside the ciphertext, precisely:
a) the symmetric encryption algorithm is with the key, in the
symmetric-key encrypted session key packet;
b) the digest algorithm is inside the one-pass signature packet,
inside the symmetric ciphertext.
So, you have to decrypt the Symmetric-Key Encrypted Session Key Packet
with your public key to discover the crypto-algo and get the session
key to decrypt the Symmetrically Encrypted Data Packet and get or a
Compressed Data Packet or a Literal Data Packet, along with the
one-pass signature cited above.
> I think i've found a good way to verify the cipher-algo using
> --show-session-key. the first digit of the output indicates the symmetric
> algorithm being used:
> would indicate that it's a TWOFISH key. Also, the length of the key is a
> good hint.
Exactly, that's the way to follow to discover the symmetric encryption
algorithm using only GnuPG.
> Basically, I just want some way to look at my encrypted data and see that it
> actually uses the algorithms that I specified before I send it out somewhere
> that it could be intercepted and compromised.
You can use the --list-packets option, along with the
--show-session-key one, to see a detailed view of your packet. Let's
see an example:
$ gpg --list-packets --show-session-key message.asc (or .gpg)
:pubkey enc packet: version 3, algo 1, keyid 0123456789ABCDEF
data: [4096 bits]
<insert passphrase here, then...>
:encrypted data packet:
gpg: encrypted with ...
:compressed packet: algo=3
:onepass_sig packet: keyid FEDCBA9876543210
version 3, sigclass 0x00, digest 10, pubkey 1, last=1
:literal data packet:
mode b (62), created 1316543985, name="",
raw data: 6 bytes
:signature packet: algo 1, keyid FEDCBA9876543210
version 4, created 1316543985, md5len 0, sigclass 0x00
digest algo 10, begin of digest dd 90
hashed subpkt 2 len 4 (sig created 2011-09-20)
subpkt 16 len 8 (issuer key ID 10293847586FDBCE)
data: [4096 bits]
gpg: session key:
You can see:
- - RSA key (pubkey algo 1);
- - the symmetric algo used is AES256 (9, first octet of session key);
- - the message is compressed with BZIP2 (compressed algo 3)
- - the digest algo is SHA512 (10 in signature and onepass_sig packets);
- - the signature asymmetric algo is RSA (algo 1 in signature).
Of course, you need a way to decipher that message, so if you're
encrypting it without a key of yours, those informations are
> I have a few methods for
> checking, but they a few leave key pieces of information out. If anybody has
> a good method for verification or even knows of some 3rd party tool that can
> analyze encrypted data, I would really appreciate your input.
I don't know any tool to analyze encrypted data as you want, I'm sorry.
If you want to discover more insight details about the informations
stored inside an OpenPGP message, you can look at RFC4880, it's very
Hope it helps!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
-----END PGP SIGNATURE-----
More information about the Gnupg-users