I was given a private key, which turned out to be in pkcs8 format, which I managed to turn into a pem file using the following command:
openssl pkcs8 -inform der -nocrypt -in private.key -out pkey.pem
Now I need to convert this to pkcs12 so that I can use it in .NET to create an X509 certificate (I would also like to import it into the Windows Certificate Manager).
I tried this command:
openssl pkcs12 -export -name myalias -in mycert.crt -inkey pkey.pem -out keystore.p12
however, I do not have a public key, I tried to use the pkey.pem file as -in arg, but it tells me No certificate matches private key. If I try without -inarg, nothing will happen (and I don't mean anything, there is an empty line until I press ctrl-c).
How can I generate a public key from a private key or convert to pkcs12 without a public key?
I , , , (-nocerts):
openssl pkcs12 -export -nocerts -inkey your.private.key.pem -out your.private.key.p12
Windows, The specified file is empty, .
, , ' , No certificate matches private key
, , -in, No certificate matches private key, , : openssl rsa -in privkey.pem -pubout > key.pub
EDIT:
, , , , . - , , .