diff --git a/Cargo.toml b/Cargo.toml index d0a42398..688a7b33 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,6 +14,6 @@ version = "0.5.0" [dependencies] base64 = "0.10.1" -ring = "0.14.6" +ring = "0.16.1" serde_json = "1.0.40" -untrusted = "0.6.2" +untrusted = "0.7.0" diff --git a/src/keys.rs b/src/keys.rs index 8afaf11c..1cbc7d10 100644 --- a/src/keys.rs +++ b/src/keys.rs @@ -6,7 +6,6 @@ use std::{ }; use ring::signature::Ed25519KeyPair as RingEd25519KeyPair; -use untrusted::Input; use crate::{signatures::Signature, Algorithm, Error}; @@ -49,10 +48,7 @@ impl Ed25519KeyPair { /// Returns an error if the public and private keys provided are invalid for the implementing /// algorithm. pub fn new(public_key: &[u8], private_key: &[u8], version: String) -> Result { - if let Err(error) = RingEd25519KeyPair::from_seed_and_public_key( - Input::from(private_key), - Input::from(public_key), - ) { + if let Err(error) = RingEd25519KeyPair::from_seed_and_public_key(private_key, public_key) { return Err(Error::new(error.to_string())); } @@ -67,11 +63,9 @@ impl Ed25519KeyPair { impl KeyPair for Ed25519KeyPair { fn sign(&self, message: &[u8]) -> Signature { // Okay to unwrap because we verified the input in `new`. - let ring_key_pair = RingEd25519KeyPair::from_seed_and_public_key( - Input::from(&self.private_key), - Input::from(&self.public_key), - ) - .unwrap(); + let ring_key_pair = + RingEd25519KeyPair::from_seed_and_public_key(&self.private_key, &self.public_key) + .unwrap(); Signature { algorithm: Algorithm::Ed25519, diff --git a/src/verification.rs b/src/verification.rs index 62773b1c..f8df82be 100644 --- a/src/verification.rs +++ b/src/verification.rs @@ -1,6 +1,6 @@ //! Verification of digital signatures. -use ring::signature::{verify, ED25519}; +use ring::signature::{VerificationAlgorithm, ED25519}; use untrusted::Input; use crate::Error; @@ -33,13 +33,13 @@ impl Verifier for Ed25519Verifier { signature: &[u8], message: &[u8], ) -> Result<(), Error> { - verify( - &ED25519, - Input::from(public_key), - Input::from(message), - Input::from(signature), - ) - .map_err(|_| Error::new("signature verification failed")) + ED25519 + .verify( + Input::from(public_key), + Input::from(message), + Input::from(signature), + ) + .map_err(|_| Error::new("signature verification failed")) } }