Skip to content

Commit

Permalink
0004627: Hardcoded KeyManagerFactory algorithm (sunX509). Symmetric
Browse files Browse the repository at this point in the history
doesn't work for IBM JRE
  • Loading branch information
Philip Marzullo committed Nov 6, 2020
1 parent 7740830 commit df963fa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Expand Up @@ -38,6 +38,8 @@ public class SecurityConstants {

public static final String SYSPROP_SSL_IGNORE_CIPHERS = "symmetric.ssl.ignore.ciphers";

public static final String SYSPROP_KEY_MANAGER_FACTORY_ALGORITHM = "sym.key.manager.factory.algorithm";

public final static String CLASS_NAME_SECURITY_SERVICE = "security.service.class.name";

public static final String PREFIX_ENC = "enc:";
Expand Down
Expand Up @@ -100,7 +100,7 @@ public KeyStore getKeyStore() {
public KeyManagerFactory getKeyManagerFactory() {
KeyManagerFactory keyManagerFactory;
try {
keyManagerFactory = KeyManagerFactory.getInstance("SunX509");
keyManagerFactory = KeyManagerFactory.getInstance(getKeyManagerFactoryAlgorithm());
keyManagerFactory.init(getKeyStore(), getKeyStorePassword().toCharArray());
} catch (RuntimeException e) {
throw e;
Expand Down Expand Up @@ -278,6 +278,10 @@ protected String getKeyStorePassword() {
password = (password != null) ? password : SecurityConstants.KEYSTORE_PASSWORD;
return password;
}

protected String getKeyManagerFactoryAlgorithm() {
return System.getProperty(SecurityConstants.SYSPROP_KEY_MANAGER_FACTORY_ALGORITHM, "SunX509");
}

protected SecretKey getSecretKey() throws Exception {
String password = getKeyStorePassword();
Expand Down

0 comments on commit df963fa

Please sign in to comment.