public final class

KeyPair

extends Object
implements Serializable
java.lang.Object
   ↳ java.security.KeyPair

Class Overview

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.

Summary

Public Constructors
KeyPair(PublicKey publicKey, PrivateKey privateKey)
Constructs a new instance of KeyPair with a public key and the corresponding private key.
Public Methods
PrivateKey getPrivate()
Returns the private key.
PublicKey getPublic()
Returns the public key.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public KeyPair (PublicKey publicKey, PrivateKey privateKey)

Since: API Level 1

Constructs a new instance of KeyPair with a public key and the corresponding private key.

Parameters
publicKey the public key.
privateKey the private key.

Public Methods

public PrivateKey getPrivate ()

Since: API Level 1

Returns the private key.

Returns
  • the private key.

public PublicKey getPublic ()

Since: API Level 1

Returns the public key.

Returns
  • the public key.