mozilla / authenticator-rs

Rust library to interact with Security Keys, used by Firefox
https://crates.io/crates/authenticator
Mozilla Public License 2.0
276 stars 72 forks source link

Add support for ECDSA over P256 using NSS #279

Closed jschanck closed 1 year ago

jschanck commented 1 year ago

This adds crypto::backend functions for generating P256 keys and signing with ECDSA P256 SHA256.

The "Add Credential" function in the Virtual Authenticator API (https://w3c.github.io/webauthn/#sctn-automation-add-credential) provides the private key as an RFC 5958 PrivateKeyInfo. I've made ecdsa_p256_sha256_sign_raw a public function within the crypto module since it already acts on PrivateKeyInfos. If we start signing outside of tests, then we'll want a richer type for wrapping private keys. But we'll probably use EncryptedPrivateKeyInfo instead, so I'm going to defer locking in those details.

Depends on #278 and https://github.com/mozilla/nss-gk-api/pull/8.