Upgrade ed25519-dalek to pre.4 (#1665)

* Upgrade ed25519-dalek to pre.4

* Update core/src/identity/ed25519.rs

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>
This commit is contained in:
Roman Borschel
2020-07-17 12:01:49 +02:00
committed by GitHub
parent cc3438ec37
commit 7c7d6a9d2e
3 changed files with 9 additions and 4 deletions

View File

@ -20,8 +20,9 @@
//! Ed25519 keys.
use ed25519_dalek as ed25519;
use ed25519_dalek::{self as ed25519, Signer as _, Verifier as _};
use rand::RngCore;
use std::convert::TryFrom;
use super::error::DecodingError;
use zeroize::Zeroize;
use core::fmt;
@ -107,7 +108,7 @@ pub struct PublicKey(ed25519::PublicKey);
impl PublicKey {
/// Verify the Ed25519 signature on a message using the public key.
pub fn verify(&self, msg: &[u8], sig: &[u8]) -> bool {
ed25519::Signature::from_bytes(sig).and_then(|s| self.0.verify(msg, &s)).is_ok()
ed25519::Signature::try_from(sig).and_then(|s| self.0.verify(msg, &s)).is_ok()
}
/// Encode the public key into a byte array in compressed form, i.e.