# Destroyable

public interface **Destroyable**

|---|---|---|
| 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), [KeyStore.PasswordProtection](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/KeyStore.PasswordProtection.html), [PBEKey](https://developers.google.com/j2objc/javadoc/jre/reference/javax/crypto/interfaces/PBEKey.html), [PrivateKey](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/PrivateKey.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), [SecretKey](https://developers.google.com/j2objc/javadoc/jre/reference/javax/crypto/SecretKey.html), [SecretKeySpec](https://developers.google.com/j2objc/javadoc/jre/reference/javax/crypto/spec/SecretKeySpec.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. | | [KeyStore.PasswordProtection](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/KeyStore.PasswordProtection.html) | A password-based implementation of `ProtectionParameter`. | | [PBEKey](https://developers.google.com/j2objc/javadoc/jre/reference/javax/crypto/interfaces/PBEKey.html) | The interface to a PBE key. | | [PrivateKey](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/PrivateKey.html) | A 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. | | [SecretKey](https://developers.google.com/j2objc/javadoc/jre/reference/javax/crypto/SecretKey.html) | A secret (symmetric) key. | | [SecretKeySpec](https://developers.google.com/j2objc/javadoc/jre/reference/javax/crypto/spec/SecretKeySpec.html) | This class specifies a secret key in a provider-independent fashion. | |||

Objects such as credentials may optionally implement this interface
to provide the capability to destroy its contents.

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/javax/security/auth/Subject.html`

### Public Method Summary

|---|---|
| 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. |

## Public Methods

#### public void
**destroy**
()

Destroy this `Object`.

Sensitive information associated with this `Object`
is destroyed or cleared. Subsequent calls to certain methods
on this `Object` will result in an
`IllegalStateException` being thrown.


The default implementation throws `DestroyFailedException`.


Android note: Up to and including API 25 this method did not have a
default implementation. Implementations of this interface must provide
a concrete implementation of this method in order to work on older
versions of Android.

##### Throws

| [DestroyFailedException](https://developers.google.com/j2objc/javadoc/jre/reference/javax/security/auth/DestroyFailedException.html) | if the destroy operation fails. <br /> |
| [SecurityException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/SecurityException.html) | if the caller does not have permission to destroy this `Object`. |
|---|---|

#### public boolean
**isDestroyed**
()

Determine if this `Object` has been destroyed.


The default implementation returns false.


Android note: Up to and including API 25 this method did not have a
default implementation. Implementations of this interface must provide
a concrete implementation of this method in order to work on older
versions of Android.

##### Returns

- true if this `Object` has been destroyed, false otherwise.