diff --git a/elliptic-curve/src/public_key.rs b/elliptic-curve/src/public_key.rs index 2e3906a7e..251089eb8 100644 --- a/elliptic-curve/src/public_key.rs +++ b/elliptic-curve/src/public_key.rs @@ -2,7 +2,7 @@ use crate::{ AffinePoint, CurveArithmetic, CurveGroup, Error, NonZeroScalar, ProjectivePoint, Result, - point::NonIdentity, + SecretKey, point::NonIdentity, }; use core::fmt::Debug; use group::Group; @@ -293,6 +293,24 @@ where } } +impl From> for PublicKey +where + C: CurveArithmetic, +{ + fn from(secret_key: SecretKey) -> Self { + secret_key.public_key() + } +} + +impl From<&SecretKey> for PublicKey +where + C: CurveArithmetic, +{ + fn from(secret_key: &SecretKey) -> PublicKey { + secret_key.public_key() + } +} + #[cfg(feature = "sec1")] impl PartialOrd for PublicKey where