본문 바로가기

IT TechStory

openssl 인증서 생성 및 적용

반응형

1. 개인키 생성

  # openssl genrsa -des3 -out evon.key.origin 2048

    Generating RSA private key, 2048 bit long modulus
.............+++
.......................+++
e is 65537 (0x10001)
Enter pass phrase for evon.key.origin:
Verifying - Enter pass phrase for evon.key.origin:

 

2. 인증요청서(CSR)생성

 #  openssl req -new -key evon.key.origin -out evon.csr

 

Enter pass phrase for evon.key.origin:
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) [XX]:kr
State or Province Name (full name) []:seongnam
Locality Name (eg, city) [Default City]:bundang
Organization Name (eg, company) [Default Company Ltd]:onit
Organizational Unit Name (eg, section) []:si
Common Name (eg, your name or your server's hostname) []:127.0.0.1
Email Address []:onit3772@gmail.com

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:

 

3. 개인키 비밀번호 제거

# openssl rsa -in evon.key.origin -out evon.key

Enter pass phrase for evon.key.origin:
writing RSA key

 

4. 인증서 생성 (CRT)

# openssl x509 -req -days 3650 -in evon.csr -signkey evon.key -out evon.crt

Signature ok
subject=/C=kr/ST=seongnam/L=bundang/O=onit/OU=si/CN=127.0.0.1/emailAddress=onit3772@gmail.com
Getting Private key

 

5. 톰캣용 키스토어 파일 생성

#  openssl pkcs12 -export -in evon.crt -inkey evon.key -out evon.p12 -name tomcat

Enter Export Password:
Verifying - Enter Export Password:

 

반응형