Package 

Class Asn1Node


  • 
    public final class Asn1Node
    
                        

    This represents a primitive or constructed data defined by ASN.1. A constructed node can have child nodes. A non-constructed node can have a value. This class is read-only. To build a node, you can use the newBuilder method to get a Builder instance. This class is not thread-safe.

    • Method Detail

      • newBuilder

         static Asn1Node.Builder newBuilder(int tag)

        Creates a new ASN.1 data node builder with the given tag. The tag is an encoded tag includingthe tag class, tag number, and constructed mask.

      • hasChild

         boolean hasChild(int tag, Array<int> tags)

        Tests if a node has a child.

        Parameters:
        tag - The tag of an immediate child.
        tags - The tags of lineal descendant.
      • getChild

         Asn1Node getChild(int tag, Array<int> tags)

        Gets the first child node having the given {@code tag} and {@code tags}.

        Parameters:
        tag - The tag of an immediate child.
        tags - The tags of lineal descendant.
      • getChildren

         List<Asn1Node> getChildren()

        Gets all child nodes of this node. If it's a constructed node having encoded data, it'schildren will be decoded here.

      • asBits

         int asBits()

        Gets the data as an integer for BIT STRING. DER actually stores the bits in a reversed order.The returned integer here has the order fixed (first bit is at the lowest position). Thismethod currently only support at most 32 bits which fit in an integer.

      • writeToBytes

         void writeToBytes(Array<byte> dest, int offset)

        Writes the DER encoded bytes of this node into a byte array. The number of written bytes is getEncodedLength.

      • toBytes

         Array<byte> toBytes()

        Writes the DER encoded bytes of this node into a new byte array.

      • toHex

         String toHex()

        Gets a hex string representing the DER encoded bytes of this node.