Error Handling and Exceptions
The JCA/JCE framework includes a number of specialized exception classes:
java.security | |
---|---|
DigestException | Thrown if an error occurs during the final computation of the digest. Generally this indicates that the output buffer is of insufficient size. |
InvalidAlgorithmParameter Exception |
Thrown by classes that use AlgorithmParameters or AlgorithmParameterSpec instances where the supplied instance is not compatible with the algorithm or the supplied parameter was null and the algorithm requires a non-null parameter. |
InvalidKeyException | Thrown by the various classes that use Key objects, such as Signature, Mac, and Cipher when the provided Key is not compatible with the given instance. |
InvalidParameterException | Only used in the deprecated interfaces in the Signature class and the deprecated class Signer. |
KeyStoreException | Thrown by the KeyStore class when the object has not been initialized properly. |
NoSuchAlgorithmException | Thrown by the getInstance() methods when the requested algorithm is not available. |
NoSuchProviderException | Thrown by the getInstance() methods when the requested provider is not available. |
SignatureException | Thrown by the Signature class during signature generation or validation if the object has not been initialized correctly or an error occurs in the underlying ciphers. |
javax.crypto |
|
---|---|
BadPaddingException | Thrown by the Cipher class (or classes which use a Cipher class to process data) if this cipher is in decryption mode, (un)padding has been requested, and the deciphered data is not bounded by the appropriate padding bytes. |
IllegalBlockSizeException | Thrown by the Cipher class (or classes which use a Cipher class to process data) if this cipher is a block cipher, no padding has been requested (only in encryption mode), and the total input length of the data processed by this cipher is not a multiple of block size |
NoSuchPaddingException | Thrown by the Cipher class by the getInstance() method when a transformation is requested that contains a padding scheme that is not available. |
ShortBufferException | Thrown by the Cipher class when an output buffer is supplied that is too small to hold the result. |