diff options
Diffstat (limited to 'openpgp/src/crypto/backend/rust/asymmetric.rs')
-rw-r--r-- | openpgp/src/crypto/backend/rust/asymmetric.rs | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/openpgp/src/crypto/backend/rust/asymmetric.rs b/openpgp/src/crypto/backend/rust/asymmetric.rs index 9654e788..fafac2b1 100644 --- a/openpgp/src/crypto/backend/rust/asymmetric.rs +++ b/openpgp/src/crypto/backend/rust/asymmetric.rs @@ -416,40 +416,6 @@ impl<P: key::KeyParts, R: key::KeyRole> Key<P, R> { }, _ => Err(Error::UnsupportedEllipticCurve(curve.clone()).into()), }, - (mpi::PublicKey::EdDSA { curve, q }, - mpi::Signature::EdDSA { r, s }) => match curve { - Curve::Ed25519 => { - use ed25519_dalek::{PublicKey, Signature, SIGNATURE_LENGTH}; - use ed25519_dalek::{Verifier}; - - let (public, ..) = q.decode_point(&Curve::Ed25519)?; - assert_eq!(public.len(), 32); - - let key = PublicKey::from_bytes(public).map_err(|e| { - Error::InvalidKey(e.to_string()) - })?; - - // OpenPGP encodes R and S separately, but our - // cryptographic library expects them to be - // concatenated. - let mut sig_bytes = [0u8; SIGNATURE_LENGTH]; - - // We need to zero-pad them at the front, because - // the MPI encoding drops leading zero bytes. - let half = SIGNATURE_LENGTH / 2; - sig_bytes[..half].copy_from_slice( - &r.value_padded(half).map_err(bad)?); - sig_bytes[half..].copy_from_slice( - &s.value_padded(half).map_err(bad)?); - - let signature = Signature::from(sig_bytes); - - key.verify(digest, &signature) - .map_err(|e| Error::BadSignature(e.to_string()))?; - Ok(()) - }, - _ => Err(Error::UnsupportedEllipticCurve(curve.clone()).into()), - }, _ => Err(Error::MalformedPacket(format!( "unsupported combination of key {} and signature {:?}.", self.pk_algo(), sig)).into()), |