Generate CSR CRT CA certificate using OpenSSL under "Go" Linux

Source: Internet
Author: User
Tags generate csr openssl

Create a Test Catalog


certificate file Generation :

One. Server-side

1. Generate the server-side private key (key file):

OpenSSL genrsa-des3-out Server.key 1024

The runtime prompts for a password, which is used to encrypt the key file (the parameter des3 is an encryption algorithm or other secure algorithm), and every time a password is required to read the file (via the command or API provided by OpenSSL), the password is stripped if no password is removed:

MV Server.key Server.origin.keyopenssl rsa-in server.origin.key-out Server.key

2. Generate server-side certificate signing request file (CSR file):

OpenSSL Req-new-key server.key-out SERVER.CSR

Generate the Certificate Signing Request (CSR), and the generated CSR file is handed to the CA to form the service-side certificate. On the screen, you will be prompted to enter the required personal information (e.g. Country,province,city,company, etc.) in step-by-steps.

Two. Client

1. Generate the Client private key (key file):

OpenSSL genrsa-des3-out Client.key 1024

2. Generate the client certificate signing request file (CSR file):

OpenSSL Req-new-key client.key-out CLIENT.CSR

Three. Generate the CA certificate file

#server. CSR and CLIENT.CSR files must be signed by a CA to form a certificate.


1. First generate the CA's key file:

OpenSSL genrsa-des3-out Ca.key 1024

2. Generate the CA self-signed certificate:

OpenSSL req-new-x509-key ca.key-out ca.crt-days 3650

You can add the certificate Expiration Time option "-days 3650".

Four. Signing with a CA certificate

OpenSSL ca-in. /server.csr-out. /server.crt-cert ca.crt-keyfile Ca.key OpenSSL ca-in. /client.csr-out. /client.crt-cert Ca.crt-keyfile Ca.key

These two execution time because did not specify OPENSSL.CNF will error, but does not matter, we use the default /etc/pki/tls/openssl.cnf to be able.

However, the default is to perform the following two lines first:

Touch/etc/pki/ca/index.txt echo >/etc/pki/ca/serial

Generate CSR CRT CA certificate using OpenSSL under "Go" Linux

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.