How to create public and private key with openssl?

前端 未结 1 1784
野性不改
野性不改 2020-12-05 07:21

My question is how to create a public key and private key with OpenSSL in windows and how to put the created public key in .crt file and the private one in

相关标签:
1条回答
  • 2020-12-05 07:49

    You can generate a public-private keypair with the genrsa context (the last number is the keylength in bits):

    openssl genrsa -out keypair.pem 2048
    

    To extract the public part, use the rsa context:

    openssl rsa -in keypair.pem -pubout -out publickey.crt
    

    Finally, convert the original keypair to PKCS#8 format with the pkcs8 context:

    openssl pkcs8 -topk8 -inform PEM -outform PEM -nocrypt -in keypair.pem -out pkcs8.key
    
    0 讨论(0)
提交回复
热议问题