Package com.tivoli.am.fim.cbor
Class CBORUtility
java.lang.Object
com.tivoli.am.fim.cbor.CBORUtility
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ObjectcanonicalDecode(byte[] cborData) Decode a CBOR byte array according to the CTAP2 canonical CBOR encoding form.static byte[]canonicalEncode(Object toEncode) Encode CBOR data according to the CTAP2 canonical CBOR encoding form.static ObjectDecode a CBOR byte array to a Java primitive.static byte[]Encode the given primitive java Object to a CBOR byte array.
-
Constructor Details
-
CBORUtility
public CBORUtility()
-
-
Method Details
-
canonicalDecode
Decode a CBOR byte array according to the CTAP2 canonical CBOR encoding form. The exact CTAP2 canonical rule set can be found in the FIDO Alliance CTAP2 specification. -
canonicalEncode
Encode CBOR data according to the CTAP2 canonical CBOR encoding form. The exact CTAP2 canonical rule set can be found in the FIDO Alliance CTAP2 specification. -
decode
Decode a CBOR byte array to a Java primitive. Valid primitive types include: String, Integer, Double, Boolean, Array, Map. If the data cannot be decoded or read into the given primitive, then this method will return null.- Parameters:
cborData- CBOR bytes to be decoded.expectedDataType- Data type of resulting decoded CBOR- Returns:
- decode CBOR Object if the encoded data is valid; else null.
-
encode
Encode the given primitive java Object to a CBOR byte array. Valid java primitives include: String, Integer, Double, Boolean, Array, Map. If the given object cannot be serialized and/or CBOR encoded then this method will return null.- Parameters:
toEncode- Object to be CBOR encoded.- Returns:
- A CBOR encoded byte array of the given object if the Object is valid; else null.
-