Class ObjectIdentifier

  • All Implemented Interfaces:
    TreeNode

    public class ObjectIdentifier
    extends PrimitiveTLV
    Class to implement TLV encoded Object Identifier according to ASN.1
    Author:
    Andreas Schwier (info@cardcontact.de)
    • Constructor Detail

      • ObjectIdentifier

        public ObjectIdentifier​(int[] oid)
        Create object identifier
        Parameters:
        oid - Integer array with identifier
      • ObjectIdentifier

        public ObjectIdentifier​(byte[] value)
        Create object identifier from binary presentation
        Parameters:
        pb - Buffer with binary presentation
      • ObjectIdentifier

        public ObjectIdentifier​(java.lang.String oid)
        Create object identifier from string
        Parameters:
        oid - Dottet or blank separated object identifier
      • ObjectIdentifier

        public ObjectIdentifier​(int[] baseoid,
                                int[] extoid)
        Create object identifier from base and extension
        Parameters:
        baseoid - Base object identifier
        extoid - Extension added to base object identifier
      • ObjectIdentifier

        public ObjectIdentifier​(TLV tlv)
                         throws TLVEncodingException
        Copy constructor to convert PrimitiveTLV to typed object Make sure, that the parent is updated with the new reference
        Parameters:
        tlv - the PrimitiveTLV object
        Throws:
        TLVEncodingException
    • Method Detail

      • fromIntArray

        protected void fromIntArray​(int[] oid)
        Helper to create value field from array of object identifier elements
        Parameters:
        oid - Array containing object identifier elements
      • fromString

        protected void fromString​(java.lang.String oid)
        Helper to create byte array from string
        Parameters:
        oid -
      • getObjectIdentifier

        public int[] getObjectIdentifier()
        Return object identifier
        Returns:
        Object identifier as int[]
      • convertBytesToOID

        public static int[] convertBytesToOID​(byte[] value)
        Helper to convert binary data into list of object identifier components
        Parameters:
        value - Binary data
        Returns:
        Array of object identifiers
      • getObjectIdentifierAsString

        public static java.lang.String getObjectIdentifierAsString​(int[] oid)
        Convert list of object identifier into dotted string format
        Parameters:
        oid - Array of object identifier
        Returns:
        String in dotted format
      • dump

        public java.lang.String dump​(int indent)
        Convert object identifier to ASN.1 string syntax
        Overrides:
        dump in class PrimitiveTLV
        Parameters:
        indent - Left indentation
        Returns:
        String containing the ASN.1 representation
      • toString

        public java.lang.String toString()
        Return object identifier as ASN.1 string
        Overrides:
        toString in class PrimitiveTLV
        Returns:
        String in ASN.1 notation