1

In gpg2, how exactly does --s2k-mode 0 go from the passphrase to the session key in this example:

gpg2 --armor --s2k-mode 0 --s2k-digest SHA256 --s2k-cipher-algo CAMELLIA256 --symmetric [file path]

passphrase:

4F64659090A2D60CA4AA877D659C50C55975B834854A57B40D8F57B758BC163B

resultant session key:

13:8C07329F5897660ADAA63CA2AEEC820DD2D63430DD94A9117ADFD68336C0380E

SHA256 hash of the passphrase:

e9b493b5ab33a7be3339378994b08aadc081cf3744cf62f9569f08714a45e48a

And this:

gpg2 --armor --s2k-mode 0 --s2k-digest SHA256 --s2k-cipher-algo AES128 --symmetric [file path]

results in a session key of 8C07329F5897660ADAA63CA2AEEC820D when using the same passphrase, which makes sense with AES128. Pages 10 and 11 of RFC 4880 have not clarified the issue of how the passphrase above resulted in these session keys. I know, it's a long passphrase--it is the same length as the session key. Adding octets and hashing has not gotten me to a match, so I cannot be sure of how s2k works in this case.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.