4141 */
4242public class PemSslStoreBundle implements SslStoreBundle {
4343
44- private static final String DEFAULT_KEY_ALIAS = "ssl" ;
44+ private static final String DEFAULT_ALIAS = "ssl" ;
4545
4646 private final KeyStore keyStore ;
4747
@@ -60,40 +60,39 @@ public PemSslStoreBundle(PemSslStoreDetails keyStoreDetails, PemSslStoreDetails
6060 * Create a new {@link PemSslStoreBundle} instance.
6161 * @param keyStoreDetails the key store details
6262 * @param trustStoreDetails the trust store details
63- * @param keyAlias the key alias to use or {@code null} to use a default alias
63+ * @param alias the alias to use or {@code null} to use a default alias
6464 */
65- public PemSslStoreBundle (PemSslStoreDetails keyStoreDetails , PemSslStoreDetails trustStoreDetails ,
66- String keyAlias ) {
67- this (keyStoreDetails , trustStoreDetails , keyAlias , null );
65+ public PemSslStoreBundle (PemSslStoreDetails keyStoreDetails , PemSslStoreDetails trustStoreDetails , String alias ) {
66+ this (keyStoreDetails , trustStoreDetails , alias , null );
6867 }
6968
7069 /**
7170 * Create a new {@link PemSslStoreBundle} instance.
7271 * @param keyStoreDetails the key store details
7372 * @param trustStoreDetails the trust store details
74- * @param keyAlias the key alias to use or {@code null} to use a default alias
75- * @param keyPassword the password to use for the key
73+ * @param alias the alias to use or {@code null} to use a default alias
74+ * @param keyPassword the password to protect the key (if one is added)
7675 * @since 3.2.0
7776 */
78- public PemSslStoreBundle (PemSslStoreDetails keyStoreDetails , PemSslStoreDetails trustStoreDetails , String keyAlias ,
77+ public PemSslStoreBundle (PemSslStoreDetails keyStoreDetails , PemSslStoreDetails trustStoreDetails , String alias ,
7978 String keyPassword ) {
80- this (keyStoreDetails , trustStoreDetails , keyAlias , keyPassword , false );
79+ this (keyStoreDetails , trustStoreDetails , alias , keyPassword , false );
8180 }
8281
8382 /**
8483 * Create a new {@link PemSslStoreBundle} instance.
8584 * @param keyStoreDetails the key store details
8685 * @param trustStoreDetails the trust store details
87- * @param keyAlias the key alias to use or {@code null} to use a default alias
88- * @param keyPassword the password to use for the key
86+ * @param alias the key alias to use or {@code null} to use a default alias
87+ * @param keyPassword the password to protect the key (if one is added)
8988 * @param verifyKeys whether to verify that the private key matches the public key
9089 * @since 3.2.0
9190 */
92- public PemSslStoreBundle (PemSslStoreDetails keyStoreDetails , PemSslStoreDetails trustStoreDetails , String keyAlias ,
91+ public PemSslStoreBundle (PemSslStoreDetails keyStoreDetails , PemSslStoreDetails trustStoreDetails , String alias ,
9392 String keyPassword , boolean verifyKeys ) {
94- this .keyStore = createKeyStore ("key" , keyStoreDetails , (keyAlias != null ) ? keyAlias : DEFAULT_KEY_ALIAS ,
95- keyPassword , verifyKeys );
96- this .trustStore = createKeyStore ("trust" , trustStoreDetails , (keyAlias != null ) ? keyAlias : DEFAULT_KEY_ALIAS ,
93+ this .keyStore = createKeyStore ("key" , keyStoreDetails , (alias != null ) ? alias : DEFAULT_ALIAS , keyPassword ,
94+ verifyKeys );
95+ this .trustStore = createKeyStore ("trust" , trustStoreDetails , (alias != null ) ? alias : DEFAULT_ALIAS ,
9796 keyPassword , verifyKeys );
9897 }
9998
@@ -112,7 +111,7 @@ public KeyStore getTrustStore() {
112111 return this .trustStore ;
113112 }
114113
115- private static KeyStore createKeyStore (String name , PemSslStoreDetails details , String keyAlias , String keyPassword ,
114+ private static KeyStore createKeyStore (String name , PemSslStoreDetails details , String alias , String keyPassword ,
116115 boolean verifyKeys ) {
117116 if (details == null || details .isEmpty ()) {
118117 return null ;
@@ -126,10 +125,10 @@ private static KeyStore createKeyStore(String name, PemSslStoreDetails details,
126125 if (verifyKeys ) {
127126 verifyKeys (privateKey , certificates );
128127 }
129- addPrivateKey (store , privateKey , keyAlias , keyPassword , certificates );
128+ addPrivateKey (store , privateKey , alias , keyPassword , certificates );
130129 }
131130 else {
132- addCertificates (store , certificates , keyAlias );
131+ addCertificates (store , certificates , alias );
133132 }
134133 return store ;
135134 }
0 commit comments