Using OpenSSL to Create a CA Certificate

  1. Log in to a Linux server with OpenSSL installed.
  2. Create the cert_v3 directory and enter the directory.
    mkdir cert_v3
    cd cert_v3
  3. Create a working directory and enter the directory.
    mkdir ca
    cd ca
  4. Create the OpenSSL configuration file ca_cert.conf for the CA certificate. The file content is as follows:
    [ req ]
     distinguished_name     = req_distinguished_name 
     prompt                 = no  
    
    [ req_distinguished_name ]  
     O                      = mxManufacture
     CN                     = xxx.huawei.com
    [ v3_ca ]
    subjectKeyIdentifier = hash
    authorityKeyIdentifier = keyid:always,issuer
    basicConstraints = critical, CA:true
    keyUsage = critical, digitalSignature, cRLSign, keyCertSign

    The CN and DNS fields can be changed to the domain name or IP address of the server as required.

    xxx.huawei.com is for reference only. Change xxx based on the site requirements, for example, mxmanufacture.huawei.com.

  5. Create the private key file ca.key of the CA certificate.
    openssl genrsa -aes256 -out ca.key 4096

    Set password strength properly. The password must contain at least eight characters and contain at least two types of the following characters: digits, uppercase letters, lowercase letters, and special characters.

  6. Create the CSR request file ca.csr of the CA certificate.
    openssl req -out ca.csr -key ca.key -new -config ./ca_cert.conf
  7. Create the self-signed CA certificate ca.crt.
    openssl x509 -req -in ca.csr -out ca.crt -sha256 -days 1000 -extfile ./ca_cert.conf -extensions v3_ca -signkey ca.key