Add property to enable key verification on PEM SSL bundles
Closes gh-37727
This commit is contained in:
@@ -23,6 +23,7 @@ import org.springframework.boot.ssl.pem.PemSslStoreBundle;
|
||||
*
|
||||
* @author Scott Frederick
|
||||
* @author Phillip Webb
|
||||
* @author Moritz Halbritter
|
||||
* @since 3.1.0
|
||||
* @see PemSslStoreBundle
|
||||
*/
|
||||
@@ -38,6 +39,11 @@ public class PemSslBundleProperties extends SslBundleProperties {
|
||||
*/
|
||||
private final Store truststore = new Store();
|
||||
|
||||
/**
|
||||
* Whether to verify that the private key matches the public key.
|
||||
*/
|
||||
private boolean verifyKeys;
|
||||
|
||||
public Store getKeystore() {
|
||||
return this.keystore;
|
||||
}
|
||||
@@ -46,6 +52,14 @@ public class PemSslBundleProperties extends SslBundleProperties {
|
||||
return this.truststore;
|
||||
}
|
||||
|
||||
public boolean isVerifyKeys() {
|
||||
return this.verifyKeys;
|
||||
}
|
||||
|
||||
public void setVerifyKeys(boolean verifyKeys) {
|
||||
this.verifyKeys = verifyKeys;
|
||||
}
|
||||
|
||||
/**
|
||||
* Store properties.
|
||||
*/
|
||||
|
||||
@@ -109,7 +109,8 @@ public final class PropertiesSslBundle implements SslBundle {
|
||||
private static SslStoreBundle asSslStoreBundle(PemSslBundleProperties properties) {
|
||||
PemSslStoreDetails keyStoreDetails = asStoreDetails(properties.getKeystore());
|
||||
PemSslStoreDetails trustStoreDetails = asStoreDetails(properties.getTruststore());
|
||||
return new PemSslStoreBundle(keyStoreDetails, trustStoreDetails, properties.getKey().getAlias());
|
||||
return new PemSslStoreBundle(keyStoreDetails, trustStoreDetails, properties.getKey().getAlias(), null,
|
||||
properties.isVerifyKeys());
|
||||
}
|
||||
|
||||
private static PemSslStoreDetails asStoreDetails(PemSslBundleProperties.Store properties) {
|
||||
|
||||
Reference in New Issue
Block a user