When generating a key with openssl one can choose to encrypt the generated key using a password.
openssl genpkey -algorithm rsa -out rsa.key -aes-128-cbc
In this example AES 128 in CBC mode is used to encrypt the generated key in the file 'rsa.key'.
If one wants to use the key with openssl one has to provide the password.
openssl pkcs8 -in rsa.key Enter Password:
Somehow openssl detects the key encryption algorithm. Is it possible with openssl to print out the encryption algorithm used for an encrypted key?