If I protect my private key with a passphrase, then it will be encrypted

enter image description here

Where is the symmetric key stored for it ? Is it somehow in the certificate itself? What if I have specified that it's not exportable and passphrase protected, if someone gains access to my OS and uses mimikatz to export it will she/he be able to decrypt it (assuming the passphrase was as easy as Test123) or will it fail because the symmetric key is tied to the OS and not the certificate itself?

  • There are several symmetric keys involved in SSH, with different purposes. Are you referring to the symmetric key used to encrypt the private key?
    – user
    Mar 15, 2017 at 8:45
  • @MichaelKjörling Yes, I meant the symmetric key used to encrypt the private key. I'm not referring to SSH strictly.
    – cyzczy
    Mar 15, 2017 at 8:47
  • Please do not post text as images. It is hard to read and does not work with screen readers. Instead, edit the post to contain the actual text.
    – Anders
    Mar 15, 2017 at 12:56

1 Answer 1


Your question is answered here.

Specifically, the key is encrypted using AES-128 in CBC mode with the DS4228D85838E32589695E83A22595C7 (hex) initialization vector. The passphrase you provided is used for generating the AES key.

How is the key derived from the password? According to this, it is done this way:

1) Append the first 8 bytes of the IV to the passphrase, without a separator (serves as a salt).

2) Take the MD5 hash of the resulting string (once).

Not exactly state-of-the-art.

  • so is the passphrase the keying-material for the symmetric key so to say ?
    – cyzczy
    Mar 15, 2017 at 8:55
  • 2
    Yup. Can't be any other way, really. The pitfall is that the key derivation algorithm used is scary bad (8 bytes of salt + MD5)
    – Stephane
    Mar 15, 2017 at 8:57
  • What does "Append the first 8 bytes of the IV " specifically mean? EDIT: Ok I got it. "The 128-bit hex string in the DEK-Info header is the initialization vector (IV) for the cipher. "
    – cyzczy
    Mar 15, 2017 at 9:01

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.