為測試建立金鑰庫

要建立用於測試的金鑰庫,您可以使用類似以下內容的命令

$ 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 或更高版本時,您在使用上述命令時可能會收到以下警告。在這種情況下,您可能需要確保 keypassstorepass 值匹配。
PKCS12 金鑰庫不支援不同的儲存和金鑰密碼。忽略使用者指定的 -keypass 值。

server.jks 檔案放在類路徑中(例如),然後在您的 Config Server 的 bootstrap.yml 中建立以下設定

encrypt:
  keyStore:
    location: classpath:/server.jks
    password: letmein
    alias: mytestkey
    secret: changeme
© . This site is unofficial and not affiliated with VMware.