pub trait KeyPair:
Clone
+ Display
+ Debug
+ KeyPairInner
+ PartialEq
+ Eq {
type Seed: AsRef<[u8]>;
type Signator: Signator;
// Required methods
fn generate_signator(&self) -> Self::Signator;
fn from_seed(seed: Self::Seed) -> Self;
fn public_key(&self) -> <Self::Signator as Signator>::PublicKey;
fn verify(
&self,
message: &[u8],
signature: &<<Self::Signator as Signator>::PublicKey as PublicKey>::Signature,
) -> Result<(), SigError>;
fn upcast(self) -> KeyPairEnum;
}
Expand description
Define the operations that can be performed on a cryptographic key pair.
Required Associated Types§
Required Methods§
Sourcefn generate_signator(&self) -> Self::Signator
fn generate_signator(&self) -> Self::Signator
Generate signator.
Sourcefn public_key(&self) -> <Self::Signator as Signator>::PublicKey
fn public_key(&self) -> <Self::Signator as Signator>::PublicKey
Get PublicKey
Sourcefn verify(
&self,
message: &[u8],
signature: &<<Self::Signator as Signator>::PublicKey as PublicKey>::Signature,
) -> Result<(), SigError>
fn verify( &self, message: &[u8], signature: &<<Self::Signator as Signator>::PublicKey as PublicKey>::Signature, ) -> Result<(), SigError>
Verify a signature with public key.
Sourcefn upcast(self) -> KeyPairEnum
fn upcast(self) -> KeyPairEnum
Upcast to KeyPairEnum
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.