Package java.security
Class KeyPair
java.lang.Object
java.security.KeyPair
- All Implemented Interfaces:
Serializable
public final class KeyPair extends Object implements Serializable
KeyPair is 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
Modifier and Type Method Description PrivateKeygetPrivate()Returns the private key.PublicKeygetPublic()Returns the public key.
-
Constructor Details
-
KeyPair
Constructs a new instance ofKeyPairwith a public key and the corresponding private key.- Parameters:
publicKey- the public key.privateKey- the private key.
-
-
Method Details
-
getPrivate
Returns the private key.- Returns:
- the private key.
-
getPublic
Returns the public key.- Returns:
- the public key.
-