Extract passphrase hash

Daniel Kahn Gillmor dkg at fifthhorseman.net
Wed Feb 18 01:14:51 CET 2015


On Tue 2015-02-17 13:48:26 -0500, Thomas White wrote:
> I have a private key I am trying to recover the passphrase hash from
> to try and then use in conjunction with another tool (hashcat?) to
> recover the passphrase on a GPU cluster I have.
>
> How would one go about extracting the passphrase hash from the private
> key?

This is not how OpenPGP passphrases work.  there is no embedded hash of
the password.

For details about how the password is used to unlock the secret key
material, please see:

Secret-Key Packet Formats
 https://tools.ietf.org/html/rfc4880#section-5.5.3

and:

Secret-Key Encryption
  https://tools.ietf.org/html/rfc4880#section-3.7.2.1

and:

String-to-key (S2K) specifier types:
  https://tools.ietf.org/html/rfc4880#section-3.7

In particular:

   Encryption/decryption of the secret data is done in CFB mode using
   the key created from the passphrase and the Initial Vector from the
   packet.

You can use pgpdump or gpg --list-packets on your secret key to see what
the S2K parameters and IV are, and then test passphrases by generating
keys and testing them against encrypted MPI and trailing checksum.  This
is unlikely to work on your GPU cluster without custom coding.

   --dkg



More information about the Gnupg-users mailing list