org.n52.security.common.crypto
Class DefaultKeyPair

java.lang.Object
  extended by org.n52.security.common.crypto.DefaultKeyPair
All Implemented Interfaces:
java.io.Serializable, KeyPair

public class DefaultKeyPair
extends java.lang.Object
implements KeyPair, java.io.Serializable

Class DefaultKeyPair is a bean (vo) style implementation of a KeyPair and can be used by different KeyPairProviders.

Version:
$Revision: $
Author:
Marko Reiprecht Created on 18.07.2008
See Also:
Serialized Form

Constructor Summary
DefaultKeyPair()
           
 
Method Summary
 java.lang.String getAlias()
          Method gets the alias for the keypair.
 java.security.cert.Certificate getCertificate()
          Method gets the certificate if one exists.
 java.security.cert.Certificate[] getCertificateChain()
          Method gets the CertificateChain.
 java.security.Key getPrivateKey()
          Method gets the privateKey.
 java.security.PublicKey getPublicKey()
          Method gets the publicKey.
 boolean isCertificateChainSet()
          Returns if the pair bean contains a certificate chain.
 boolean isCertificateSet()
          Returns if the pair bean contains a certificate.
 boolean isPrivateKeySet()
          Returns if the pair bean contains a private key.
 boolean isPublicKeySet()
          Returns if the pair bean contains a public key.
 void setAlias(java.lang.String alias)
          Method sets the alias.
 void setCertificate(java.security.cert.Certificate certificate)
          Method sets the certificate.
 void setCertificateChain(java.security.cert.Certificate[] certificateChain)
          Method sets the certificateChain.
 void setPrivateKey(java.security.Key privateKey)
          Method sets the key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultKeyPair

public DefaultKeyPair()
Method Detail

getAlias

public java.lang.String getAlias()
Description copied from interface: KeyPair
Method gets the alias for the keypair. Can be the empty string if unused.

Specified by:
getAlias in interface KeyPair
Returns:
String.
See Also:
KeyPair.getAlias()

setAlias

public void setAlias(java.lang.String alias)
Method sets the alias.

Parameters:
alias - the alias.

getCertificate

public java.security.cert.Certificate getCertificate()
Description copied from interface: KeyPair
Method gets the certificate if one exists.

Specified by:
getCertificate in interface KeyPair
Returns:
X509Certificate or null.
See Also:
KeyPair.getCertificate()

setCertificate

public void setCertificate(java.security.cert.Certificate certificate)
Method sets the certificate.

Parameters:
certificate - the certificate.

getCertificateChain

public java.security.cert.Certificate[] getCertificateChain()
Description copied from interface: KeyPair
Method gets the CertificateChain.

Specified by:
getCertificateChain in interface KeyPair
Returns:
Certificate[].
See Also:
KeyPair.getCertificateChain()

setCertificateChain

public void setCertificateChain(java.security.cert.Certificate[] certificateChain)
Method sets the certificateChain.

Parameters:
certificateChain - the certificateChain.

getPrivateKey

public java.security.Key getPrivateKey()
Description copied from interface: KeyPair
Method gets the privateKey. This can be a PrivateKey or a javax.crypto.SecretKey

Specified by:
getPrivateKey in interface KeyPair
Returns:
Key.
See Also:
KeyPair.getPrivateKey()

setPrivateKey

public void setPrivateKey(java.security.Key privateKey)
Method sets the key.

Parameters:
privateKey - the key.

getPublicKey

public java.security.PublicKey getPublicKey()
Description copied from interface: KeyPair
Method gets the publicKey.

if a X509Certificate exists than this method shall return getCertificate().getPublicKey();

Specified by:
getPublicKey in interface KeyPair
Returns:
PublicKey.
See Also:
KeyPair.getPublicKey()

isCertificateChainSet

public boolean isCertificateChainSet()
Description copied from interface: KeyPair
Returns if the pair bean contains a certificate chain.

Specified by:
isCertificateChainSet in interface KeyPair
Returns:
boolean.
See Also:
KeyPair.isCertificateChainSet()

isCertificateSet

public boolean isCertificateSet()
Description copied from interface: KeyPair
Returns if the pair bean contains a certificate.

Specified by:
isCertificateSet in interface KeyPair
Returns:
boolean.
See Also:
KeyPair.isCertificateSet()

isPrivateKeySet

public boolean isPrivateKeySet()
Description copied from interface: KeyPair
Returns if the pair bean contains a private key.

Specified by:
isPrivateKeySet in interface KeyPair
Returns:
boolean.
See Also:
KeyPair.isPrivateKeySet()

isPublicKeySet

public boolean isPublicKeySet()
Description copied from interface: KeyPair
Returns if the pair bean contains a public key.

Specified by:
isPublicKeySet in interface KeyPair
Returns:
boolean.
See Also:
KeyPair.isPublicKeySet()


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