# PrivateKey

public interface **PrivateKey** implements [Key](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/Key.html) [Destroyable](https://developers.google.com/j2objc/javadoc/jre/reference/javax/security/auth/Destroyable.html)

|---|---|---|
| Known Indirect Subclasses [DHPrivateKey](https://developers.google.com/j2objc/javadoc/jre/reference/javax/crypto/interfaces/DHPrivateKey.html), [DSAPrivateKey](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/interfaces/DSAPrivateKey.html), [ECPrivateKey](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/interfaces/ECPrivateKey.html), [RSAMultiPrimePrivateCrtKey](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/interfaces/RSAMultiPrimePrivateCrtKey.html), [RSAPrivateCrtKey](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/interfaces/RSAPrivateCrtKey.html), [RSAPrivateKey](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/interfaces/RSAPrivateKey.html) |---|---| | [DHPrivateKey](https://developers.google.com/j2objc/javadoc/jre/reference/javax/crypto/interfaces/DHPrivateKey.html) | The interface to a Diffie-Hellman private key. | | [DSAPrivateKey](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/interfaces/DSAPrivateKey.html) | The standard interface to a DSA private key. | | [ECPrivateKey](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/interfaces/ECPrivateKey.html) | The interface to an elliptic curve (EC) private key. | | [RSAMultiPrimePrivateCrtKey](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/interfaces/RSAMultiPrimePrivateCrtKey.html) | The interface to an RSA multi-prime private key, as defined in the PKCS#1 v2.1, using the *Chinese Remainder Theorem* (CRT) information values. | | [RSAPrivateCrtKey](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/interfaces/RSAPrivateCrtKey.html) | The interface to an RSA private key, as defined in the PKCS#1 standard, using the *Chinese Remainder Theorem* (CRT) information values. | | [RSAPrivateKey](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/interfaces/RSAPrivateKey.html) | The interface to an RSA private key. | |||

A private key.
The purpose of this interface is to group (and provide type safety
for) all private key interfaces.


Note: The specialized private key interfaces extend this interface.
See, for example, the `DSAPrivateKey` interface in
`https://developers.google.com/j2objc/javadoc/jre/reference/java/security/interfaces/package-summary.html`.


Implementations should override the default `destroy` and
`isDestroyed` methods from the
`https://developers.google.com/j2objc/javadoc/jre/reference/javax/security/auth/Destroyable.html` interface to enable
sensitive key information to be destroyed, cleared, or in the case
where such information is immutable, unreferenced.
Finally, since `PrivateKey` is `Serializable`, implementations
should also override
`https://developers.google.com/j2objc/javadoc/jre/reference/java/io/ObjectOutputStream.html#writeObject(java.lang.Object)`
to prevent keys that have been destroyed from being serialized.

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/security/Key.html`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/security/PublicKey.html`
- `https://developers.google.com/j2objc/javadoc/jre/`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/security/Signature.html#initVerify(java.security.PublicKey)`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/security/interfaces/DSAPrivateKey.html`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/security/interfaces/RSAPrivateKey.html`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/security/interfaces/RSAPrivateCrtKey.html`

### Constant Summary

|---|---|---|
| long | [serialVersionUID](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/PrivateKey.html#serialVersionUID) | The class fingerprint that is set to indicate serialization compatibility with a previous version of the class. |

### Inherited Constant Summary

From interface [java.security.Key](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/Key.html)

|---|---|---|
| long | [serialVersionUID](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/Key.html#serialVersionUID) | The class fingerprint that is set to indicate serialization compatibility with a previous version of the class. |

### Inherited Method Summary

From interface [java.security.Key](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/Key.html)

|---|---|
| abstract [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getAlgorithm](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/Key.html#getAlgorithm())() Returns the standard algorithm name for this key. |
| abstract byte\[\] | [getEncoded](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/Key.html#getEncoded())() Returns the key in its primary encoding format, or null if this key does not support encoding. |
| abstract [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getFormat](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/Key.html#getFormat())() Returns the name of the primary encoding format of this key, or null if this key does not support encoding. |

From interface [javax.security.auth.Destroyable](https://developers.google.com/j2objc/javadoc/jre/reference/javax/security/auth/Destroyable.html)

|---|---|
| void | [destroy](https://developers.google.com/j2objc/javadoc/jre/reference/javax/security/auth/Destroyable.html#destroy())() Destroy this `Object`. |
| boolean | [isDestroyed](https://developers.google.com/j2objc/javadoc/jre/reference/javax/security/auth/Destroyable.html#isDestroyed())() Determine if this `Object` has been destroyed. |

## Constants

#### public static final long
**serialVersionUID**

The class fingerprint that is set to indicate serialization
compatibility with a previous version of the class.
Constant Value: 6034044314589513430