-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
decoding tagged cbor #3
Comments
The reason I did CBOR tag 55799 the way I did was due to this bit from RFC-7049 (section 2.4.5):
It adds no semantic meaning and is meant more for a magic value than anything else. |
i understand that. however, without my change it is unclear how to:
all of the other decoding functions in TAG table work this way, so why not for |
That's the way I wrote it, since tag 55799 has no semantic meaning other than itself. And here's code to encode and decode with that tag:
|
you don't think this is a little better, to match the behavior of the other TAG types? if not, feel free to close this issue. local cbor = require "org.conman.cbor"
local pre = { 1 , 2 , 3 , 4 , 5 }
local raw = cbor.TAG._magic_cbor(pre)
local post, _, magic = cbor.decode(raw, 1) |
I don't. Because the semantics don't exist past the tag itself, this is the only tag (as I interpret it) that can be immediately followed by another tag, say, #24, which tags the following binary string as CBOR data to be processed at a later time, or a Perl object (#26, an extension). The code you have returns the following item as _magic_cbor, which technically isn't correct. Think of the tag _magic_cbor, the three bytes 0xD9, 0xD9, 0xF7, as a magic value marking CBOR data, much like the bytes 0x7F, 0x45, 0x4C, 0x46 as marking an ELF executable under Unix, 0x47, 0x49, 0x46, 0x38, 0x39, 0x61 marking a GIF or 0x89, 0x50, 0x4E, 0x47 a PNG. |
hi, i noticed it's not very easy to decode an item that is tagged as CBOR (tag 55799).
here's a diff that (i think) will make it easier to tag items as cbor, and decode items tagged as CBOR.
The text was updated successfully, but these errors were encountered: