# Class KeyPair

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

public final class KeyPair extends java.lang.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 java.lang.Object

  `clone, equals, finalize, 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.