1. 개요


2. 방법

$ openssl genrsa -des3 -out server.key 2048
Generating RSA private key, 2048 bit long modulus (2 primes)
....................................................................+++++
................................................................................................................................................+++++
e is 65537 (0x010001)
Enter pass phrase for server.key:
Verifying - Enter pass phrase for server.key:
$ openssl req -new -key server.key -out server.csr
Enter pass phrase for server.key:
Can't load /home/ubuntu/.rnd into RNG
140183523729856:error:2406F079:random number generator:RAND_load_file:Cannot open file:../crypto/rand/randfile.c:88:Filename=/home/ubuntu/.rnd
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:KR
State or Province Name (full name) [Some-State]:Seoul
Locality Name (eg, city) []:Seoul
Organization Name (eg, company) [Internet Widgits Pty Ltd]:EniacComputer
Organizational Unit Name (eg, section) []:CPU
Common Name (e.g. server FQDN or YOUR name) []:ip-172-31-8-20
Email Address []:

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
$ cp server.key server.key.origin
$ openssl rsa -in server.key.origin -out server.key
Enter pass phrase for server.key.origin:
writing RSA key
$ ls -l server.key*
-rw------- 1 ubuntu ubuntu 1675 Oct 28 15:59 server.key
-rw------- 1 ubuntu ubuntu 1743 Oct 28 15:59 server.key.origin
$ openssl x509 -req -days 3650 -in server.csr -signkey server.key -out server.crt
Signature ok
subject=C = KR, ST = Seoul, L = Seoul, O = EniacComputer, OU = CPU, CN = ip-172-31-8-20
Getting Private key