Class OBJECT_IDENTIFIER

  • All Implemented Interfaces:
    ASN1Value

    public class OBJECT_IDENTIFIER
    extends java.lang.Object
    implements ASN1Value
    • Constructor Detail

      • OBJECT_IDENTIFIER

        public OBJECT_IDENTIFIER​(long[] numbers)
        Creates an OBJECT_IDENTIFIER from an array of longs, which constitute the numbers that make up the OBJECT IDENTIFIER.
        Parameters:
        numbers - Numbers.
      • OBJECT_IDENTIFIER

        public OBJECT_IDENTIFIER​(java.lang.String dottedOID)
                          throws java.lang.NumberFormatException
        Creates an OBJECT_IDENTIFIER from a String version. The proper format for the OID string is dotted numbers, for example: "3.2.456.53.23.64". Because the toString() method here provides a different format, we also allow that format, for example: "{3 2 456 53 23 64}".
        Parameters:
        dottedOID - OID string.
        Throws:
        java.lang.NumberFormatException - If the given string cannot be parsed into an OID.
    • Method Detail

      • getTag

        public Tag getTag()
        Description copied from interface: ASN1Value
        Returns the base tag for this type, not counting any tags that may be imposed on it by its context.
        Specified by:
        getTag in interface ASN1Value
        Returns:
        Base tag.
      • getNumbers

        public long[] getNumbers()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • subBranch

        public OBJECT_IDENTIFIER subBranch​(long num)
        Creates a new OBJECT_IDENTIFIER that is a sub-branch of this one. For example, if OBJECT_IDENTIFIER oid has the value { 1 3 5 6 }, then calling oid.subBranch(4) would return a new OBJECT_IDENTIFIER with the value { 1 3 5 6 4 }.
        Parameters:
        num - Number.
        Returns:
        New sub-branch.
      • subBranch

        public OBJECT_IDENTIFIER subBranch​(long[] newNums)
        Creates a new OBJECT_IDENTIFIER that is a sub-branch of this one. For example, if OBJECT_IDENTIFIER oid has the value { 1 3 5 6 }, then calling oid.subBranch(new long[]{ 4, 3}) would return a new OBJECT_IDENTIFIER with the value { 1 3 5 6 4 3}.
        Parameters:
        newNums - New numbers.
        Returns:
        New sub-branch.
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • toDottedString

        public java.lang.String toDottedString()
      • encode

        public void encode​(java.io.OutputStream ostream)
                    throws java.io.IOException
        Description copied from interface: ASN1Value
        Write this value's DER encoding to an output stream using its own base tag.
        Specified by:
        encode in interface ASN1Value
        Parameters:
        ostream - Output stream.
        Throws:
        java.io.IOException - If an error occurred.
      • encode

        public void encode​(Tag implicitTag,
                           java.io.OutputStream ostream)
                    throws java.io.IOException
        Description copied from interface: ASN1Value
        Write this value's DER encoding to an output stream using an implicit tag.
        Specified by:
        encode in interface ASN1Value
        Parameters:
        implicitTag - Implicit tag.
        ostream - Output stream.
        Throws:
        java.io.IOException - If an error occurred.