Search code examples
opensslcertificate

OpenSSL Generating RSA key and CA


How could I generate my own RSA private key and Certification Authority. I want to set up a certificate for my corporation's website.


Solution

  • Generating self-signed certificate will cause browser errors for users. Ordinary client visiting your page will close it, when shown the error that certificate is not safe.

    The best choice for you is to buy a certificate from trusted CA.

    If you still want to create it yourself here are commands:

    genrsa -des3 -out ca/ca.key 4096
    

    To generate RSA private key.

    req -new -x509 -days 3650 -key ca/ca.key -out ca/ca.cer
    

    To create self-signed certificate CA

    genrsa -des3 -out key.key 4096
    

    To create RSA private key for web certificate

    req -new -key key.key -out cerreq.csr
    

    To create CSR

    ca -policy policy_anything -cert ca/ca.cer -in cerreq.csr -keyfile ca/ca.key -days 365 -out cer.cer
    

    To sign certificate with your CA