Skip to content

tor-llcrypto: replace simple_asn1 dependency with der-parser

morgan requested to merge morgan/arti:bug_1632 into main

Fixes #1632 (closed)

One thing to notice which I did some spelunking to verify is that whereas the simple_asn1 crate will automatically remove unnecessary 0x00 high bytes, the der-parser crate instead presumes the provided byte vector is correct and ultimately passes it through to the der encoding function. Thus, we have to only conditionally add an extra 0x00 byte in the PublicKey::to_der() method rather than always doing so and depending on the der encoding logic to do the right thing.

I'm not sure how to do so, but one additional nice thing would be tests with RSA keys with an n which does not have the high bit set to further verify this logic.

With this MR, the tor-llcrypto tests pass (as does cargo test from the root of the workspace) and Gosling is able to bootstrap (as parse_der does not even depend on the time crate so the large-dates issue does not apply).

Merge request reports