Package org.apache.kerby.asn1.type
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 -
Method Summary
Modifier and TypeMethodDescriptionvoiddecode(byte[] content) Decode the content bytes into this type.voiddecode(ByteBuffer content) Decode the content bytes into this type.byte[]encode()Encode the type, by recursively.voidencode(ByteBuffer buffer) Encode the type, by recursively, using the provided buffer.intGet length of encoding bytes by just calculating without real encoding.booleanisBER()Tells if it's is BERbooleanisCER()Tells if it's is CERbooleanTells if it's definitive length or not.booleanisDER()Tells if it's is DERbooleanTells if it's is IMPLICIT or not.booleanTells if it is PRIMITIVE or not.tag()voidtaggedDecode(byte[] content, TaggingOption taggingOption) Decode the content bytes into this type as it's tagged with the provided tagging option.voidtaggedDecode(ByteBuffer content, TaggingOption taggingOption) Decode the content bytes into this type as it's tagged with the provided tagging option.voidtaggedEncode(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.voiduseBER()Set encoding type as BER.voiduseCER()Set encoding type as CER.voiduseDefinitiveLength(boolean isDefinitiveLength) Use definitive length or not.voiduseDER()Set encoding type as DER.voiduseImplicit(boolean isImplicit) Use implicit or not.voidusePrimitive(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
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
Encode the type, by recursively.- Returns:
- encoded bytes
- Throws:
IOException
-
encode
Encode the type, by recursively, using the provided buffer.- Parameters:
buffer- The byte buffer- Throws:
IOException
-
decode
Decode the content bytes into this type.- Parameters:
content- The content bytes- Throws:
IOException- e
-
decode
Decode the content bytes into this type.- Parameters:
content- The content bytes- Throws:
IOException- e
-
taggedEncode
Tag and encode this type using the provided tagging option.- Parameters:
taggingOption- The tagging option- Returns:
- encoded bytes
- Throws:
IOException
-
taggedEncode
Tag and encode this type using the provided tagging option.- Parameters:
buffer- The byte buffertaggingOption- The tagging option- Throws:
IOException
-
taggedDecode
Decode the content bytes into this type as it's tagged with the provided tagging option. SeeTaggingOption- Parameters:
content- The content bytestaggingOption- The tagging option- Throws:
IOException- e
-
taggedDecode
Decode the content bytes into this type as it's tagged with the provided tagging option. SeeTaggingOption- Parameters:
content- The content bytestaggingOption- The tagging option- Throws:
IOException- e
-