Skip to content

Commit

Permalink
[ELY-2774] Also make it possible to get the KeyStore type and location.
Browse files Browse the repository at this point in the history
  • Loading branch information
darranl committed Jun 27, 2024
1 parent 4119a7e commit a5cea70
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ public KeyStore getBeetlesKeyStore() {
return loadKeyStore(new File(workingDir, BEETLES_STORE));
}

public String getKeyStoreType() {
return KEYSTORE_TYPE;
}

/**
* @deprecated Use {@link CommonIdentity#getCertificate()} instead.
*/
Expand Down Expand Up @@ -364,8 +368,12 @@ private static KeyStore createEmptyKeyStore() {
}
}

File getKeyStoreFile(Identity identity) {
return new File(workingDir, identity.getKeyStoreName());
}

KeyStore loadKeyStore(final Identity identity) {
return loadKeyStore(new File(workingDir, identity.getKeyStoreName()));
return loadKeyStore(getKeyStoreFile(identity));
}

static KeyStore loadKeyStore(final File location) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package org.wildfly.security.ssl.test.util;

import java.io.File;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
Expand All @@ -42,8 +43,14 @@ public X509Certificate getCertificate() {
return certificate;
}

public String getKeyStoreType() {
return caGenerationTool.getKeyStoreType();
}

public abstract KeyStore loadKeyStore();

public abstract File getKeyStoreFile();

public X509ExtendedKeyManager createKeyManager() {
caGenerationTool.assertNotClosed();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,9 @@ public KeyStore loadKeyStore() {
return CAGenerationTool.loadKeyStore(keyStoreFile);
}

@Override
public File getKeyStoreFile() {
return keyStoreFile;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package org.wildfly.security.ssl.test.util;

import java.io.File;
import java.security.KeyStore;
import java.security.cert.X509Certificate;

Expand All @@ -38,4 +39,9 @@ public KeyStore loadKeyStore() {
return caGenerationTool.loadKeyStore(identity);
}

@Override
public File getKeyStoreFile() {
return caGenerationTool.getKeyStoreFile(identity);
}

}

0 comments on commit a5cea70

Please sign in to comment.