com.ibm.websphere.crypto

Class KeyPair

  1. java.lang.Object
  2. extended bycom.ibm.websphere.crypto.KeyPair
All implemented interfaces:
java.io.Serializable

  1. public class KeyPair
  2. extends java.lang.Object
  3. 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

Constructor and Description
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

Modifier and Type Method and Description
  1. java.security.cert.Certificate
getCertificate()
This method is used to retrieve the first certificate in the certChain.
  1. java.security.cert.Certificate[]
getCertificateChain()
This method is used to retrieve the certChain.
  1. java.security.Key
getPrivateKey()
This method is used to retrieve the PrivateKey.
  1. 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

  1. public KeyPair(java.security.cert.Certificate[] certChain,
  2. 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.


KeyPair

  1. public KeyPair(java.security.Key publicKey,
  2. 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.

Method Detail

getCertificateChain

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

This method is used to retrieve the certChain.

Returns:
java.security.cert.Certificate[]

getCertificate

  1. 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

  1. public java.security.Key getPrivateKey( )

This method is used to retrieve the PrivateKey.

Returns:
java.security.Key

getPublicKey

  1. 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