Please note that the contents of this offline web site may be out of date. To access the most recent documentation visit the online version .
Note that links that point to online resources are green in color and will open in a new window.
We would love it if you could give us feedback about this material by filling this form (You have to be online to fill it)
Android APIs
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)

Added in 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 ()

Added in API level 1

Returns the private key.

Returns
  • the private key.

public PublicKey getPublic ()

Added in API level 1

Returns the public key.

Returns
  • the public key.