WEB

Https 로컬 용 Keystore 생성 및 Camel ssl 적용 방법

SDeveloper 2020. 10. 13. 08:58
반응형

 

1. Keystore 생성 방법

 

1) keystore 생성

keytool -genkey -v -keystore server -alias server -keyalg RSA -keysize 2048 -validity 10000   

keytool -genkey -v -keystore client -alias client -keyalg RSA -keysize 2048 -validity 10000  

 

2) truststore 생성

keytool -export -alias server -keystore server -rfc -file trustServer.cer

keytool -export -alias client -keystore client -rfc -file trustClient.cer 

 

3) cacerts 파일에 keystore추가 

이때 cacerts는 C:\Program Files\Java\jre1.8.0_261\lib\security 아래 경로에 저장하도록 한다.

 

keytool -import -alias trustServer -file trustServer.cer -keystore cacerts –storepass changeit 

keytool -import -alias trustClient -file trustClient.cer -keystore cacerts –storepass changeit 

 

2. Camel https ssl 적용 방법

1) route 설정

route 뒤에 'ssl=true&sslContextParameters=#sslContextParameters'를 추가해준다.

<route id="server" autoStartup="true" shutdownRunningTask="CompleteAllTasks">
	  <from uri="netty4-http:http://127.0.0.1:8084/analyzer?matchOnUriPrefix=true&amp;reuseChannel=true&amp;mapHeaders=false&amp;ssl=true&amp;sslContextParameters=#sslContextParameters" />
 		

 

2) sslContextParameters 설정

sslContextParameters에 아까 생성한 key

	<sslContextParameters id="sslContextParameters" xmlns="http://camel.apache.org/schema/spring">
   		<keyManagers keyPassword="123456">
      		<keyStore resource="C:\Program Files\Java\jdk1.8.0_261\bin\server" password="123456" />
   		</keyManagers>
	</sslContextParameters>

 

반응형