Skip to content

Most visited

Recently visited

navigation
Added in API level 1

KeyPair

public final class KeyPair
extends Object implements Serializable

java.lang.Object
   ↳ java.security.KeyPair


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:

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.

Inherited methods

From class java.lang.Object

Public constructors

KeyPair

Added in API level 1
KeyPair (PublicKey publicKey, 
                PrivateKey privateKey)

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

Parameters
publicKey PublicKey: the public key.
privateKey PrivateKey: the private key.

Public methods

getPrivate

Added in API level 1
PrivateKey getPrivate ()

Returns the private key.

Returns
PrivateKey the private key.

getPublic

Added in API level 1
PublicKey getPublic ()

Returns the public key.

Returns
PublicKey the public key.
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.