Interface Asn1Type

All Known Implementing Classes:
AbstractAsn1Type, Asn1Any, Asn1BitString, Asn1BmpString, Asn1Boolean, Asn1Choice, Asn1Collection, Asn1CollectionOf, Asn1CollectionType, Asn1Constructed, Asn1Encodeable, Asn1Enumerated, Asn1Eoc, Asn1Flags, Asn1GeneralizedTime, Asn1GeneralString, Asn1IA5String, Asn1Integer, Asn1IntegerEnumerated, Asn1Null, Asn1NumericsString, Asn1ObjectIdentifier, Asn1OctetString, Asn1PrintableString, Asn1Sequence, Asn1SequenceOf, Asn1SequenceType, Asn1Set, Asn1SetOf, Asn1SetType, Asn1Simple, Asn1Specific, Asn1String, Asn1T61String, Asn1T61Utf8String, Asn1Tagging, Asn1TaggingCollection, Asn1TaggingSequence, Asn1TaggingSet, Asn1UniversalString, Asn1UtcTime, Asn1Utf8String, Asn1VisibleString

public interface Asn1Type
The ASN1 type interface for all ASN1 types.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static enum 
    Encoding type
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    decode(byte[] content)
    Decode the content bytes into this type.
    void
    decode(ByteBuffer content)
    Decode the content bytes into this type.
    byte[]
    Encode the type, by recursively.
    void
    Encode the type, by recursively, using the provided buffer.
    int
    Get length of encoding bytes by just calculating without real encoding.
    boolean
    Tells if it's is BER
    boolean
    Tells if it's is CER
    boolean
    Tells if it's definitive length or not.
    boolean
    Tells if it's is DER
    boolean
    Tells if it's is IMPLICIT or not.
    boolean
    Tells if it is PRIMITIVE or not.
    tag()
     
    void
    taggedDecode(byte[] content, TaggingOption taggingOption)
    Decode the content bytes into this type as it's tagged with the provided tagging option.
    void
    taggedDecode(ByteBuffer content, TaggingOption taggingOption)
    Decode the content bytes into this type as it's tagged with the provided tagging option.
    void
    taggedEncode(ByteBuffer buffer, TaggingOption taggingOption)
    Tag and encode this type using the provided tagging option.
    byte[]
    taggedEncode(TaggingOption taggingOption)
    Tag and encode this type using the provided tagging option.
    void
    Set encoding type as BER.
    void
    Set encoding type as CER.
    void
    useDefinitiveLength(boolean isDefinitiveLength)
    Use definitive length or not.
    void
    Set encoding type as DER.
    void
    useImplicit(boolean isImplicit)
    Use implicit or not.
    void
    usePrimitive(boolean isPrimitive)
    Use primitive or constructed.
  • Method Details

    • tag

      Tag tag()
      Returns:
      The tag
    • usePrimitive

      void usePrimitive(boolean isPrimitive)
      Use primitive or constructed.
    • isPrimitive

      boolean isPrimitive()
      Tells if it is PRIMITIVE or not.
      Returns:
      true if using PRIMITIVE, false otherwise
    • useDefinitiveLength

      void useDefinitiveLength(boolean isDefinitiveLength)
      Use definitive length or not. Note definitive length only makes sense when it's constructed.
    • isDefinitiveLength

      boolean isDefinitiveLength()
      Tells if it's definitive length or not.
      Returns:
      The boolean value
    • useImplicit

      void useImplicit(boolean isImplicit)
      Use implicit or not.
    • isImplicit

      boolean isImplicit()
      Tells if it's is IMPLICIT or not.
      Returns:
      true if using IMPLICIT, false otherwise
    • useDER

      void useDER()
      Set encoding type as DER.
    • isDER

      boolean isDER()
      Tells if it's is DER
      Returns:
      true if using DER, false otherwise
    • useBER

      void useBER()
      Set encoding type as BER.
    • isBER

      boolean isBER()
      Tells if it's is BER
      Returns:
      true if using BER, false otherwise
    • useCER

      void useCER()
      Set encoding type as CER.
    • isCER

      boolean isCER()
      Tells if it's is CER
      Returns:
      true if using CER, false otherwise
    • encodingLength

      int encodingLength() throws IOException
      Get length of encoding bytes by just calculating without real encoding. Generally it's called to prepare for the encoding buffer.
      Returns:
      length of encoding bytes
      Throws:
      IOException
    • encode

      byte[] encode() throws IOException
      Encode the type, by recursively.
      Returns:
      encoded bytes
      Throws:
      IOException
    • encode

      void encode(ByteBuffer buffer) throws IOException
      Encode the type, by recursively, using the provided buffer.
      Parameters:
      buffer - The byte buffer
      Throws:
      IOException
    • decode

      void decode(byte[] content) throws IOException
      Decode the content bytes into this type.
      Parameters:
      content - The content bytes
      Throws:
      IOException - e
    • decode

      void decode(ByteBuffer content) throws IOException
      Decode the content bytes into this type.
      Parameters:
      content - The content bytes
      Throws:
      IOException - e
    • taggedEncode

      byte[] taggedEncode(TaggingOption taggingOption) throws IOException
      Tag and encode this type using the provided tagging option.
      Parameters:
      taggingOption - The tagging option
      Returns:
      encoded bytes
      Throws:
      IOException
    • taggedEncode

      void taggedEncode(ByteBuffer buffer, TaggingOption taggingOption) throws IOException
      Tag and encode this type using the provided tagging option.
      Parameters:
      buffer - The byte buffer
      taggingOption - The tagging option
      Throws:
      IOException
    • taggedDecode

      void taggedDecode(ByteBuffer content, TaggingOption taggingOption) throws IOException
      Decode the content bytes into this type as it's tagged with the provided tagging option. See TaggingOption
      Parameters:
      content - The content bytes
      taggingOption - The tagging option
      Throws:
      IOException - e
    • taggedDecode

      void taggedDecode(byte[] content, TaggingOption taggingOption) throws IOException
      Decode the content bytes into this type as it's tagged with the provided tagging option. See TaggingOption
      Parameters:
      content - The content bytes
      taggingOption - The tagging option
      Throws:
      IOException - e