Commit 4ad55187 authored by Guus der Kinderen's avatar Guus der Kinderen

OF-1049 Test identity store when initializing

Check if the keys in the identity store can be accessed when the identity store is
being created.
parent 5bb1b65a
...@@ -7,7 +7,6 @@ import org.jivesoftware.util.JiveGlobals; ...@@ -7,7 +7,6 @@ import org.jivesoftware.util.JiveGlobals;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import javax.net.ssl.KeyManager;
import javax.net.ssl.KeyManagerFactory; import javax.net.ssl.KeyManagerFactory;
import java.io.IOException; import java.io.IOException;
import java.security.*; import java.security.*;
...@@ -40,26 +39,21 @@ public class IdentityStore extends CertificateStore ...@@ -40,26 +39,21 @@ public class IdentityStore extends CertificateStore
{ {
private static final Logger Log = LoggerFactory.getLogger( IdentityStore.class ); private static final Logger Log = LoggerFactory.getLogger( IdentityStore.class );
// protected final KeyManagerFactory keyFactory;
public IdentityStore( CertificateStoreConfiguration configuration, boolean createIfAbsent ) throws CertificateStoreConfigException public IdentityStore( CertificateStoreConfiguration configuration, boolean createIfAbsent ) throws CertificateStoreConfigException
{ {
super( configuration, createIfAbsent ); super( configuration, createIfAbsent );
// try
// {
// keyFactory = KeyManagerFactory.getInstance( KeyManagerFactory.getDefaultAlgorithm() );
// keyFactory.init( store, configuration.getPassword() );
// }
// catch ( UnrecoverableKeyException | NoSuchAlgorithmException | KeyStoreException ex )
// {
// throw new CertificateStoreConfigException( "Unable to load store of type '" + configuration.getType() + "' from location '" + configuration.getFile() + "'", ex );
// }
}
// public KeyManager[] getKeyManagers() try
// { {
// return keyFactory.getKeyManagers(); final KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance( KeyManagerFactory.getDefaultAlgorithm() );
// } keyManagerFactory.init( this.getStore(), configuration.getPassword() );
}
catch ( NoSuchAlgorithmException | UnrecoverableKeyException | KeyStoreException ex )
{
throw new CertificateStoreConfigException( "Unable to initialize identity store (a common cause: the password for a key is different from the password of the entire store).", ex );
}
}
/** /**
* Creates a Certificate Signing Request based on the private key and certificate identified by the provided alias. * Creates a Certificate Signing Request based on the private key and certificate identified by the provided alias.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment