bcgit / pc-dart

Pointy Castle - Dart Derived Bouncy Castle APIs
MIT License
237 stars 122 forks source link

Ensure negative positive BigInts are padded if their first byte has 0x80 #59

Closed schancel closed 3 years ago

schancel commented 3 years ago

Encoding a BigInt in 2s-compliment requires an extra padding byte if the 0x80 bit is set in the first byte position. This commit checks to see if that's the case, and adds the padding to ensure it is parseable.

mwcw commented 3 years ago

Hi

Thanks for this, it has triggered a reworking of how BigInt is handled within the api.

It will be pushed shortly.

MW