2016年4月27日星期三

Use OpenSSL to generate RSA private key and public key

Generate RSA private key
1、openssl genrsa -out rsa_private_key.pem 1024

Convert RSA private key into PKCS8 format
2、openssl pkcs8 -topk8 -inform PEM -in rsa_private_key.pem -out PEM -nocrypt

Generate RSA public key
3、openssl rsa -in rsa_private_key.pem -pubout -out rsa_public_key.pem

Now the RSA key pair is available


2016年4月26日星期二

How to configure LetsEncrypt SSL cert on Nginx

Step 1、You need to compile Nginx from source code for support ssl:
              ./configure --with-http_ssl_module
Step 2、Get letsencrypt client: git clone https://github.com/letsencrypt/letsencrypt
Step 3、Run letsencrypt client to generate the cert(You need stop nginx service if you have already run a nginx server and specify the full root path of your website ):
              cd letsencrypt
              ./letsencrypt-auto certonly --standalone --email ***@email.com -d www.yourdomain.com --webroot=/www/web/
Step 4、Configure the nginx server
              listen    443 ssl;
              ssl_protocols TLSv1.2 TLSv1.1 TLSv1
              ssl_certificate /etc/letsencrypt/live/www.yourdomain.com/fullchain.pem;
              ssl_certificate_key /etc/letsencrypt/live/www.yourdomain.com/privkey.pem;