Trait duniter_keys::KeyPair
[−]
[src]
pub trait KeyPair: Clone + Display + Debug + PartialEq + Eq { type Signature: Signature; type PublicKey: PublicKey; type PrivateKey: PrivateKey; fn public_key(&self) -> Self::PublicKey; fn private_key(&self) -> Self::PrivateKey; fn sign(&self, message: &[u8]) -> Self::Signature; fn verify(&self, message: &[u8], signature: &Self::Signature) -> bool; }
Store a cryptographic key pair (PublicKey
+ PrivateKey
)
Associated Types
type Signature: Signature
Signature type of associated cryptosystem.
type PublicKey: PublicKey
PublicKey type of associated cryptosystem.
type PrivateKey: PrivateKey
PrivateKey type of associated cryptosystem.
Required Methods
fn public_key(&self) -> Self::PublicKey
Get PublicKey
fn private_key(&self) -> Self::PrivateKey
Get PrivateKey
fn sign(&self, message: &[u8]) -> Self::Signature
Sign a message with private key.
fn verify(&self, message: &[u8], signature: &Self::Signature) -> bool
Verify a signature with public key.
Implementors
impl KeyPair for KeyPair type Signature = Signature; type PublicKey = PublicKey; type PrivateKey = PrivateKey;