Class ProviderFailureException

All Implemented Interfaces:
Serializable

public class ProviderFailureException extends RuntimeException
Exception signaling a failure in the underlying cryptographic provider during algorithm initialization or operation.

This runtime exception is used to wrap provider or JCA/JCE errors that occur while creating or initializing cipher contexts (for example, inside AES-GCM or ChaCha20-Poly1305 attach(...) flows). Typical root causes include unavailable transformations, invalid provider state, or rejected parameters that surface as GeneralSecurityException and are rethrown as ProviderFailureException.

Usage and semantics

  • Thrown from context setup or transformation wiring when Cipher.getInstance(...) or init(...) fails in the provider.
  • Represents provider-layer failure, distinct from unsupported role/spec conditions (see UnsupportedRoleException and UnsupportedSpecException).
  • May be translated to IOException at API boundaries that declare I/O only, while preserving the original cause via Throwable.getCause().

Example

try {
    Cipher c = Cipher.getInstance(jceName());   // provider resolution
    initCipher(c, nonce);                       // provider init
    return new Stream(upstream, c, jceName());  // streaming transform
} catch (GeneralSecurityException e) {
    throw new ProviderFailureException(jceName() + " attach/init failed", e);
}
Since:
1.0
See Also:
  • Constructor Details

    • ProviderFailureException

      public ProviderFailureException(String m, Throwable t)
      Creates a new exception wrapping a provider failure.
      Parameters:
      m - human-readable detail message describing the failed provider operation
      t - original cause from the provider layer (usually a GeneralSecurityException)