일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |
- QueryDSL
- Spring Open Feign
- vue.js
- cassandra
- argo cd
- Hibernate
- docker compose mysql
- Airflow
- RabbitMQ
- JPA
- Selenium
- netflix oss
- redis
- spring boot redis
- KAFKA
- MySQL
- mybatis
- grafana
- jmeter
- docker
- Redis Sentinel
- docker-compose
- coalesce
- Netty
- spring cloud
- Docker Compose
- weblogic 10
- WebLogic
- ChannelPipeline
- spring boot
- Today
- Total
IT.FARMER
keytool SSL 사설 인증서 / Spring boot ssl 본문
## java keytool SSL 사설 인증서
### example 1
1. keystore 생성
> keytool -genkey -alias skan_https_ssl -keypass password1234!!! -storepass password1234!!! -storetype PKCS12 -keyalg RSA -keystore d:\data\https_ssl\.keystore
2. keystore 생성 후 *.cer 내보내기 (cer생성)
> keytool -export -alias skan_https_ssl -storepass password1234!!! -file d:\data\https_ssl\server.cer -keystore d:\data\https_ssl\.keystore
3. 인증서를(server.cer) .keystore 에 추가
> keytool -import -v -trustcacerts -alias keyAlias -file d:\data\https_ssl\server.cer -keystore d:\data\https_ssl\.keystore -keypass password1234!!! -storepass password1234!!!
### example 2
1. keystore 생성 - PKCS12 RSA사용 기간 3650일
keytool -genkey -alias skan_ssl -storetype PKCS12 -keyalg RSA -keysize 2048 -keystore keystore.p12 -validity 3650
### option
1) -genkey : 개인 키와 자체서명 인증서를 생성하는 명령어
## genkey 상세
-alias skan_ssl : 키 의 고유 별칭 값
-storetype PKCS12 : key store 타입 지정 기본 JKS 방식 (https://en.wikipedia.org/wiki/PKCS_12)
-keyalg RSA : key 생성 알고리즘 RSA
-keysize 2048
-keystore keystore.p12 : 키가 저장될 위치 및 파일
-keypass password1234!!! : 비밀번호
-storepass password1234!!! : 비밀번호
-validity 3650 : 인증서 유효 기간설정
2) -export : 인증서 파일 추출(truststore)
3) -import : 인증서를 키 스토어에 저장
4) -list : JKS파일 조회
### Spring boot 에서 SSL 사용하기
1. example 1번 실행후 .keystore 파일을 프로젝트 최상단에 복사
project-web
|--src
|-build
|-out
.keystore
2. application.yml 파일에 SSL 설정 추가
server:
port: 443
servlet:
context-path: /
ssl:
enabled: true
key-store: .keystore
key-store-password: password1234!!!
key-store-type: PKCS12
key-alias: skan_https_ssl
'JAVA' 카테고리의 다른 글
java 8 stream throw exception bubble up (예외사항 전파) (0) | 2019.05.07 |
---|---|
linux java 설치 (cent os) update-alternatives (0) | 2019.03.31 |
java Blocking Queue (0) | 2019.02.26 |
JAVA Exception 정리 (0) | 2019.02.26 |
ExecutorService / ThreadPoolExecutor (0) | 2018.11.12 |