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

org.bouncycastle.asn1

## Class ASN1Util

- java.lang.Object
- - org.bouncycastle.asn1.ASN1Util

-     public abstract class ASN1Util
      extends java.lang.Object

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ASN1Util()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static ASN1Primitive` | `getBaseUniversal(ASN1TaggedObject taggedObject, int tagClass, int tagNo, boolean declaredExplicit, int baseTagNo)`
    `static ASN1Primitive` | `getContextBaseUniversal(ASN1TaggedObject taggedObject, int tagNo, boolean declaredExplicit, int baseTagNo)`
    `static ASN1Object` | `getExplicitBaseObject(ASN1TaggedObject taggedObject, int tagClass)`
    `static ASN1Object` | `getExplicitBaseObject(ASN1TaggedObject taggedObject, int tagClass, int tagNo)`
    `static ASN1TaggedObject` | `getExplicitBaseTagged(ASN1TaggedObject taggedObject, int tagClass)`
    `static ASN1TaggedObject` | `getExplicitBaseTagged(ASN1TaggedObject taggedObject, int tagClass, int tagNo)`
    `static ASN1Object` | `getExplicitContextBaseObject(ASN1TaggedObject taggedObject)`
    `static ASN1Object` | `getExplicitContextBaseObject(ASN1TaggedObject taggedObject, int tagNo)`
    `static ASN1TaggedObject` | `getExplicitContextBaseTagged(ASN1TaggedObject taggedObject)`
    `static ASN1TaggedObject` | `getExplicitContextBaseTagged(ASN1TaggedObject taggedObject, int tagNo)`
    `static ASN1TaggedObject` | `getImplicitBaseTagged(ASN1TaggedObject taggedObject, int tagClass, int tagNo, int baseTagClass, int baseTagNo)`
    `static ASN1TaggedObject` | `getImplicitContextBaseTagged(ASN1TaggedObject taggedObject, int tagNo, int baseTagClass, int baseTagNo)`
    `static java.lang.Object` | `getInstanceChoiceBaseObject(ASN1TaggedObject taggedObject, boolean declaredExplicit, java.lang.String choiceName)`
    `static java.lang.String` | `getTagClassText(ASN1TaggedObject taggedObject)`
    `static java.lang.String` | `getTagClassText(ASN1TaggedObjectParser taggedObjectParser)`
    `static java.lang.String` | `getTagClassText(int tagClass)`
    `static java.lang.Object` | `getTaggedChoiceBaseObject(ASN1TaggedObject taggedObject, boolean declaredExplicit, java.lang.String choiceName)`
    `static java.lang.String` | `getTagText(ASN1TaggedObject taggedObject)`
    `static java.lang.String` | `getTagText(ASN1TaggedObjectParser taggedObjectParser)`
    `static java.lang.String` | `getTagText(int tagClass, int tagNo)`
    `static ASN1Encodable` | `parseBaseUniversal(ASN1TaggedObjectParser taggedObjectParser, int tagClass, int tagNo, boolean declaredExplicit, int baseTagNo)`
    `static ASN1Encodable` | `parseContextBaseUniversal(ASN1TaggedObjectParser taggedObjectParser, int tagNo, boolean declaredExplicit, int baseTagNo)`
    `static ASN1Encodable` | `parseExplicitBaseObject(ASN1TaggedObjectParser taggedObjectParser, int tagClass, int tagNo)`
    `static ASN1TaggedObjectParser` | `parseExplicitBaseTagged(ASN1TaggedObjectParser taggedObjectParser, int tagClass)`
    `static ASN1TaggedObjectParser` | `parseExplicitBaseTagged(ASN1TaggedObjectParser taggedObjectParser, int tagClass, int tagNo)`
    `static ASN1Encodable` | `parseExplicitContextBaseObject(ASN1TaggedObjectParser taggedObjectParser, int tagNo)`
    `static ASN1TaggedObjectParser` | `parseExplicitContextBaseTagged(ASN1TaggedObjectParser taggedObjectParser)`
    `static ASN1TaggedObjectParser` | `parseExplicitContextBaseTagged(ASN1TaggedObjectParser taggedObjectParser, int tagNo)`
    `static ASN1TaggedObjectParser` | `parseImplicitBaseTagged(ASN1TaggedObjectParser taggedObjectParser, int tagClass, int tagNo, int baseTagClass, int baseTagNo)`
    `static ASN1TaggedObjectParser` | `parseImplicitContextBaseTagged(ASN1TaggedObjectParser taggedObjectParser, int tagNo, int baseTagClass, int baseTagNo)`
    `static ASN1Primitive` | `tryGetBaseUniversal(ASN1TaggedObject taggedObject, int tagClass, int tagNo, boolean declaredExplicit, int baseTagNo)`
    `static ASN1Primitive` | `tryGetContextBaseUniversal(ASN1TaggedObject taggedObject, int tagNo, boolean declaredExplicit, int baseTagNo)`
    `static ASN1Object` | `tryGetExplicitBaseObject(ASN1TaggedObject taggedObject, int tagClass)`
    `static ASN1Object` | `tryGetExplicitBaseObject(ASN1TaggedObject taggedObject, int tagClass, int tagNo)`
    `static ASN1TaggedObject` | `tryGetExplicitBaseTagged(ASN1TaggedObject taggedObject, int tagClass)`
    `static ASN1TaggedObject` | `tryGetExplicitBaseTagged(ASN1TaggedObject taggedObject, int tagClass, int tagNo)`
    `static ASN1Object` | `tryGetExplicitContextBaseObject(ASN1TaggedObject taggedObject)`
    `static ASN1Object` | `tryGetExplicitContextBaseObject(ASN1TaggedObject taggedObject, int tagNo)`
    `static ASN1TaggedObject` | `tryGetExplicitContextBaseTagged(ASN1TaggedObject taggedObject)`
    `static ASN1TaggedObject` | `tryGetExplicitContextBaseTagged(ASN1TaggedObject taggedObject, int tagNo)`
    `static ASN1TaggedObject` | `tryGetImplicitBaseTagged(ASN1TaggedObject taggedObject, int tagClass, int tagNo, int baseTagClass, int baseTagNo)`
    `static ASN1TaggedObject` | `tryGetImplicitContextBaseTagged(ASN1TaggedObject taggedObject, int tagNo, int baseTagClass, int baseTagNo)`
    `static ASN1Encodable` | `tryParseBaseUniversal(ASN1TaggedObjectParser taggedObjectParser, int tagClass, int tagNo, boolean declaredExplicit, int baseTagNo)`
    `static ASN1Encodable` | `tryParseContextBaseUniversal(ASN1TaggedObjectParser taggedObjectParser, int tagNo, boolean declaredExplicit, int baseTagNo)`
    `static ASN1Encodable` | `tryParseExplicitBaseObject(ASN1TaggedObjectParser taggedObjectParser, int tagClass, int tagNo)`
    `static ASN1TaggedObjectParser` | `tryParseExplicitBaseTagged(ASN1TaggedObjectParser taggedObjectParser, int tagClass)`
    `static ASN1TaggedObjectParser` | `tryParseExplicitBaseTagged(ASN1TaggedObjectParser taggedObjectParser, int tagClass, int tagNo)`
    `static ASN1Encodable` | `tryParseExplicitContextBaseObject(ASN1TaggedObjectParser taggedObjectParser, int tagNo)`
    `static ASN1TaggedObjectParser` | `tryParseExplicitContextBaseTagged(ASN1TaggedObjectParser taggedObjectParser)`
    `static ASN1TaggedObjectParser` | `tryParseExplicitContextBaseTagged(ASN1TaggedObjectParser taggedObjectParser, int tagNo)`
    `static ASN1TaggedObjectParser` | `tryParseImplicitBaseTagged(ASN1TaggedObjectParser taggedObjectParser, int tagClass, int tagNo, int baseTagClass, int baseTagNo)`
    `static ASN1TaggedObjectParser` | `tryParseImplicitContextBaseTagged(ASN1TaggedObjectParser taggedObjectParser, int tagNo, int baseTagClass, int baseTagNo)`

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

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

- - ### Constructor Detail

    - #### ASN1Util

          public ASN1Util()

  - ### Method Detail

    - #### getInstanceChoiceBaseObject

          public static java.lang.Object getInstanceChoiceBaseObject(ASN1TaggedObject taggedObject,
                                                                     boolean declaredExplicit,
                                                                     java.lang.String choiceName)

    - #### getTaggedChoiceBaseObject

          public static java.lang.Object getTaggedChoiceBaseObject(ASN1TaggedObject taggedObject,
                                                                   boolean declaredExplicit,
                                                                   java.lang.String choiceName)

    - #### getTagClassText

          public static java.lang.String getTagClassText(ASN1TaggedObject taggedObject)

    - #### getTagClassText

          public static java.lang.String getTagClassText(ASN1TaggedObjectParser taggedObjectParser)

    - #### getTagClassText

          public static java.lang.String getTagClassText(int tagClass)

    - #### getTagText

          public static java.lang.String getTagText(ASN1TaggedObject taggedObject)

    - #### getTagText

          public static java.lang.String getTagText(ASN1TaggedObjectParser taggedObjectParser)

    - #### getTagText

          public static java.lang.String getTagText(int tagClass,
                                                    int tagNo)

    - #### getExplicitBaseObject

          public static ASN1Object getExplicitBaseObject(ASN1TaggedObject taggedObject,
                                                         int tagClass)

    - #### getExplicitBaseObject

          public static ASN1Object getExplicitBaseObject(ASN1TaggedObject taggedObject,
                                                         int tagClass,
                                                         int tagNo)

    - #### getExplicitContextBaseObject

          public static ASN1Object getExplicitContextBaseObject(ASN1TaggedObject taggedObject)

    - #### getExplicitContextBaseObject

          public static ASN1Object getExplicitContextBaseObject(ASN1TaggedObject taggedObject,
                                                                int tagNo)

    - #### tryGetExplicitBaseObject

          public static ASN1Object tryGetExplicitBaseObject(ASN1TaggedObject taggedObject,
                                                            int tagClass)

    - #### tryGetExplicitBaseObject

          public static ASN1Object tryGetExplicitBaseObject(ASN1TaggedObject taggedObject,
                                                            int tagClass,
                                                            int tagNo)

    - #### tryGetExplicitContextBaseObject

          public static ASN1Object tryGetExplicitContextBaseObject(ASN1TaggedObject taggedObject)

    - #### tryGetExplicitContextBaseObject

          public static ASN1Object tryGetExplicitContextBaseObject(ASN1TaggedObject taggedObject,
                                                                   int tagNo)

    - #### getExplicitBaseTagged

          public static ASN1TaggedObject getExplicitBaseTagged(ASN1TaggedObject taggedObject,
                                                               int tagClass)

    - #### getExplicitBaseTagged

          public static ASN1TaggedObject getExplicitBaseTagged(ASN1TaggedObject taggedObject,
                                                               int tagClass,
                                                               int tagNo)

    - #### getExplicitContextBaseTagged

          public static ASN1TaggedObject getExplicitContextBaseTagged(ASN1TaggedObject taggedObject)

    - #### getExplicitContextBaseTagged

          public static ASN1TaggedObject getExplicitContextBaseTagged(ASN1TaggedObject taggedObject,
                                                                      int tagNo)

    - #### tryGetExplicitBaseTagged

          public static ASN1TaggedObject tryGetExplicitBaseTagged(ASN1TaggedObject taggedObject,
                                                                  int tagClass)

    - #### tryGetExplicitBaseTagged

          public static ASN1TaggedObject tryGetExplicitBaseTagged(ASN1TaggedObject taggedObject,
                                                                  int tagClass,
                                                                  int tagNo)

    - #### tryGetExplicitContextBaseTagged

          public static ASN1TaggedObject tryGetExplicitContextBaseTagged(ASN1TaggedObject taggedObject)

    - #### tryGetExplicitContextBaseTagged

          public static ASN1TaggedObject tryGetExplicitContextBaseTagged(ASN1TaggedObject taggedObject,
                                                                         int tagNo)

    - #### getImplicitBaseTagged

          public static ASN1TaggedObject getImplicitBaseTagged(ASN1TaggedObject taggedObject,
                                                               int tagClass,
                                                               int tagNo,
                                                               int baseTagClass,
                                                               int baseTagNo)

    - #### getImplicitContextBaseTagged

          public static ASN1TaggedObject getImplicitContextBaseTagged(ASN1TaggedObject taggedObject,
                                                                      int tagNo,
                                                                      int baseTagClass,
                                                                      int baseTagNo)

    - #### tryGetImplicitBaseTagged

          public static ASN1TaggedObject tryGetImplicitBaseTagged(ASN1TaggedObject taggedObject,
                                                                  int tagClass,
                                                                  int tagNo,
                                                                  int baseTagClass,
                                                                  int baseTagNo)

    - #### tryGetImplicitContextBaseTagged

          public static ASN1TaggedObject tryGetImplicitContextBaseTagged(ASN1TaggedObject taggedObject,
                                                                         int tagNo,
                                                                         int baseTagClass,
                                                                         int baseTagNo)

    - #### getBaseUniversal

          public static ASN1Primitive getBaseUniversal(ASN1TaggedObject taggedObject,
                                                       int tagClass,
                                                       int tagNo,
                                                       boolean declaredExplicit,
                                                       int baseTagNo)

    - #### getContextBaseUniversal

          public static ASN1Primitive getContextBaseUniversal(ASN1TaggedObject taggedObject,
                                                              int tagNo,
                                                              boolean declaredExplicit,
                                                              int baseTagNo)

    - #### tryGetBaseUniversal

          public static ASN1Primitive tryGetBaseUniversal(ASN1TaggedObject taggedObject,
                                                          int tagClass,
                                                          int tagNo,
                                                          boolean declaredExplicit,
                                                          int baseTagNo)

    - #### tryGetContextBaseUniversal

          public static ASN1Primitive tryGetContextBaseUniversal(ASN1TaggedObject taggedObject,
                                                                 int tagNo,
                                                                 boolean declaredExplicit,
                                                                 int baseTagNo)

    - #### parseExplicitBaseTagged

          public static ASN1TaggedObjectParser parseExplicitBaseTagged(ASN1TaggedObjectParser taggedObjectParser,
                                                                       int tagClass)
                                                                throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### parseExplicitBaseTagged

          public static ASN1TaggedObjectParser parseExplicitBaseTagged(ASN1TaggedObjectParser taggedObjectParser,
                                                                       int tagClass,
                                                                       int tagNo)
                                                                throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### parseExplicitContextBaseTagged

          public static ASN1TaggedObjectParser parseExplicitContextBaseTagged(ASN1TaggedObjectParser taggedObjectParser)
                                                                       throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### parseExplicitContextBaseTagged

          public static ASN1TaggedObjectParser parseExplicitContextBaseTagged(ASN1TaggedObjectParser taggedObjectParser,
                                                                              int tagNo)
                                                                       throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### tryParseExplicitBaseTagged

          public static ASN1TaggedObjectParser tryParseExplicitBaseTagged(ASN1TaggedObjectParser taggedObjectParser,
                                                                          int tagClass)
                                                                   throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### tryParseExplicitBaseTagged

          public static ASN1TaggedObjectParser tryParseExplicitBaseTagged(ASN1TaggedObjectParser taggedObjectParser,
                                                                          int tagClass,
                                                                          int tagNo)
                                                                   throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### tryParseExplicitContextBaseTagged

          public static ASN1TaggedObjectParser tryParseExplicitContextBaseTagged(ASN1TaggedObjectParser taggedObjectParser)
                                                                          throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### tryParseExplicitContextBaseTagged

          public static ASN1TaggedObjectParser tryParseExplicitContextBaseTagged(ASN1TaggedObjectParser taggedObjectParser,
                                                                                 int tagNo)
                                                                          throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### parseImplicitBaseTagged

          public static ASN1TaggedObjectParser parseImplicitBaseTagged(ASN1TaggedObjectParser taggedObjectParser,
                                                                       int tagClass,
                                                                       int tagNo,
                                                                       int baseTagClass,
                                                                       int baseTagNo)
                                                                throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### parseImplicitContextBaseTagged

          public static ASN1TaggedObjectParser parseImplicitContextBaseTagged(ASN1TaggedObjectParser taggedObjectParser,
                                                                              int tagNo,
                                                                              int baseTagClass,
                                                                              int baseTagNo)
                                                                       throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### tryParseImplicitBaseTagged

          public static ASN1TaggedObjectParser tryParseImplicitBaseTagged(ASN1TaggedObjectParser taggedObjectParser,
                                                                          int tagClass,
                                                                          int tagNo,
                                                                          int baseTagClass,
                                                                          int baseTagNo)
                                                                   throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### tryParseImplicitContextBaseTagged

          public static ASN1TaggedObjectParser tryParseImplicitContextBaseTagged(ASN1TaggedObjectParser taggedObjectParser,
                                                                                 int tagNo,
                                                                                 int baseTagClass,
                                                                                 int baseTagNo)
                                                                          throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### parseBaseUniversal

          public static ASN1Encodable parseBaseUniversal(ASN1TaggedObjectParser taggedObjectParser,
                                                         int tagClass,
                                                         int tagNo,
                                                         boolean declaredExplicit,
                                                         int baseTagNo)
                                                  throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### parseContextBaseUniversal

          public static ASN1Encodable parseContextBaseUniversal(ASN1TaggedObjectParser taggedObjectParser,
                                                                int tagNo,
                                                                boolean declaredExplicit,
                                                                int baseTagNo)
                                                         throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### tryParseBaseUniversal

          public static ASN1Encodable tryParseBaseUniversal(ASN1TaggedObjectParser taggedObjectParser,
                                                            int tagClass,
                                                            int tagNo,
                                                            boolean declaredExplicit,
                                                            int baseTagNo)
                                                     throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### tryParseContextBaseUniversal

          public static ASN1Encodable tryParseContextBaseUniversal(ASN1TaggedObjectParser taggedObjectParser,
                                                                   int tagNo,
                                                                   boolean declaredExplicit,
                                                                   int baseTagNo)
                                                            throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### parseExplicitBaseObject

          public static ASN1Encodable parseExplicitBaseObject(ASN1TaggedObjectParser taggedObjectParser,
                                                              int tagClass,
                                                              int tagNo)
                                                       throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### parseExplicitContextBaseObject

          public static ASN1Encodable parseExplicitContextBaseObject(ASN1TaggedObjectParser taggedObjectParser,
                                                                     int tagNo)
                                                              throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### tryParseExplicitBaseObject

          public static ASN1Encodable tryParseExplicitBaseObject(ASN1TaggedObjectParser taggedObjectParser,
                                                                 int tagClass,
                                                                 int tagNo)
                                                          throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### tryParseExplicitContextBaseObject

          public static ASN1Encodable tryParseExplicitContextBaseObject(ASN1TaggedObjectParser taggedObjectParser,
                                                                        int tagNo)
                                                                 throws java.io.IOException

      Throws:
        `java.io.IOException`