IBM WebSphere Application ServerTM
Release 7

com.ibm.websphere.crypto
Class KeyPair

java.lang.Object
  extended by com.ibm.websphere.crypto.KeyPair
All Implemented Interfaces:
java.io.Serializable

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

This class holds a PrivateKey and PublicKey pair. The PublicKey needs to be wrapped by an X509Certificate for verification.

Since:
WAS 6.1
Version:
1.0
See Also:
Serialized Form

Constructor Summary
KeyPair(java.security.cert.Certificate[] certChain, java.security.Key privateKey)
           This constructor accepts a certificate chain and a private key.
KeyPair(java.security.Key publicKey, java.security.Key privateKey)
           This constructor accepts a public and private key pair.
 
Method Summary
 java.security.cert.Certificate getCertificate()
           This method is used to retrieve the first certificate in the certChain.
 java.security.cert.Certificate[] getCertificateChain()
           This method is used to retrieve the certChain.
 java.security.Key getPrivateKey()
           This method is used to retrieve the PrivateKey.
 java.security.Key getPublicKey()
           This method is used to retrieve the publicKey.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KeyPair

public KeyPair(java.security.cert.Certificate[] certChain,
               java.security.Key privateKey)

This constructor accepts a certificate chain and a private key. The public key is contained within the certificate. When using this contructor to create a KeyPair, the certificate and private key can be stored in any KeyStore type as a single alias.

Parameters:
java.security.cert.Certificate[] - certChain
java.security.Key - privateKey

KeyPair

public KeyPair(java.security.Key publicKey,
               java.security.Key privateKey)

This constructor accepts a public and private key pair. There are some situations where having a certificate associated with the public key is not possible. When creating a key pair this way, the public and private keys will be stored in a KeyStore as "secret" keys using alias + "_public" and alias + "_private" as the alias in the keystore. Because they are stored this way, the KeyStore type must allow the storage of SecretKeys such as JCEKS. Make sure the configuration of the KeySet is associated with a JCEKS (or keystore of similiar function) or an error will occur.

Parameters:
java.security.Key - publicKey
java.security.Key - privateKey
Method Detail

getCertificateChain

public java.security.cert.Certificate[] getCertificateChain()

This method is used to retrieve the certChain.

Returns:
java.security.cert.Certificate[]

getCertificate

public java.security.cert.Certificate getCertificate()

This method is used to retrieve the first certificate in the certChain. This certicate contains the PublicKey that goes with the PrivateKey.

Returns:
java.security.cert.Certificate

getPrivateKey

public java.security.Key getPrivateKey()

This method is used to retrieve the PrivateKey.

Returns:
java.security.Key

getPublicKey

public java.security.Key getPublicKey()

This method is used to retrieve the publicKey. If this method is not null while the getCerticateChain method returns null, then this key pair was created without a certificate.

Returns:
java.security.Key

IBM WebSphere Application ServerTM
Release 7