1. Java Keytool로 Keystore 및 인증서 생성 → Tomcat에 적용
인증서 및 Keystore 생성 명령어 (JKS)
keytool -genkeypair -alias tomcat -keyalg RSA -keysize 2048 -keystore keystore.jks -validity 3650
🧾 명령어 설명
-genkeypair | 공개키/개인키 쌍 생성 |
-alias tomcat | 인증서 식별자 (Tomcat 내 사용) |
-keyalg RSA | RSA 알고리즘 사용 |
-keysize 2048 | 키 길이 설정 |
-keystore keystore.jks | 생성할 Keystore 파일명 |
-validity 3650 | 인증서 유효기간 (일 단위) |
⚙️ Tomcat 설정 (server.xml)
<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol" SSLEnabled="true">
<SSLHostConfig>
<Certificate certificateKeystoreFile="conf/keystore.jks" certificateKeystorePassword="password" type="RSA" />
</SSLHostConfig>
</Connector>
<SSLHostConfig>
<Certificate certificateKeystoreFile="conf/keystore.jks" certificateKeystorePassword="password" type="RSA" />
</SSLHostConfig>
</Connector>
🧾 태그 설명
태그/속성의미

port="8443" | HTTPS 리스닝 포트 |
protocol | HTTP 1.1 NIO 프로토콜 |
SSLEnabled="true" | SSL 활성화 |
certificateKeystoreFile | Keystore 파일 경로 |
certificateKeystorePassword | Keystore 비밀번호 |
type="RSA" | RSA 인증서 유형 |
Warning

2. JKS → PKCS12 변환 방법
keytool -importkeystore -srckeystore keystore.jks -destkeystore keystore.p12 -deststoretype PKCS12
🧾 명령어 설명
옵션의미
-srckeystore | 원본 JKS 파일 경로 |
-destkeystore | 변환될 PKCS12 파일 경로 |
-deststoretype PKCS12 | 대상 포맷 지정 |
3. PKCS12로 Keystore 및 인증서 생성 → Tomcat에 적용
keytool -genkeypair -alias tomcat -keyalg RSA -keysize 2048 -keystore keystore.p12 -storetype PKCS12 -validity 3650
🧾 명령어 설명
옵션의미
-storetype PKCS12 | 저장 포맷을 PKCS12로 설정 |
나머지 옵션은 위의 JKS와 동일 |
⚙️ Tomcat 설정 (server.xml)
<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol" SSLEnabled="true">
<SSLHostConfig>
<Certificate certificateKeystoreFile="conf/keystore.p12"
certificateKeystorePassword="password"
certificateKeystoreType="PKCS12"
type="RSA"/>
</SSLHostConfig>
</Connector>
<SSLHostConfig>
<Certificate certificateKeystoreFile="conf/keystore.p12"
certificateKeystorePassword="password"
certificateKeystoreType="PKCS12"
type="RSA"/>
</SSLHostConfig>
</Connector>
'지식' 카테고리의 다른 글
[shell] 특정 포트 프로세스 중지/시작 shell 작성 (4) | 2025.06.18 |
---|---|
[JAR] xml-apis.jar (2) | 2025.05.29 |
[Window11] 파일 생성 및 삭제 새로고침 안될 때 (0) | 2025.04.03 |
[IIS] 서버 구축하기(ASP.NET) (0) | 2024.09.05 |
[예외처리] error: unreported exception ..must be caught or declared to be thrown (0) | 2024.07.30 |