Skip to content

Commit

Permalink
Merge pull request #1484 from ivassile/JBEAP-20943
Browse files Browse the repository at this point in the history
[ELY-2053] key-store-masked-password needs the elytron provider to be manually registered
  • Loading branch information
darranl committed Mar 18, 2021
2 parents aee5147 + 2288b5b commit 9251b66
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
Expand Up @@ -1749,7 +1749,7 @@ static void parseKeyStoreType(ConfigurationXMLStreamReader reader, final Version
passwordFactory = () -> {
try {
Password password = maskedPassword.get();
PasswordFactory factory = PasswordFactory.getInstance(password.getAlgorithm());
PasswordFactory factory = PasswordFactory.getInstance(password.getAlgorithm(), providersSupplier);
ClearPasswordSpec spec = factory.getKeySpec(password, ClearPasswordSpec.class);
return spec.getEncodedPassword();
} catch (GeneralSecurityException e) {
Expand Down
Expand Up @@ -26,9 +26,7 @@
import java.security.KeyPairGenerator;
import java.security.KeyStore;
import java.security.PrivateKey;
import java.security.Provider;
import java.security.PublicKey;
import java.security.Security;
import java.security.cert.X509Certificate;

import javax.net.ssl.SSLContext;
Expand All @@ -40,7 +38,6 @@
import org.junit.Test;
import org.wildfly.client.config.ConfigXMLParseException;
import org.wildfly.security.SecurityFactory;
import org.wildfly.security.WildFlyElytronProvider;
import org.wildfly.security.credential.PasswordCredential;
import org.wildfly.security.password.Password;
import org.wildfly.security.password.interfaces.ClearPassword;
Expand All @@ -55,7 +52,6 @@ public class ElytronXmlParserTest {
private static File KEYSTORE_DIR = new File("./target/keystore");
private static final String CLIENT_KEYSTORE_FILENAME = "/client.keystore";
private static final char[] PASSWORD = "password".toCharArray();
private static final Provider provider = new WildFlyElytronProvider();


/**
Expand Down Expand Up @@ -158,8 +154,6 @@ public void testMaskedCredential() throws Exception {

@BeforeClass
public static void prepareKeyStores() throws Exception {
Security.addProvider(provider);

if (KEYSTORE_DIR.exists() == false) {
KEYSTORE_DIR.mkdirs();
}
Expand All @@ -178,6 +172,7 @@ public static void prepareKeyStores() throws Exception {

@AfterClass
public static void removeProvider() {
Security.removeProvider(provider.getName());
Assert.assertTrue("Keystore deleted", new File(KEYSTORE_DIR, CLIENT_KEYSTORE_FILENAME).delete());
Assert.assertTrue("Keystore directory deleted", KEYSTORE_DIR.delete());
}
}

0 comments on commit 9251b66

Please sign in to comment.