Hi
I've been looking into the CBOR encoding more in detail and se that if you use CBORObject.FromJSONString(json) all elements that should be coded as a CBOR dateTime type (tag 0 or 1) will be coded as ordinary strings (plain or UTF-8). The reason is of course that a date in JSON is a string and there is no way for the CBORObject.FromJSONString to know that some of the strings should be coded as a CBOR dateTime type.
private byte[] getCborBytes(String json) {
CBORObject cborObject = CBORObject.FromJSONString(json);
return cborObject.EncodeToBytes();
}
See ehn-dcc-development/hcert-schema#17.
Also check out my tests at: https://github.com/DIGGSweden/hcert-impl/blob/main/src/test/java/se/digg/hcert/eu_hcert/v1/MapperUtilsTest.java
Just want to make sure that we are interoperable ...
Hi
I've been looking into the CBOR encoding more in detail and se that if you use
CBORObject.FromJSONString(json)all elements that should be coded as a CBOR dateTime type (tag 0 or 1) will be coded as ordinary strings (plain or UTF-8). The reason is of course that a date in JSON is a string and there is no way for the CBORObject.FromJSONString to know that some of the strings should be coded as a CBOR dateTime type.See ehn-dcc-development/hcert-schema#17.
Also check out my tests at: https://github.com/DIGGSweden/hcert-impl/blob/main/src/test/java/se/digg/hcert/eu_hcert/v1/MapperUtilsTest.java
Just want to make sure that we are interoperable ...