CBOR tagged data can't be deserialized
Describe the bug
When you have CBOR data that is tagged, deserialization fails with an exception. With tags I'm referring to section 3.4 of the RFC:
https://datatracker.ietf.org/doc/html/rfc8949#section-3.4
In our case for the CovPass / covid vaccination certificate app some countries use tag 0 to annotate strings as being in date/time format.
The other issue is that we can't decode the COSE data format because the array is tagged with 18:
https://cose-wg.github.io/cose-spec/#rfc.appendix.C.2.1
- By default, tags should just be ignored during deserialization.
- We could need an annotation that a certain tag should be used for serialization and optionally also be required during deserialization.
- For more dynamic tagging something like a special
CborTagged(tag, data)object would be nice which allows extracting arbitrary tags (or null) during deserialization and setting arbitrary tags during serialization.
Environment
- Kotlin version: 1.5.10
- Library version: 1.2.1
Does #1614 solve this? It ignores tags by default
Not really. We need to be able to work with the tags, i.e. match them or extract them and set them.
I'll leave this open then
see #2412