Using OpenSSL to generate the Library and command program, in the generated command program includes the addition/decryption algorithm test, OpenSSL program, CA program. Use OPENSSL,CA to generate certificate files and CA files for the C/s mode.
Steps to build the certificate file:
One, server-side
1. Generate the server-side private key (key file);
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 you will need to enter the password whenever you need to read the file (via the command or API provided by OpenSSL). If you do not have a password, you can use the following command to remove the password:
OpenSSL rsa-in server.key-out Server.key
2. Generate server-side certificate signing request file (CSR file);
OpenSSL Req-new-key server.key-out SERVER.CSR
Generate Certificate Signing request (CSR), the generated CSR file is handed to the CA to form the service side's own certificate. The screen will prompt you to enter the required personal information in step-by-steps, such as: Country,province, City,company, etc.).
Second, the client
1. The client also makes the same command to generate key and CSR files;
1024x768-new-key client.key-out CLIENT.CSR
Iii. Generating CA certificate files
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
You can add the certificate Expiration Time option "-days 365".
Iv. signing with a CA certificate
Sign the SERVER.CSR,CLIENT.CSR file with the generated CA certificate, taking advantage of the ca.pl file included with OpenSSL
1. When prompted to enter the existing certificate file, enter the above generated CA.CRT certificate file;
Ca.pl–newca
2. Generate a server-side certificate file
OpenSSL ca-in server.csr-out server.crt-cert ca.crt-keyfile ca.key-config openssl.cnf
3. Generating the client certificate file
OpenSSL ca-in client.csr-out client.crt-cert ca.crt-keyfile ca.key-config openssl.cnf
OPENSSL.CNF must be guaranteed in the current directory, this file can be found in the Apps directory.
V. Errors that may occur
Error 1:
Error loading the config file ' openssl.cnf '
Workaround
Find. -name "openssl.c*"cp/usr/local/ssl/openssl.cnf.
Error 2:
Workaround
"XX" > Democa/serial
Reference: http://blog.chinaunix.net/uid-26760055-id-3128132.html
Using OpenSSL to generate certificates under Linux