Class ASN1TaggedObject

    • Constructor Detail

      • ASN1TaggedObject

        public ASN1TaggedObject​(boolean explicit,
                                int tagNo,
                                ASN1Encodable obj)
        Create a tagged object with the style given by the value of explicit.

        If the object implements ASN1Choice the tag style will always be changed to explicit in accordance with the ASN.1 encoding rules.

        Parameters:
        explicit - true if the object is explicitly tagged.
        tagNo - the tag number for this object.
        obj - the tagged object.
    • Method Detail

      • getInstance

        public static ASN1TaggedObject getInstance​(java.lang.Object obj)
      • getTagNo

        public int getTagNo()
        Return the tag number associated with this object.
        Specified by:
        getTagNo in interface ASN1TaggedObjectParser
        Returns:
        the tag number.
      • isExplicit

        public boolean isExplicit()
        return whether or not the object may be explicitly tagged.

        Note: if the object has been read from an input stream, the only time you can be sure if isExplicit is returning the true state of affairs is if it returns false. An implicitly tagged object may appear to be explicitly tagged, so you need to understand the context under which the reading was done as well, see getObject below.

      • getObject

        public ASN1Primitive getObject()
        Return whatever was following the tag.

        Note: tagged objects are generally context dependent if you're trying to extract a tagged object you should be going via the appropriate getInstance method.

      • getObjectParser

        public ASN1Encodable getObjectParser​(int tag,
                                             boolean isExplicit)
                                      throws java.io.IOException
        Return the object held in this tagged object as a parser assuming it has the type of the passed in tag. If the object doesn't have a parser associated with it, the base object is returned.
        Specified by:
        getObjectParser in interface ASN1TaggedObjectParser
        Parameters:
        tag - the primitive tag value for the object tagged originally.
        isExplicit - true if the tagging was done explicitly.
        Returns:
        a parser for the tagged object.
        Throws:
        java.io.IOException - if a parser cannot be constructed.
      • toString

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