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]



resultant session key:


SHA256 hash of the passphrase:


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.