org.n52.security.common.crypto
Class KeystoreKeyPairProvider

java.lang.Object
  extended by org.n52.security.common.crypto.KeystoreKeyPairProvider
All Implemented Interfaces:
KeyPairProvider

public class KeystoreKeyPairProvider
extends java.lang.Object
implements KeyPairProvider

Class KeystoreKeyPairProvider implements a KeyPairProvider working on a java keystore.

Version:
$Revision: $
Author:
Marko Reiprecht Created on 18.07.2008

Constructor Summary
KeystoreKeyPairProvider(java.security.KeyStore keyStore)
          Constructor creates a new instance from a pre loaded keystore.
KeystoreKeyPairProvider(java.lang.String keyStoreType, java.io.InputStream instream, char[] password)
          Constructor creates a new instance from a inputstream.
 
Method Summary
 java.security.KeyStore getKeyStore()
          Method gets the keyStore.
 KeyPair resolveByAlias(java.lang.String alias, char[] password)
          Method resolves a keypair by an alias.
 KeyPair resolveByCertificate(java.security.cert.Certificate cert, char[] password)
          Method resolves a key pair by a given certificate.
 KeyPair resolveBySerialIssuer(java.lang.String issuerDN, java.math.BigInteger serial, char[] password)
          Method resolves a key pair by a SerialIssuer, this is required to resolve certificates and it's private keys by the id of the certificate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KeystoreKeyPairProvider

public KeystoreKeyPairProvider(java.security.KeyStore keyStore)
Constructor creates a new instance from a pre loaded keystore.

Parameters:
keyStore - the keyStore.

KeystoreKeyPairProvider

public KeystoreKeyPairProvider(java.lang.String keyStoreType,
                               java.io.InputStream instream,
                               char[] password)
Constructor creates a new instance from a inputstream.

Parameters:
keyStoreType - the keyStoreType.
instream - the instream.
password - the password.
Method Detail

getKeyStore

public java.security.KeyStore getKeyStore()
Method gets the keyStore.

Returns:
KeyStore.

resolveByAlias

public KeyPair resolveByAlias(java.lang.String alias,
                              char[] password)
                       throws KeyPairResolvingException
Description copied from interface: KeyPairProvider
Method resolves a keypair by an alias. The provider tries to resolve the private key and its public key or certificate. Only if none of the elements can be resolved an exception is thrown.

Specified by:
resolveByAlias in interface KeyPairProvider
Parameters:
alias - the alias.
password - a password for the private key, can be null.
Returns:
KeyPair.
Throws:
KeyPairResolvingException - if keypair can't be resolved.
See Also:
KeyPairProvider.resolveByAlias(String, char[])

resolveBySerialIssuer

public KeyPair resolveBySerialIssuer(java.lang.String issuerDN,
                                     java.math.BigInteger serial,
                                     char[] password)
                              throws KeyPairResolvingException
Description copied from interface: KeyPairProvider
Method resolves a key pair by a SerialIssuer, this is required to resolve certificates and it's private keys by the id of the certificate. Only if none of the elements can be resolved an exception is thrown.

Specified by:
resolveBySerialIssuer in interface KeyPairProvider
Parameters:
issuerDN - the issuerDN.
serial - the serial.
password - a password for the private key, can be null.
Returns:
KeyPair.
Throws:
KeyPairResolvingException - if error occurs.
See Also:
KeyPairProvider.resolveBySerialIssuer(String, BigInteger, char[])

resolveByCertificate

public KeyPair resolveByCertificate(java.security.cert.Certificate cert,
                                    char[] password)
                             throws KeyPairResolvingException
Description copied from interface: KeyPairProvider
Method resolves a key pair by a given certificate. Only if none of the elements can be resolved an exception is thrown.

Specified by:
resolveByCertificate in interface KeyPairProvider
Parameters:
cert - the cert.
password - a password for the private key, can be null.
Returns:
KeyPair.
Throws:
KeyPairResolvingException - if error occurs.
See Also:
KeyPairProvider.resolveByCertificate(Certificate, char[])


Copyright © 2004-2009 52north.org. All Rights Reserved.