As a person responsible for security I wonder on this subject. To provide best security I don't want to accept/deploy public keys for users if private key is not password protected.

However there does not seem to be any information on this online.

Yes, I know that password protection happens only on client side and therefore is relevant only for private key, but my thought on this was that on public key generation time it could have some meta-data added to it showing that private key has been password protected.

1 Answer 1


No. It has nothing to do with the key generation. One can encrypt a key, later remove the password, change the password, and/or change the algorithm. The reverse is also true one can start with an unencrypted key and later encrypt it. The encryption is done client side after the keypair generation is complete.

It really is no different than encrypting any other type of data. I would point out if encrypting a key leaked that information to the public key that would be a bad design.

  • Can you please elaborate on "bad design"? As for example adding meta-data to public key that says "yes, private key has been encrypted" without giving away any encryption parameters. Following same example then adding user@host at the end of public key is also bad design, much worse than encryption boolean cuz that tells attacker where to find private key. And that is done automatically in all tools that generate key pairs. Jul 6, 2015 at 4:39
  • 5
    Even if that meta-data were included in the key you wouldn't be able to trust it. As Gerald Davis said, it is encrypted/decrypted after it is generated and as such the encrypted state of the key can change after being sent to you.
    – Raniz
    Jul 6, 2015 at 6:41
  • 2
    @AlexKey The information would be trivial to forge on the client side. So you wouldn't get much protection. Besides even if you know the key is encrypted, that information is not very useful without knowing the strength of the password. If the public key would indicate whether the private key is encrypted, that information could potentially be abused. For example if I know who has access to a specific system, and the public key of each of those users tell me whether their private key is encrypted, that would tell me whose laptop to steal to have the best chance of gaining access.
    – kasperd
    Jul 6, 2015 at 8:44
  • Sadly, this is why many SSH server admins prohibit key-based authentication, which is really annoying to me, because (a) the keys are vastly more secure, (b) they're more convenient for me, and (c) the passphrase on my keys is significantly more complex than a passphrase I must regularly type. Admins just can't verify point (c).
    – Adam Katz
    Jul 7, 2015 at 20:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .