public SSLServerSocketFactory createSSLServerFactory(String provider, String protocol,
String algorithm, String keyStore,
String keyAlias, String trustStore) throws GeneralSecurityException {
KeystoreInstance keyInstance = getKeystore(keyStore);
if (keyInstance.isKeystoreLocked()) {
throw new KeystoreIsLocked("Keystore '" + keyStore
+ "' is locked; please use the keystore page in the admin console to unlock it");
}
if (keyInstance.isKeyLocked(keyAlias)) {
throw new KeystoreIsLocked("Key '" + keyAlias + "' in keystore '" + keyStore
+ "' is locked; please use the keystore page in the admin console to unlock it");
}
KeystoreInstance trustInstance = trustStore == null ? null : getKeystore(trustStore);
if (trustInstance != null && trustInstance.isKeystoreLocked()) {
throw new KeystoreIsLocked("Keystore '" + trustStore
+ "' is locked; please use the keystore page in the admin console to unlock it");
}
// OMG this hurts, but it causes ClassCastExceptions elsewhere unless
// done this way!