Package java.security
Class KeyPair
- java.lang.Object
-
- java.security.KeyPair
-
- All Implemented Interfaces:
Serializable
public final class KeyPair extends Object implements Serializable
KeyPairis a container for a public key and a private key. Since the private key can be accessed, instances must be treated like a private key.- See Also:
PrivateKey,PublicKey, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description KeyPair(PublicKey publicKey, PrivateKey privateKey)Constructs a new instance ofKeyPairwith a public key and the corresponding private key.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PrivateKeygetPrivate()Returns the private key.PublicKeygetPublic()Returns the public key.
-
-
-
Constructor Detail
-
KeyPair
public KeyPair(PublicKey publicKey, PrivateKey privateKey)
Constructs a new instance ofKeyPairwith a public key and the corresponding private key.- Parameters:
publicKey- the public key.privateKey- the private key.
-
-
Method Detail
-
getPrivate
public PrivateKey getPrivate()
Returns the private key.- Returns:
- the private key.
-
getPublic
public PublicKey getPublic()
Returns the public key.- Returns:
- the public key.
-
-