deps: update p256 requirement from 0.11.1 to 0.12.0

Pull-Request: #3336.
This commit is contained in:
dependabot[bot]
2023-03-01 04:34:49 +00:00
committed by GitHub
parent 10f948d8c0
commit bc88900641
3 changed files with 55 additions and 10 deletions

View File

@ -92,12 +92,14 @@ pub struct SecretKey(SigningKey);
impl SecretKey {
/// Generate a new random ECDSA secret key.
pub fn generate() -> SecretKey {
SecretKey(SigningKey::random(rand::thread_rng()))
SecretKey(SigningKey::random(&mut rand::thread_rng()))
}
/// Sign a message with this secret key, producing a DER-encoded ECDSA signature.
pub fn sign(&self, msg: &[u8]) -> Vec<u8> {
self.0.sign(msg).to_der().as_bytes().to_owned()
let signature: p256::ecdsa::DerSignature = self.0.sign(msg);
signature.as_bytes().to_owned()
}
/// Encode a secret key into a byte buffer.