org.bouncycastle.asn1 (Bouncy Castle Library 1.85 API Specification)
Date: 2026-07-12

# Package org.bouncycastle.asn1

A library for parsing and writing ASN.1 objects.

See: Description

- Interface Summary
  Interface | Description
  --- | ---
  ASN1BitStringParser | A basic parser for a BIT STRING object
  ASN1Choice | Marker interface for CHOICE objects - if you implement this in a role your own object any attempt to tag the object implicitly will convert the tag to an explicit one as the encoding rules require.
  ASN1Encodable | Basic interface to produce serialisers for ASN.1 encodings.
  ASN1Encoding | Supported encoding formats.
  ASN1ExternalParser | Parser DER EXTERNAL tagged objects.
  ASN1OctetStringParser | A basic parser for an OCTET STRING object
  ASN1SequenceParser | A basic parser for a SEQUENCE object
  ASN1SetParser | A basic parser for a SET object
  ASN1String | General interface implemented by ASN.1 STRING objects for extracting the content String.
  ASN1TaggedObjectParser | Interface for the parsing of a generic tagged ASN.1 object.
  BERTags |
  InMemoryRepresentable | Interface implemented by objects that can be converted from streaming to in-memory objects.

- Class Summary
  Class | Description
  --- | ---
  ASN1Absent | An ASN1 class that encodes to nothing, used in the OER library to deal with the Optional type.
  ASN1BitString | Base class for BIT STRING objects
  ASN1BMPString | ASN.1 BMPString object encodes BMP (Basic Multilingual Plane) subset (aka UCS-2) of UNICODE (ISO 10646) characters in codepoints 0 to 65535.
  ASN1Boolean | Public facade of ASN.1 Boolean data.
  ASN1EncodableVector | Mutable class for building ASN.1 constructed objects such as SETs or SEQUENCEs.
  ASN1Enumerated | Class representing the ASN.1 ENUMERATED type.
  ASN1External | Class representing the DER-type External
  ASN1GeneralizedTime | Base class representing the ASN.1 GeneralizedTime type.
  ASN1GeneralString | ASN.1 GENERAL-STRING data type.
  ASN1Generator | Basic class for streaming generators.
  ASN1GraphicString |
  ASN1IA5String | ASN.1 IA5String object - this is a ISO 646 (ASCII) string encoding code points 0 to 127.
  ASN1InputStream | A general purpose ASN.1 decoder - note: this class differs from the others in that it returns null after it has read the last object in the stream.
  ASN1Integer | Class representing the ASN.1 INTEGER type.
  ASN1Null | A NULL object - use DERNull.INSTANCE for populating structures.
  ASN1NumericString | NumericString object - this is an ascii string of characters {0,1,2,3,4,5,6,7,8,9, }.
  ASN1Object | Base class for defining an ASN.1 object.
  ASN1ObjectDescriptor |
  ASN1ObjectIdentifier | Class representing the ASN.1 OBJECT IDENTIFIER type.
  ASN1OctetString | Abstract base for the ASN.1 OCTET STRING data type This supports BER, and DER forms of the data.
  ASN1OutputStream | Stream that produces output based on the default encoding for the passed in objects.
  ASN1Primitive | Base class for ASN.1 primitive objects.
  ASN1PrintableString | ASN.1 PrintableString object.
  ASN1RelativeOID |
  ASN1Sequence | ASN.1 `SEQUENCE` and `SEQUENCE OF` constructs.
  ASN1Set | ASN.1 `SET` and `SET OF` constructs.
  ASN1StreamParser | A parser for ASN.1 streams which also returns, where possible, parsers for the objects it encounters.
  ASN1T61String | ASN.1 T61String (also the teletex string), try not to use this if you don't need to.
  ASN1TaggedObject | ASN.1 TaggedObject - in ASN.1 notation this is any object preceded by a [n] where n is some number - these are assumed to follow the construction rules (as with sequences).
  ASN1TimeFormatTest | White-box tests for `ASN1TimeFormat`, the strict structural validator for UTCTime / GeneralizedTime content.
  ASN1UniversalString | ASN.1 UniversalString object - encodes UNICODE (ISO 10646) characters using 32-bit format.
  ASN1UTCTime | - * UTC time object.
  ASN1UTF8String |
  ASN1Util |
  ASN1VideotexString |
  ASN1VisibleString | ASN.1 VisibleString object encoding ISO 646 (ASCII) character code points 32 to 126.
  BERBitString |
  BERBitStringParser | A parser for indefinite-length BIT STRINGs.
  BERGenerator | Base class for generators for indefinite-length structures.
  BEROctetString | ASN.1 OctetStrings, with indefinite length rules, and constructed form support.
  BEROctetStringGenerator | A generator for indefinite-length OCTET STRINGs
  BEROctetStringParser | A parser for indefinite-length OCTET STRINGs.
  BERSequence | Indefinite length SEQUENCE of objects.
  BERSequenceGenerator | A stream generator for DER SEQUENCEs
  BERSequenceParser | Parser for indefinite-length SEQUENCEs.
  BERSet | Indefinite length `SET` and `SET OF` constructs.
  BERSetParser | Parser for indefinite-length SETs.
  BERTaggedObject | BER TaggedObject - in ASN.1 notation this is any object preceded by a [n] where n is some number - these are assumed to follow the construction rules (as with sequences).
  DERBitString | A BIT STRING with DER encoding - the first byte contains the count of padding bits included in the byte array's last byte.
  DERBMPString | DER BMPString object encodes BMP (Basic Multilingual Plane) subset (aka UCS-2) of UNICODE (ISO 10646) characters in codepoints 0 to 65535.
  DERExternal | Class representing the DER-type External
  DERExternalParser | Parser DER EXTERNAL tagged objects.
  DERGeneralizedTime | DER Generalized time object.
  DERGeneralString | ASN.1 GENERAL-STRING data type.
  DERGenerator | Basic class for streaming DER encoding generators.
  DERGraphicString |
  DERIA5String | DER IA5String object - this is a ISO 646 (ASCII) string encoding code points 0 to 127.
  DERNull | An ASN.1 DER NULL object.
  DERNumericString | DER NumericString object - this is an ascii string of characters {0,1,2,3,4,5,6,7,8,9, }.
  DEROctetString | Carrier class for a DER encoding OCTET STRING
  DEROctetStringParser | Parser for DER encoded OCTET STRINGS
  DERPrintableString | DER PrintableString object.
  DERSequence | Definite length SEQUENCE, encoding tells explicit number of bytes that the content of this sequence occupies.
  DERSequenceGenerator | A stream generator for DER SEQUENCEs
  DERSet | A DER encoded SET object For X.690 syntax rules, see `ASN1Set`.
  DERT61String | DER T61String (also the teletex string), try not to use this if you don't need to.
  DERTaggedObject | DER TaggedObject - in ASN.1 notation this is any object preceded by a [n] where n is some number - these are assumed to follow the construction rules (as with sequences).
  DERUniversalString | DER UniversalString object - encodes UNICODE (ISO 10646) characters using 32-bit format.
  DERUTCTime | DER UTC time object.
  DERUTF8String | DER UTF8String object.
  DERVideotexString |
  DERVisibleString | DER VisibleString object encoding ISO 646 (ASCII) character code points 32 to 126.
  DLBitString | A Definite length BIT STRING
  DLBitStringParser | Parser for a DL encoded BIT STRING.
  DLExternal | Class representing the Definite-Length-type External
  DLGenerator | Base class for stream generators for definite-length structures.
  DLOctetStringGenerator | A stream generator for definite-length (primitive) OCTET STRINGs.
  DLSequence | The DLSequence encodes a SEQUENCE using definite length form.
  DLSequenceGenerator | A stream generator for definite-length SEQUENCEs.
  DLSequenceParser | Parser class for DL SEQUENCEs.
  DLSet | The DLSet encodes ASN.1 SET value without element ordering, and always using definite length form.
  DLSetParser | Parser class for DL SETs.
  DLTaggedObject | Definite Length TaggedObject - in ASN.1 notation this is any object preceded by a [n] where n is some number - these are assumed to follow the construction rules (as with sequences).
  LocaleUtil | ASN.1 uses an EN locale for its internal formatting.
  OIDTokenizer | Deprecated Will be removed

- Exception Summary
  Exception | Description
  --- | ---
  ASN1Exception | Exception thrown in cases of corrupted or unexpected data in a stream.
  ASN1ParsingException | Exception thrown when correctly encoded, but unexpected data is found in a stream while building an object.
  DEREncodingException | 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`).

## Package org.bouncycastle.asn1 Description

A library for parsing and writing ASN.1 objects. Support is provided for DER and BER encoding.