@@ -100,9 +100,6 @@ KeyStore getKeystore(KeyStoreBuilder params, Provider provider) throws KeyStoreE
100100 try {
101101 ks .load (null , null );
102102 String keypass = params .keypass ();
103- if (keypass == null ) {
104- keypass = params .storepass ();
105- }
106103 ks .setKeyEntry ("jsign" , privateKey , keypass != null ? keypass .toCharArray () : new char [0 ], chain );
107104 } catch (Exception e ) {
108105 throw new KeyStoreException (e );
@@ -122,6 +119,10 @@ void validate(KeyStoreBuilder params) {
122119 if (!params .createFile (params .keystore ()).exists ()) {
123120 throw new IllegalArgumentException ("The keystore " + params .keystore () + " couldn't be found" );
124121 }
122+ if (params .keypass () == null && params .storepass () != null ) {
123+ // reuse the storepass as the keypass
124+ params .keypass (params .storepass ());
125+ }
125126 }
126127 },
127128
@@ -135,6 +136,10 @@ void validate(KeyStoreBuilder params) {
135136 if (!params .createFile (params .keystore ()).exists ()) {
136137 throw new IllegalArgumentException ("The keystore " + params .keystore () + " couldn't be found" );
137138 }
139+ if (params .keypass () == null && params .storepass () != null ) {
140+ // reuse the storepass as the keypass
141+ params .keypass (params .storepass ());
142+ }
138143 }
139144 },
140145
@@ -148,6 +153,10 @@ void validate(KeyStoreBuilder params) {
148153 if (!params .createFile (params .keystore ()).exists ()) {
149154 throw new IllegalArgumentException ("The keystore " + params .keystore () + " couldn't be found" );
150155 }
156+ if (params .keypass () == null && params .storepass () != null ) {
157+ // reuse the storepass as the keypass
158+ params .keypass (params .storepass ());
159+ }
151160 }
152161 },
153162
@@ -385,11 +394,6 @@ Provider getProvider(KeyStoreBuilder params) {
385394 throw new IllegalStateException ("Authentication failed with SSL.com" , e );
386395 }
387396 }
388-
389- @ Override
390- boolean reuseKeyStorePassword () {
391- return false ;
392- }
393397 },
394398
395399 /**
@@ -656,13 +660,6 @@ Set<String> getAliases(KeyStore keystore) throws KeyStoreException {
656660 return new LinkedHashSet <>(Collections .list (keystore .aliases ()));
657661 }
658662
659- /**
660- * Tells if the keystore password can be reused as the key password.
661- */
662- boolean reuseKeyStorePassword () {
663- return true ;
664- }
665-
666663 /**
667664 * Guess the type of the keystore from the header or the extension of the file.
668665 *
0 commit comments