# Class Asn1Writer

java.lang.Object
org.apache.tomcat.util.buf.Asn1Writer

public class Asn1Writer extends Object
Utility class for writing ASN.1 DER-encoded data structures.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static byte[]`
  `writeInteger(int value)`
  Writes an ASN.1 INTEGER value.
  `static byte[]`
  `writeOctetString(byte[] data)`
  Writes an ASN.1 OCTET STRING value.
  `static byte[]`
  `writeSequence(byte[]... components)`
  Writes an ASN.1 SEQUENCE containing the given components.
  `static byte[]`
  `writeTag(byte tagId, byte[] data)`
  Writes an ASN.1 tag with the given data.

  ### Methods inherited from class Object

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

- ## Method Details

  - ### writeSequence

    public static byte[] writeSequence(byte[]... components)
    Writes an ASN.1 SEQUENCE containing the given components.
    Parameters:
      `components` - the component byte arrays to include in the sequence
    Returns:
      the DER-encoded SEQUENCE bytes

  - ### writeInteger

    public static byte[] writeInteger(int value)
    Writes an ASN.1 INTEGER value.
    Parameters:
      `value` - the integer value to encode
    Returns:
      the DER-encoded INTEGER bytes

  - ### writeOctetString

    public static byte[] writeOctetString(byte[] data)
    Writes an ASN.1 OCTET STRING value.
    Parameters:
      `data` - the octet string bytes to encode
    Returns:
      the DER-encoded OCTET STRING bytes

  - ### writeTag

    public static byte[] writeTag(byte tagId, byte[] data)
    Writes an ASN.1 tag with the given data.
    Parameters:
      `tagId` - the ASN.1 tag identifier byte
      `data` - the data bytes to encode
    Returns:
      the DER-encoded tag and data bytes