I would like to be able to generate a key pair private and public key in command line with openssl, but I don't know exactly how to do it. What I have done so far was to do the following command line but this only prints me this which I don't know exactly what it is:s
FROM OPENSSL PAGE: To create EC parameters with explicit parameters:
openssl ecparam -out ec_param.pem -name prime192v1 -param_enc explicit
-----BEGIN EC PARAMETERS-----
MIHHAgEBMCQGByqGSM49AQECGQD////////////////////+//////////8wSwQY
/////////////////////v/////////8BBhkIQUZ5ZyA5w+n6atyJDBJ/rje7MFG
ubEDFQAwRa5vyEIvZO1XlSjTgSDq4SGW1QQxBBiNqA6wMJD2fL8g60OhiAD0/wr9
gv8QEgcZK5X/yNp4YxAR7WskzdVz+XehHnlIEQIZAP///////////////5ne+DYU
a8mxtNIoMQIBAQ==
-----END EC PARAMETERS-----
can some one tell me how to get something like this:
//-----------------Generated Key Pair----------------------------------//
char privkey[]=
"-----BEGIN EC PARAMETERS-----\n"
"BgUrgQQACQ==\n"
"-----END EC PARAMETERS-----\n"
"-----BEGIN EC PRIVATE KEY-----\n"
"MFACAQEEFI9sfpfTk0YlZx8JaCZnLsy4T6HYoAcGBSuBBAAJoSwDKgAEIlzYflxD\n"
"0396M0i6dGfSY3khTU7kiNyEv/B1EoyGmqvH7tjhSmpP1A==\n"
"-----END EC PRIVATE KEY-----\n";
char pubkey[] =
"-----BEGIN PUBLIC KEY-----\n"
"MD4wEAYHKoZIzj0CAQYFK4EEAAkDKgAEIlzYflxD0396M0i6dGfSY3khTU7kiNyE\n"
"v/B1EoyGmqvH7tjhSmpP1A==\n"
"-----END PUBLIC KEY-----\n";
//---------------------------------------------------------------------//
I got this from a code I got online which uses this key pair to sign messages with ECDSA, but now I would like to be able to generate my own key pair(from openssl command line) and use it in the code like this, to change this key pair for mine.
In my case I would like to use NIST P225 which is "prime256v1".
Can someone help me?
Thanks, Best Regards