# Class KeyPair

java.lang.Object
com.codename1.security.KeyPair

public final class KeyPair extends Object

A matched pair of `PublicKey` / `PrivateKey`. Typically produced by

invalid reference

    KeyGenerator#generateRsaKeyPair(int)

.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `KeyPair(PublicKey publicKey, PrivateKey privateKey)`
  Bundles an already-paired public/private key.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `PrivateKey`
  `getPrivateKey()`
  Returns the private part of this pair.
  `PublicKey`
  `getPublicKey()`
  Returns the public part of this pair.

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### KeyPair

    public KeyPair(PublicKey publicKey, PrivateKey privateKey)
    Bundles an already-paired public/private key.

- ## Method Details

  - ### getPublicKey

    public PublicKey getPublicKey()
    Returns the public part of this pair.

  - ### getPrivateKey

    public PrivateKey getPrivateKey()
    Returns the private part of this pair.