I have a private key used for RSA exchanges that is password protected. I know the password, so I can use the key, however, I do not know which cipher was used to do the password.
I have other keys where the cipher is named in a header in the decrypted key, as per the answer to this question. However, this key when encrypted simply starts:
-----BEGIN ENCRYPTED PRIVATE KEY-----
and when decrypted:
-----BEGIN RSA PRIVATE KEY-----
No further header.
Tools such as openssl rsa
and gnutls's certtool -k
decrypt the key when given the password and provide information about the public key but do not say anything about the symmetric cipher used for the password.
Presumably, these applications know what the cipher was, since they decrypt the key. Is there a way to get this information? There does not seem to be much point in keeping it secret if I have the password anyway.
Programmatic answers using the gnutls API (but not openssl) are good, but ideally I'd like to know of an existing, portable tool.