java.security

Class KeyPair

public final class KeyPair extends Object implements Serializable

KeyPair serves as a simple container for public and private keys. If properly initialized, this class should be treated like the private key since it contains it and take approriate security measures.
Constructor Summary
KeyPair(PublicKey publicKey, PrivateKey privateKey)
Initializes the KeyPair with a pubilc and private key.
Method Summary
PrivateKeygetPrivate()
Returns the private key stored in the KeyPair
PublicKeygetPublic()
Returns the public key stored in the KeyPair

Constructor Detail

KeyPair

public KeyPair(PublicKey publicKey, PrivateKey privateKey)
Initializes the KeyPair with a pubilc and private key.

Parameters: publicKey Public Key to store privateKey Private Key to store

Method Detail

getPrivate

public PrivateKey getPrivate()
Returns the private key stored in the KeyPair

Returns: The private key

getPublic

public PublicKey getPublic()
Returns the public key stored in the KeyPair

Returns: The public key