ECC keypair generation with password

Ken Goldman kgoldman at us.ibm.com
Thu Feb 28 20:05:43 UTC 2019


I've been using this command to generate a password protected ECC keypair.

openssl ecparam -name prime256v1 -genkey -noout | openssl pkey -aes256 
-passout pass:passwd -text > tmpecprivkey.pem

The output is a
-----BEGIN ENCRYPTED PRIVATE KEY-----

which I parsed using

	PEM_read_PrivateKey(pemKeyFile, NULL, NULL, (void *)password);
	*ecKey = EVP_PKEY_get1_EC_KEY(evpPkey);
	privateKeyBn = EC_KEY_get0_private_key(ecKey);

Now I must send the PEM file to a crypto library that does not support
-----BEGIN ENCRYPTED PRIVATE KEY-----

It expects
-----BEGIN EC PRIVATE KEY-----

Its parser does accept a password.

Is there a way to generate that PEM file?  I.e.

A password protected ECC keypair in -----BEGIN EC PRIVATE KEY----- format/








More information about the openssl-users mailing list