indutny / asn1.js

ASN.1 Decoder/Encoder/DSL
MIT License
181 stars 64 forks source link

Remove limit for definite length decoding #74

Closed felix closed 7 years ago

felix commented 8 years ago

I don't believe there is any need for this restriction. It is stopping us deal with large encrypted files

felix commented 8 years ago

@indutny, just rebased against master.

felix commented 7 years ago

@indutny ping

felix commented 7 years ago

@indutny, so it seems that DER only allows primitive form encoding (ie. a single OCTET string with definite length) whereas CER encoding allows constructed form with 1000 octet subdivisions. If you are not restricting this library to DER specifically can you see any other issues with this?

felix commented 7 years ago

Closing as not relevant to DER.

felix commented 7 years ago

I cannot find any references to a limit of 3 bytes to encode the length. Java's Bouncy Castle seems to set the limit to 4 bytes seemingly due to the maximum size of an integer.

3 bytes limits us to only 16 megabytes (which we are reaching) so I have updated the patch to limit it to 4 bytes which is perhaps better than removing the restriction altogether.

(Now as PR #78 as this PR did not reopen)