# KeySpec

public interface **KeySpec**

|---|---|---|
| Known Indirect Subclasses [DESKeySpec](https://developers.google.com/j2objc/javadoc/jre/reference/javax/crypto/spec/DESKeySpec.html), [DESedeKeySpec](https://developers.google.com/j2objc/javadoc/jre/reference/javax/crypto/spec/DESedeKeySpec.html), [DHPrivateKeySpec](https://developers.google.com/j2objc/javadoc/jre/reference/javax/crypto/spec/DHPrivateKeySpec.html), [DHPublicKeySpec](https://developers.google.com/j2objc/javadoc/jre/reference/javax/crypto/spec/DHPublicKeySpec.html), [DSAPrivateKeySpec](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/spec/DSAPrivateKeySpec.html), [DSAPublicKeySpec](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/spec/DSAPublicKeySpec.html), [ECPrivateKeySpec](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/spec/ECPrivateKeySpec.html), [ECPublicKeySpec](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/spec/ECPublicKeySpec.html), [EncodedKeySpec](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/spec/EncodedKeySpec.html), [PBEKeySpec](https://developers.google.com/j2objc/javadoc/jre/reference/javax/crypto/spec/PBEKeySpec.html), [PKCS8EncodedKeySpec](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/spec/PKCS8EncodedKeySpec.html), [RSAMultiPrimePrivateCrtKeySpec](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/spec/RSAMultiPrimePrivateCrtKeySpec.html), [RSAPrivateCrtKeySpec](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/spec/RSAPrivateCrtKeySpec.html), [RSAPrivateKeySpec](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/spec/RSAPrivateKeySpec.html), [RSAPublicKeySpec](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/spec/RSAPublicKeySpec.html), [SecretKeySpec](https://developers.google.com/j2objc/javadoc/jre/reference/javax/crypto/spec/SecretKeySpec.html), [X509EncodedKeySpec](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/spec/X509EncodedKeySpec.html) |---|---| | [DESKeySpec](https://developers.google.com/j2objc/javadoc/jre/reference/javax/crypto/spec/DESKeySpec.html) | This class specifies a DES key. | | [DESedeKeySpec](https://developers.google.com/j2objc/javadoc/jre/reference/javax/crypto/spec/DESedeKeySpec.html) | This class specifies a DES-EDE ("triple-DES") key. | | [DHPrivateKeySpec](https://developers.google.com/j2objc/javadoc/jre/reference/javax/crypto/spec/DHPrivateKeySpec.html) | This class specifies a Diffie-Hellman private key with its associated parameters. | | [DHPublicKeySpec](https://developers.google.com/j2objc/javadoc/jre/reference/javax/crypto/spec/DHPublicKeySpec.html) | This class specifies a Diffie-Hellman public key with its associated parameters. | | [DSAPrivateKeySpec](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/spec/DSAPrivateKeySpec.html) | This class specifies a DSA private key with its associated parameters. | | [DSAPublicKeySpec](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/spec/DSAPublicKeySpec.html) | This class specifies a DSA public key with its associated parameters. | | [ECPrivateKeySpec](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/spec/ECPrivateKeySpec.html) | This immutable class specifies an elliptic curve private key with its associated parameters. | | [ECPublicKeySpec](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/spec/ECPublicKeySpec.html) | This immutable class specifies an elliptic curve public key with its associated parameters. | | [EncodedKeySpec](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/spec/EncodedKeySpec.html) | This class represents a public or private key in encoded format. | | [PBEKeySpec](https://developers.google.com/j2objc/javadoc/jre/reference/javax/crypto/spec/PBEKeySpec.html) | A user-chosen password that can be used with password-based encryption (*PBE*). | | [PKCS8EncodedKeySpec](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/spec/PKCS8EncodedKeySpec.html) | This class represents the ASN.1 encoding of a private key, encoded according to the ASN.1 type `PrivateKeyInfo`. | | [RSAMultiPrimePrivateCrtKeySpec](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/spec/RSAMultiPrimePrivateCrtKeySpec.html) | This class specifies an RSA multi-prime private key, as defined in the PKCS#1 v2.1, using the Chinese Remainder Theorem (CRT) information values for efficiency. | | [RSAPrivateCrtKeySpec](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/spec/RSAPrivateCrtKeySpec.html) | This class specifies an RSA private key, as defined in the PKCS#1 standard, using the Chinese Remainder Theorem (CRT) information values for efficiency. | | [RSAPrivateKeySpec](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/spec/RSAPrivateKeySpec.html) | This class specifies an RSA private key. | | [RSAPublicKeySpec](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/spec/RSAPublicKeySpec.html) | This class specifies an RSA public 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. | | [X509EncodedKeySpec](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/spec/X509EncodedKeySpec.html) | This class represents the ASN.1 encoding of a public key, encoded according to the ASN.1 type `SubjectPublicKeyInfo`. | |||

A (transparent) specification of the key material
that constitutes a cryptographic key.

If the key is stored on a hardware device, its
specification may contain information that helps identify the key on the
device.

A key may be specified in an algorithm-specific way, or in an
algorithm-independent encoding format (such as ASN.1).
For example, a DSA private key may be specified by its components
`x`, `p`, `q`, and `g`
(see `https://developers.google.com/j2objc/javadoc/jre/reference/java/security/spec/DSAPrivateKeySpec.html`), or it may be
specified using its DER encoding
(see `https://developers.google.com/j2objc/javadoc/jre/reference/java/security/spec/PKCS8EncodedKeySpec.html`).

This interface contains no methods or constants. Its only purpose
is to group (and provide type safety for) all key specifications.
All key specifications must implement this interface.

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/security/Key.html`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/security/KeyFactory.html`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/security/spec/EncodedKeySpec.html`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/security/spec/X509EncodedKeySpec.html`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/security/spec/PKCS8EncodedKeySpec.html`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/security/spec/DSAPrivateKeySpec.html`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/security/spec/DSAPublicKeySpec.html`