APIdia Launch Partner
Top Description
java.security

public sealed Interface BinaryEncodable

permits AsymmetricKey, KeyPair, PKCS8EncodedKeySpec, X509EncodedKeySpec, EncryptedPrivateKeyInfo, X509Certificate, X509CRL, PEM, InternalBinaryEncodable
Known Direct Subinterfaces
java.security.AsymmetricKey
Known Direct Implementers
java.security.KeyPair, java.security.PEM, java.security.cert.X509Certificate, java.security.cert.X509CRL, java.security.spec.PKCS8EncodedKeySpec, java.security.spec.X509EncodedKeySpec, javax.crypto.EncryptedPrivateKeyInfo, sun.security.internal.InternalBinaryEncodable
Annotations
@PreviewFeature
feature:PEM_API
Imports
javax.crypto.EncryptedPrivateKeyInfo, java.security.cert.X509CRL, .X509Certificate, java.security.spec.PKCS8EncodedKeySpec, .X509EncodedKeySpec, jdk.internal.javac.PreviewFeature, sun.security.internal.InternalBinaryEncodable

Preview

Third Preview of PEM Encodings of Cryptographic Objects (JEP 538).

Programs can only use BinaryEncodable when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.

This interface identifies the cryptographic objects that can be converted to and from binary data, and thereby encoded and decoded as PEM text.

The APIs for cryptographic objects such as public keys, private keys, certificates, and certificate revocation lists all provide the means to convert their instances to and from standardized binary representations. Other kinds of cryptographic objects, such as certificate requests, have no corresponding API but can still be expressed as standardized binary representations. The BinaryEncodable interface allows the PEMEncoder and PEMDecoder classes to operate uniformly on binary representations of key or certificate material.

The permitted subtype PEM is notable for supporting the encoding and decoding of PEM text that represents cryptographic objects for which no API exists. In future releases, other permitted subtypes may be added to support the encoding and decoding of such cryptographic objects.

The list of permitted subtypes shown after permits is not exhaustive. This means if application code switches over a BinaryEncodable value, the switch cannot be made exhaustive simply by providing a case label for every permitted subtype shown in the list; there also must be a default or case BinaryEncodable label to handle additional subtypes. This allows the list of permitted subtypes to change over time without causing pre-existing switches to fail because of an unrecognized subtype.

Since
27
See Also
AsymmetricKey, KeyPair, PKCS8EncodedKeySpec, X509EncodedKeySpec, EncryptedPrivateKeyInfo, X509Certificate, X509CRL, PEM