@ -41,7 +41,7 @@ import org.springframework.util.StringUtils;
@@ -41,7 +41,7 @@ import org.springframework.util.StringUtils;
* /
public class PemSslStoreBundle implements SslStoreBundle {
private static final String DEFAULT_KEY_ ALIAS = "ssl" ;
private static final String DEFAULT_ALIAS = "ssl" ;
private final KeyStore keyStore ;
@ -60,40 +60,39 @@ public class PemSslStoreBundle implements SslStoreBundle {
@@ -60,40 +60,39 @@ public class PemSslStoreBundle implements SslStoreBundle {
* Create a new { @link PemSslStoreBundle } instance .
* @param keyStoreDetails the key store details
* @param trustStoreDetails the trust store details
* @param keyAlias the key alias to use or { @code null } to use a default alias
* @param alias the alias to use or { @code null } to use a default alias
* /
public PemSslStoreBundle ( PemSslStoreDetails keyStoreDetails , PemSslStoreDetails trustStoreDetails ,
String keyAlias ) {
this ( keyStoreDetails , trustStoreDetails , keyAlias , null ) ;
public PemSslStoreBundle ( PemSslStoreDetails keyStoreDetails , PemSslStoreDetails trustStoreDetails , String alias ) {
this ( keyStoreDetails , trustStoreDetails , alias , null ) ;
}
/ * *
* Create a new { @link PemSslStoreBundle } instance .
* @param keyStoreDetails the key store details
* @param trustStoreDetails the trust store details
* @param keyAlias the key alias to use or { @code null } to use a default alias
* @param keyPassword the password to use for the key
* @param alias the alias to use or { @code null } to use a default alias
* @param keyPassword the password to protect the key ( if one is added )
* @since 3 . 2 . 0
* /
public PemSslStoreBundle ( PemSslStoreDetails keyStoreDetails , PemSslStoreDetails trustStoreDetails , String keyA lias,
public PemSslStoreBundle ( PemSslStoreDetails keyStoreDetails , PemSslStoreDetails trustStoreDetails , String a lias,
String keyPassword ) {
this ( keyStoreDetails , trustStoreDetails , keyA lias, keyPassword , false ) ;
this ( keyStoreDetails , trustStoreDetails , a lias, keyPassword , false ) ;
}
/ * *
* Create a new { @link PemSslStoreBundle } instance .
* @param keyStoreDetails the key store details
* @param trustStoreDetails the trust store details
* @param keyA lias the key alias to use or { @code null } to use a default alias
* @param keyPassword the password to use for the key
* @param a lias the key alias to use or { @code null } to use a default alias
* @param keyPassword the password to protect the key ( if one is added )
* @param verifyKeys whether to verify that the private key matches the public key
* @since 3 . 2 . 0
* /
public PemSslStoreBundle ( PemSslStoreDetails keyStoreDetails , PemSslStoreDetails trustStoreDetails , String keyA lias,
public PemSslStoreBundle ( PemSslStoreDetails keyStoreDetails , PemSslStoreDetails trustStoreDetails , String a lias,
String keyPassword , boolean verifyKeys ) {
this . keyStore = createKeyStore ( "key" , keyStoreDetails , ( keyA lias ! = null ) ? keyA lias : DEFAULT_KEY_ ALIAS ,
keyPassword , verifyKeys ) ;
this . trustStore = createKeyStore ( "trust" , trustStoreDetails , ( keyA lias ! = null ) ? keyA lias : DEFAULT_KEY _ALIAS ,
this . keyStore = createKeyStore ( "key" , keyStoreDetails , ( a lias ! = null ) ? a lias : DEFAULT_ALIAS , keyPassword ,
verifyKeys ) ;
this . trustStore = createKeyStore ( "trust" , trustStoreDetails , ( a lias ! = null ) ? a lias : DEFAULT_ALIAS ,
keyPassword , verifyKeys ) ;
}
@ -112,7 +111,7 @@ public class PemSslStoreBundle implements SslStoreBundle {
@@ -112,7 +111,7 @@ public class PemSslStoreBundle implements SslStoreBundle {
return this . trustStore ;
}
private static KeyStore createKeyStore ( String name , PemSslStoreDetails details , String keyA lias, String keyPassword ,
private static KeyStore createKeyStore ( String name , PemSslStoreDetails details , String a lias, String keyPassword ,
boolean verifyKeys ) {
if ( details = = null | | details . isEmpty ( ) ) {
return null ;
@ -126,10 +125,10 @@ public class PemSslStoreBundle implements SslStoreBundle {
@@ -126,10 +125,10 @@ public class PemSslStoreBundle implements SslStoreBundle {
if ( verifyKeys ) {
verifyKeys ( privateKey , certificates ) ;
}
addPrivateKey ( store , privateKey , keyA lias, keyPassword , certificates ) ;
addPrivateKey ( store , privateKey , a lias, keyPassword , certificates ) ;
}
else {
addCertificates ( store , certificates , keyA lias) ;
addCertificates ( store , certificates , a lias) ;
}
return store ;
}