Skip to content

Commit

Permalink
[ELY-2053] key-store-masked-password needs the elytron provider to be…
Browse files Browse the repository at this point in the history
… manually registered
  • Loading branch information
rmartinc authored and ivassile committed Feb 2, 2021
1 parent f340095 commit 2288b5b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 2288b5b

Please sign in to comment.