From 75838004eaf176ae3cffa44f1ecbcf101dea4360 Mon Sep 17 00:00:00 2001 From: Ryan Baxter Date: Wed, 27 Feb 2019 11:53:39 -0500 Subject: [PATCH] Use jks as the default KeyStore type (#1258) * Always use jks as the KeyStore type instead of trying to extract it from the resource extension. Fixes #1176 * Use property to decide the type of KeyStore to create --- docs/src/main/asciidoc/spring-cloud-config.adoc | 1 + pom.xml | 4 ++-- spring-cloud-config-dependencies/pom.xml | 2 +- .../config/server/config/EncryptionAutoConfiguration.java | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/src/main/asciidoc/spring-cloud-config.adoc b/docs/src/main/asciidoc/spring-cloud-config.adoc index 781b4236..1fe9644f 100644 --- a/docs/src/main/asciidoc/spring-cloud-config.adoc +++ b/docs/src/main/asciidoc/spring-cloud-config.adoc @@ -983,6 +983,7 @@ keystore properties are `encrypt.keyStore.\*` with `*` equal to |`encrypt.keyStore.location`|Contains a `Resource` location |`encrypt.keyStore.password`|Holds the password that unlocks the keystore |`encrypt.keyStore.alias`|Identifies which key in the store to use +|`encrypt.keyStore.type`|The type of KeyStore to create. Defaults to `jks`. |=== The encryption is done with the public key, and a private key is diff --git a/pom.xml b/pom.xml index 2af4aebb..5f9d8277 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ org.springframework.cloud spring-cloud-build - 2.0.5.BUILD-SNAPSHOT + 2.0.6.BUILD-SNAPSHOT @@ -22,7 +22,7 @@ config - 2.0.3.BUILD-SNAPSHOT + 2.0.4.BUILD-SNAPSHOT spring-cloud-config-dependencies diff --git a/spring-cloud-config-dependencies/pom.xml b/spring-cloud-config-dependencies/pom.xml index 2c6d605c..2471e9dd 100644 --- a/spring-cloud-config-dependencies/pom.xml +++ b/spring-cloud-config-dependencies/pom.xml @@ -5,7 +5,7 @@ spring-cloud-dependencies-parent org.springframework.cloud - 2.0.5.BUILD-SNAPSHOT + 2.0.6.BUILD-SNAPSHOT spring-cloud-config-dependencies diff --git a/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/config/EncryptionAutoConfiguration.java b/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/config/EncryptionAutoConfiguration.java index 3782064f..63497663 100644 --- a/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/config/EncryptionAutoConfiguration.java +++ b/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/config/EncryptionAutoConfiguration.java @@ -97,7 +97,7 @@ public class EncryptionAutoConfiguration { KeyStore keyStore = this.key.getKeyStore(); KeyStoreTextEncryptorLocator locator = new KeyStoreTextEncryptorLocator( new KeyStoreKeyFactory(keyStore.getLocation(), - keyStore.getPassword().toCharArray()), + keyStore.getPassword().toCharArray(), key.getKeyStore().getType()), keyStore.getSecret(), keyStore.getAlias()); RsaAlgorithm algorithm = this.rsaProperties.getAlgorithm(); locator.setRsaAlgorithm(algorithm);