use of com.sun.identity.saml.xmlsig.JKSKeyProvider in project OpenAM by OpenRock.
the class Client method initializeJSSE.
/**
* Initializes JSSE enviroment.
*
* @throws Exception if an error occurs while initializing JSSE
*/
private static void initializeJSSE() throws Exception {
// put SunJSSE at fisrt place, so that JSSE will work
Provider provider = Security.getProvider("SunJSSE");
if (provider != null) {
Security.removeProvider("SunJSSE");
Security.insertProviderAt(provider, 1);
}
String algorithm = SystemPropertiesManager.get(SOAP_TRUST_SECMNGR_ALGO_PROP);
if (algorithm == null || algorithm.length() <= 0) {
algorithm = "SunX509";
}
JKSKeyProvider jkskp = createKeyProvider();
KeyStore trustStore = jkskp.getKeyStore();
KeyManagerFactory kf = KeyManagerFactory.getInstance(algorithm);
kf.init(trustStore, jkskp.getPrivateKeyPass().toCharArray());
kms = kf.getKeyManagers();
defaultX509km = (X509KeyManager) kms[0];
defineTrustManager(trustStore, algorithm);
}
use of com.sun.identity.saml.xmlsig.JKSKeyProvider in project OpenAM by OpenRock.
the class TaskModelImpl method getSigningKeys.
/**
* Returns a set of signing keys.
*
* @return a set of signing keys.
*/
public Set getSigningKeys() throws AMConsoleException {
try {
Set keyEntries = new HashSet();
JKSKeyProvider kp = new JKSKeyProvider();
KeyStore ks = kp.getKeyStore();
Enumeration e = ks.aliases();
if (e != null) {
while (e.hasMoreElements()) {
String alias = (String) e.nextElement();
if (ks.isKeyEntry(alias)) {
keyEntries.add(alias);
}
}
}
return keyEntries;
} catch (KeyStoreException e) {
throw new AMConsoleException(e.getMessage());
}
}
Aggregations