forked from I2P_Developers/i2p.i2p
Deduplicate the default Java Keystore password
This commit is contained in:
@@ -25,7 +25,6 @@ import net.i2p.util.SecureDirectory;
|
||||
public class SSLClientUtil {
|
||||
|
||||
private static final String PROP_KEYSTORE_PASSWORD = "keystorePassword";
|
||||
private static final String DEFAULT_KEYSTORE_PASSWORD = "changeit";
|
||||
private static final String PROP_KEY_PASSWORD = "keyPassword";
|
||||
private static final String PROP_KEY_ALIAS = "keyAlias";
|
||||
private static final String ASCII_KEYFILE_SUFFIX = ".local.crt";
|
||||
@@ -111,7 +110,7 @@ public class SSLClientUtil {
|
||||
if (success) {
|
||||
success = ks.exists();
|
||||
if (success) {
|
||||
opts.setProperty(optPfx + PROP_KEYSTORE_PASSWORD, DEFAULT_KEYSTORE_PASSWORD);
|
||||
opts.setProperty(optPfx + PROP_KEYSTORE_PASSWORD, KeyStoreUtil.DEFAULT_KEYSTORE_PASSWORD);
|
||||
opts.setProperty(optPfx + PROP_KEY_PASSWORD, keyPassword);
|
||||
}
|
||||
}
|
||||
@@ -139,7 +138,7 @@ public class SSLClientUtil {
|
||||
File sdir = new SecureDirectory(I2PAppContext.getGlobalContext().getConfigDir(), CERT_DIR);
|
||||
if (sdir.exists() || sdir.mkdirs()) {
|
||||
String keyAlias = opts.getProperty(optPfx + PROP_KEY_ALIAS);
|
||||
String ksPass = opts.getProperty(optPfx + PROP_KEYSTORE_PASSWORD, DEFAULT_KEYSTORE_PASSWORD);
|
||||
String ksPass = opts.getProperty(optPfx + PROP_KEYSTORE_PASSWORD, KeyStoreUtil.DEFAULT_KEYSTORE_PASSWORD);
|
||||
File out = new File(sdir, PREFIX + name + ASCII_KEYFILE_SUFFIX);
|
||||
boolean success = KeyStoreUtil.exportCert(ks, ksPass, keyAlias, out);
|
||||
if (!success)
|
||||
@@ -157,7 +156,7 @@ public class SSLClientUtil {
|
||||
* @return factory, throws on all errors
|
||||
*/
|
||||
public static SSLServerSocketFactory initializeFactory(Properties opts) throws IOException {
|
||||
String ksPass = opts.getProperty(PROP_KEYSTORE_PASSWORD, DEFAULT_KEYSTORE_PASSWORD);
|
||||
String ksPass = opts.getProperty(PROP_KEYSTORE_PASSWORD, KeyStoreUtil.DEFAULT_KEYSTORE_PASSWORD);
|
||||
String keyPass = opts.getProperty(PROP_KEY_PASSWORD);
|
||||
if (keyPass == null) {
|
||||
throw new IOException("No key password, set " + PROP_KEY_PASSWORD + " in " +
|
||||
|
Reference in New Issue
Block a user