latchset / kryoptic

a pkcs#11 software token written in Rust
GNU General Public License v3.0
10 stars 4 forks source link

Use generic PrivateKeyInfo #10

Closed Jakuje closed 7 months ago

Jakuje commented 7 months ago

Currently, there is separate copy of PrivateKeyInfo in RSA and ECC code, handling the wrapping and unwrapping of private keys.

Simo suggested that this would be something that could be used with #defined_by(OID) of rust-asn1 library to provide generic structure. The WIP branch implementing this is available here (but still has some memory ownership issues to resolve):

https://github.com/Jakuje/kryoptic/commits/defined-by/

          sounds like this is a place where to use:

[defined_by(private_key_algorithm)]

See: https://docs.rs/asn1/latest/asn1/#defined-by

_Originally posted by @simo5 in https://github.com/latchset/kryoptic/pull/5#discussion_r1507927653_