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
在使用 JDK 11 或更高版本时,在使用上述命令时可能会收到以下警告。在这种情况下,您可能需要确保 |
When using JDK 11 or above you may get the following warning when using the command above. In this case
you probably want to make sure the |
Warning: Different store and key passwords not supported for PKCS12 KeyStores. Ignoring user-specified -keypass value.
将 server.jks
文件放入类路径(例如),然后在 Config Server 的 bootstrap.yml
中创建以下设置:
Put the server.jks
file in the classpath (for instance) and then, in
your bootstrap.yml
, for the Config Server, create the following settings:
encrypt:
keyStore:
location: classpath:/server.jks
password: letmein
alias: mytestkey
secret: changeme