Methods Summary |
---|
public java.security.KeyStore | getKeyStore(java.lang.String token)
int idx = getTokenIndex(token);
if (idx < 0) {
return null;
}
return (KeyStore)keyStores.get(idx);
|
public java.lang.String | getKeyStorePassword(java.lang.String token)
int idx = getTokenIndex(token);
if (idx < 0) {
return null;
}
return (String)keyStorePasswords.get(idx);
|
public java.lang.String[] | getKeyStorePasswords()This method returns an array of passwords in order corresponding to
array of keystores.
return (String[])keyStorePasswords.toArray(new String[keyStorePasswords.size()]);
|
public java.security.KeyStore[] | getKeyStores()This method returns an array of keystores containing keys and
certificates.
return (KeyStore[])keyStores.toArray(new KeyStore[keyStores.size()]);
|
private int | getTokenIndex(java.lang.String token)
int idx = -1;
if (token!=null) {
idx = tokenNames.indexOf(token);
if (idx < 0 && _logger.isLoggable(Level.FINEST)) {
_logger.log(Level.FINEST, "token " + token + " is not found");
}
}
return idx;
|
public java.lang.String[] | getTokenNames()This method returns an array of token names in order corresponding to
array of keystores.
return (String[])tokenNames.toArray(new String[tokenNames.size()]);
|
public java.security.KeyStore | getTrustStore(java.lang.String token)
int idx = getTokenIndex(token);
if (idx < 0) {
return null;
}
return (KeyStore)trustStores.get(idx);
|
public java.security.KeyStore[] | getTrustStores()This method returns an array of truststores containing certificates.
return (KeyStore[])trustStores.toArray(new KeyStore[trustStores.size()]);
|
protected void | initJKS()
if (!initialized) {
loadStores(null, KeyStore.getDefaultType(), null,
System.getProperty(keyStoreProp), SSLUtils.getKeyStorePass(),
System.getProperty(trustStoreProp), SSLUtils.getTrustStorePass());
initialized = true;
}
|
private static java.security.KeyStore | loadKS(java.lang.String keyStoreType, java.security.Provider provider, java.lang.String keyStoreFile, java.lang.String keyStorePass)This method load keystore with given keystore file and
keystore password for a given keystore type and provider.
It always return a non-null keystore.
KeyStore ks = null;
if (provider != null) {
ks = KeyStore.getInstance(keyStoreType, provider);
} else {
ks = KeyStore.getInstance(keyStoreType);
}
char[] passphrase = keyStorePass.toCharArray();
FileInputStream istream = null;
BufferedInputStream bstream = null;
try {
if (keyStoreFile != null) {
if (_logger.isLoggable(Level.FINE)) {
_logger.log(Level.FINE, "Loading keystoreFile = " +
keyStoreFile + ", keystorePass = " + keyStorePass);
}
istream = new FileInputStream(keyStoreFile);
bstream = new BufferedInputStream(istream);
}
ks.load(bstream, passphrase);
} finally {
if (bstream != null) {
bstream.close();
}
if (istream != null) {
istream.close();
}
}
return ks;
|
protected static synchronized void | loadStores(java.lang.String tokenName, java.lang.String storeType, java.security.Provider provider, java.lang.String keyStoreFile, java.lang.String keyStorePass, java.lang.String trustStoreFile, java.lang.String trustStorePass)This method will load keystore and truststore and add into
corresponding list.
try {
KeyStore keyStore = loadKS(storeType, provider, keyStoreFile,
keyStorePass);
KeyStore trustStore = loadKS(storeType, provider,trustStoreFile,
trustStorePass);
keyStores.add(keyStore);
trustStores.add(trustStore);
keyStorePasswords.add(keyStorePass);
tokenNames.add(tokenName);
} catch(Exception ex) {
throw new IllegalStateException(ex.getMessage());
}
|
public void | synchronizeKeyFile(com.sun.enterprise.config.ConfigContext configContext, java.lang.String fileRealmName)This method synchronize key file for given realm.
// no op
|