We have a collaborator that specifies in the step for creating an SSH key:

It is not allowed to use an empty passphrase. We consider an empty passphrase as a violation of elementary security policies and will shut out any user doing so from further usage of our systems.

I use a small GPG smartcard (Yubikey) which is solely protected by a PIN and by me carrying it around on my key ring. However, the private key itself is - to my understanding - not encrypted on the card itself. I know that a password protected (private) key would be stored encrypted on my hard drive, while a password-less key would be stored in a plain format.

My question: As they will never see my private key I'm wondering if it is at all possible to "sniff" (through ssh) if my private key is encrypted or not?

1 Answer 1


It is not possible for the server to detect how the key is stored. The server only sees the result of a mathematical computation involving the key. How the key client obtains the key is completely out of control of the server.

In theory the server could perform a timing analysis to try to guess whether the key is password-protected. However it is common practice to store the key in memory using ssh-agent, in which case the server would only measure the time it takes for the agent to provide the key; the server would still have no visibility on how the key was loaded into the agent.

Inasmuch as the policy is sensible, storing the key in a smartcard is rather better security than storing it on a hard disk with password protection. (That's of course not a universally true comparison — if you have a very good memory for complex passwords but tend to lose your wallet and the card is badly designed, a password-protected key may well be harder to get hold of. But most people take better care of what they have than of what they know.)

Of course, if the server administrator applies the policy blindly without understanding the rationale, you may be in trouble. If it comes to that, you can argue that the key is protected by the PIN. (The card does a better job of protection, that's why a PIN is sufficient — a 4-digit password is ridiculous security if the attacker has access to the encrypted file. I'm only saying this in case you run into an incompetent administrator.)

You must log in to answer this question.

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