wstrange / asn1lib

Dart ASN1 Encoder / Decoder
BSD 2-Clause "Simplified" License
30 stars 31 forks source link

Update length computing of ANS1Parser #32

Closed Ephenodrom closed 5 years ago

Ephenodrom commented 5 years ago

Hello, I found a bug in the parsing of ANS1. I tried to parse the data within a certificate and found out that the length of the values of the ANS1Objects was not calculated right.

Therefore i made some changes, to calculate the length by using the octet after the identifier. This octet describes the length of the following value.

I improved the unit test "Test decode certificate", by parsing more data out of the certificate used in this test.

I also check the length of each ANS1Object by debugging the test and comparing it with the output on https://lapo.it/asn1js/.

Also added a new distingished name value and reformat the code.

Regards

wstrange commented 5 years ago

Wow - this looks great. I wont have time to test this -but it looks like you have some solid tests - so I am going to go ahead and merge this. I will bump the version and push to pub.

I added your name to the authors - but I dont have your full name and email. If you want to send me the info I'd be happy to add it.

Thanks for the PR

Ephenodrom commented 5 years ago

Hello, thanks for the quick response! I heavily use this package at my own utils package. https://github.com/Ephenodrom/Dart-Basic-Utils

So I will make further tests in the future and maybe come up with more PRs.

Regards from Germany