Provides the classes and interfaces for cryptographic operations. The cryptographic operations defined in this package include encryption, key generation and key agreement, and Message Authentication Code (MAC) generation.
Support for encryption includes symmetric, asymmetric, block, and stream ciphers. This package also supports secure streams and sealed objects.
Many of the classes provided in this package are provider-based. The class itself defines a programming interface to which applications may write. The implementations themselves may then be written by independent third-party vendors and plugged in seamlessly as needed. Therefore application developers may take advantage of any number of provider-based implementations without having to add or rewrite code.
Related DocumentationFor further documentation, please see:
Interface Summary Interface Description SecretKeyA secret (symmetric) key.
Class Summary Class Description CipherThis class provides the functionality of a cryptographic cipher for encryption and decryption. CipherInputStreamA CipherInputStream is composed of an InputStream and a Cipher so that read() methods return data that are read in from the underlying InputStream but have been additionally processed by the Cipher. CipherOutputStreamA CipherOutputStream is composed of an OutputStream and a Cipher so that write() methods first process the data before writing them out to the underlying OutputStream. CipherSpiThis class defines the Service Provider Interface (SPI) for the
EncryptedPrivateKeyInfoThis class implements the
EncryptedPrivateKeyInfotype as defined in PKCS #8.
ExemptionMechanismThis class provides the functionality of an exemption mechanism, examples of which are key recovery, key weakening, and key escrow. ExemptionMechanismSpiThis class defines the Service Provider Interface (SPI) for the
KeyAgreementThis class provides the functionality of a key agreement (or key exchange) protocol. KeyAgreementSpiThis class defines the Service Provider Interface (SPI) for the
KeyGeneratorThis class provides the functionality of a secret (symmetric) key generator. KeyGeneratorSpiThis class defines the Service Provider Interface (SPI) for the
MacThis class provides the functionality of a "Message Authentication Code" (MAC) algorithm. MacSpiThis class defines the Service Provider Interface (SPI) for the
NullCipherThe NullCipher class is a class that provides an "identity cipher" -- one that does not transform the plain text. SealedObjectThis class enables a programmer to create an object and protect its confidentiality with a cryptographic algorithm. SecretKeyFactoryThis class represents a factory for secret keys. SecretKeyFactorySpiThis class defines the Service Provider Interface (SPI) for the
Exception Summary Exception Description AEADBadTagExceptionThis exception is thrown when a
Cipheroperating in an AEAD mode (such as GCM/CCM) is unable to verify the supplied authentication tag.
BadPaddingExceptionThis exception is thrown when a particular padding mechanism is expected for the input data but the data is not padded properly. ExemptionMechanismExceptionThis is the generic ExemptionMechanism exception. IllegalBlockSizeExceptionThis exception is thrown when the length of data provided to a block cipher is incorrect, i.e., does not match the block size of the cipher. NoSuchPaddingExceptionThis exception is thrown when a particular padding mechanism is requested but is not available in the environment. ShortBufferExceptionThis exception is thrown when an output buffer provided by the user is too short to hold the operation result.