Find out if a SSH private key requires a password?

I've got a whole pile of SSH keys here, public and private. How do I find out which private keys require a password, and which don't?


Assuming you're talking about OpenSSH format keys:

$ grep ENCRYPTED *id*
test2.id:Proc-Type: 4,ENCRYPTED
id_dsa:Proc-Type: 4,ENCRYPTED

It's simpler than you might expect :)

$ head test.id
-----BEGIN RSA PRIVATE KEY-----
MIIEoAIBAAKCAQEAogi+ ...

$ head test2.id
-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
...

Encrypted private keys will contain the line:

Proc-Type: 4,ENCRYPTED