DEREncodingException (Bouncy Castle Library 1.85 API Specification)
Date: 2026-07-12

org.bouncycastle.asn1

## Class DEREncodingException

- java.lang.Object
- - java.lang.Throwable
  - - java.lang.Exception
    - - java.lang.RuntimeException
      - - java.lang.IllegalStateException
        - - org.bouncycastle.asn1.DEREncodingException

- All Implemented Interfaces:
    java.io.Serializable

      public class DEREncodingException
      extends java.lang.IllegalStateException

  Exception thrown when an ASN.1 primitive cannot be serialized as DER - typically because its in-memory contents do not satisfy the DER restrictions of X.690 (e.g. a UTCTime / GeneralizedTime parsed leniently from the wire that is then asked to round-trip through a `DEROutputStream`).
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DEREncodingException(java.lang.String message)` Base constructor.
    `DEREncodingException(java.lang.String message, java.lang.Throwable cause)` Constructor when this exception is due to another one.

  - ### Method Summary

    - ### Methods inherited from class java.lang.Throwable

      `addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### DEREncodingException

          public DEREncodingException(java.lang.String message)

      Base constructor.
      Parameters:
        `message` - a message concerning the exception.

    - #### DEREncodingException

          public DEREncodingException(java.lang.String message,
                                      java.lang.Throwable cause)

      Constructor when this exception is due to another one.
      Parameters:
        `message` - a message concerning the exception.
        `cause` - the exception that caused this exception to be thrown.