Class ASN1Type

    • Field Detail

      • id

        public final int id
        Integer representation of primitive identifier.
      • constrId

        public final int constrId
        Integer representation of constructed identifier.
    • Constructor Detail

      • ASN1Type

        public ASN1Type​(int tagNumber)
        Constructs a primitive, universal ASN.1 type.
        Parameters:
        tagNumber - - ASN.1 tag number
        Throws:
        IllegalArgumentException - - if tagNumber is invalid
      • ASN1Type

        public ASN1Type​(int tagClass,
                        int tagNumber)
        Constructs an ASN.1 type.
        Parameters:
        tagClass - - tag class. MUST be CLASS_UNIVERSAL, CLASS_APPLICATION, CLASS_CONTEXTSPECIFIC, CLASS_PRIVATE
        tagNumber - - ASN.1 tag number.
        Throws:
        IllegalArgumentException - - if tagClass or tagNumber is invalid
    • Method Detail

      • encode

        public final byte[] encode​(Object object)
      • checkTag

        public abstract boolean checkTag​(int identifier)
        Tests provided identifier.
        Parameters:
        identifier - identifier to be verified
        Returns:
        true if identifier is associated with this ASN.1 type
      • getDecodedObject

        protected Object getDecodedObject​(BerInputStream in)
                                   throws IOException
        Creates decoded object. Derived classes should override this method to provide creation for a selected class of objects during decoding. The default implementation returns an object created by decoding stream.
        Throws:
        IOException
      • encodeASN

        public abstract void encodeASN​(BerOutputStream out)
        Encodes ASN.1 type.
      • encodeContent

        public abstract void encodeContent​(BerOutputStream out)
      • setEncodingContent

        public abstract void setEncodingContent​(BerOutputStream out)
      • toString

        public String toString()
        Description copied from class: Object
        Returns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object's type and data. The default implementation is equivalent to the following expression:
           getClass().getName() + '@' + Integer.toHexString(hashCode())

        See Writing a useful toString method if you intend implementing your own toString method.

        Overrides:
        toString in class Object
        Returns:
        a printable representation of this object.