Skip to content

Latest commit

 

History

History
32 lines (26 loc) · 1.21 KB

File metadata and controls

32 lines (26 loc) · 1.21 KB

Creating a Key Store for Testing

To create a keystore for testing, you can use a command resembling the following:

$ keytool -genkeypair -alias mytestkey -keyalg RSA \
  -dname "CN=Web Server,OU=Unit,O=Organization,L=City,S=State,C=US" \
  -keypass changeme -keystore server.jks -storepass letmein -storetype JKS
Note
When using JDK 11 or above, you may get the following warning when using the command above. In this case you probably want to ensure the keypass and storepass values match.
WARNING:  Different store and key passwords are not supported for PKCS12 KeyStores. Ignoring user-specified -keypass value.

Put the server.jks file in the classpath (for instance) and then, in your application.properties create the following settings:

encrypt:
  keyStore:
    location: classpath:/server.jks
    password: letmein
    alias: mytestkey
    secret: changeme
Tip
If you want to use bootstrap.yml instead of application.properties you must first enable it through spring.cloud.bootstrap.enabled=true or include the dependency (maven, gradle) as groupId:org.springframework.cloud and artifactId:spring-cloud-starter-bootstrap.