Package org.apache.kerby.asn1
Class Asn1
java.lang.Object
org.apache.kerby.asn1.Asn1
The shortcut API for ASN1 encoding, decoding and dumping.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Asn1Typedecode(byte[] content) Blindly decode content and return the result ASN1 object.static voidDecode using specified value container.static Asn1Typedecode(ByteBuffer content) See avove.static voiddecode(ByteBuffer content, Asn1Type value) See avove.static voiddecodeAndDump(byte[] content) See above.static voiddecodeAndDump(String hexStr) Decode first, and then dump out the decoded value.static voiddecodeAndDump(ByteBuffer content) See avove.static voidDump out a value.static voidencode(ByteBuffer buffer, Asn1Type value) Encode value into buffer.static byte[]Encode value and return the result.static Asn1ParseResultparse(byte[] content) Parse content and return parse result.static Asn1ParseResultparse(ByteBuffer content) See avove.static voidparseAndDump(byte[] content) See avove.static voidparseAndDump(String hexStr) Parse first, and then dump out the parse result.static voidparseAndDump(ByteBuffer content) See avove.
-
Method Details
-
encode
Encode value into buffer.- Parameters:
buffer-value-- Throws:
IOException
-
encode
Encode value and return the result.- Parameters:
value-- Returns:
- Throws:
IOException
-
decode
Blindly decode content and return the result ASN1 object.- Parameters:
content-- Returns:
- Throws:
IOException
-
decode
See avove.- Throws:
IOException
-
decode
Decode using specified value container. Better to use this when the value type is known prior to the call.- Parameters:
content-value-- Throws:
IOException
-
decode
See avove.- Throws:
IOException
-
parse
Parse content and return parse result. Note this is different from decode, as it doesn't decode into values, only parse result info like offset, header len, body len and etc. are out.- Parameters:
content-- Returns:
- Throws:
IOException
-
parse
See avove.- Throws:
IOException
-
dump
Dump out a value.- Parameters:
value-
-
parseAndDump
Parse first, and then dump out the parse result.- Parameters:
hexStr-- Throws:
IOException
-
parseAndDump
See avove.- Throws:
IOException
-
parseAndDump
See avove.- Throws:
IOException
-
decodeAndDump
Decode first, and then dump out the decoded value.- Parameters:
hexStr-- Throws:
IOException
-
decodeAndDump
See avove.- Throws:
IOException
-
decodeAndDump
See above.- Throws:
IOException
-