Skip to content
This repository has been archived by the owner on Oct 7, 2019. It is now read-only.

should packet.data really be length-prefixed? #13

Closed
michielbdejong opened this issue Sep 11, 2017 · 2 comments
Closed

should packet.data really be length-prefixed? #13

michielbdejong opened this issue Sep 11, 2017 · 2 comments

Comments

@michielbdejong
Copy link
Contributor

https://github.com/interledger/rfcs/blob/master/asn1/InterledgerPacket.asn#L43 says that the InterledgerPacket's data field should be "a length-prefixed header", and that seems to be what https://github.com/interledgerjs/ilp-packet/blob/master/index.ts#L22 does.

But when I read the ASN.1 without reading that comment, my interpretation is that PACKET.type is an ASN.1 OpenType of the PACKET CLASS, and although I couldn't really find a good reference on asn.1, from what I've read, I would expect PACKET.&Type ({PacketSet}{@type}) to just be replaceable with e.g. InterledgerProtocolPayment if typeId is 1?

cc @justmoon

see also interledgerjs/btp-packet#10

@justmoon
Copy link
Contributor

justmoon commented Sep 11, 2017

OER does indeed add a length prefix in this situation. I don't have the reference handy, but we generated plenty of examples using OSS Nokalva's ASN.1 implementation and at one point I did look up the relevant section in the X.696 specification and open types in OER are length-prefixed.

@michielbdejong
Copy link
Contributor Author

Thanks! Looked it up, and adding the length prefix is indeed correct for an ASN.1 Open Type. See
https://www.itu.int/rec/T-REC-X.696-201408-S/en section 30:
screen shot 2017-09-12 at 08 44 07

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants