How do i create a rsa private and public key using openssl?



  • This is to generate a private/public key pair. openssl can generate various public/private key pairs, here we demonstrate creating an RSA private/public key pair.

    Generate a 2048 bit key pair.

    $ openssl genpkey -algorithm rsa -out my_private_key.pem -pkeyopt rsa_keygen_bits:2048
    

    Extract the public key from the private key.

    $ openssl rsa -pubout -in my_private_key.pem -out my_public_key.pem
    

Log in to reply
 

© Lightnetics 2024