Trait core_crypto::KeyPairSchema [−][src]
pub trait KeyPairSchema: Sized + PartialEq + Debug + Copy { type Crypto: BlockCipher; fn random() -> Self; fn from_bytes(bytes: &[u8]) -> Result<Self>; fn from_hex_private_key<S: AsRef<str>>(hex: S) -> Result<Self>; fn from_private_key(pk: PrivateKey) -> Self; fn private_key(&self) -> PrivateKey; fn public_key(&self) -> PublicKey; fn sign(&self, data: &[u8]) -> Signature; fn verify(&self, data: &[u8], signature: Signature) -> Result<()>; fn from_null_private_key(pk: PublicKey) -> Self; fn to_bytes(&self) -> [u8; 64] { ... } }
Expand description
This trait defines a schema: an association of symbol or nis1 keypair type.
Associated Types
type Crypto: BlockCipher
Required methods
Construct a Keypair
from the bytes of a PublicKey
and PrivateKey
.
fn from_hex_private_key<S: AsRef<str>>(hex: S) -> Result<Self>
fn from_hex_private_key<S: AsRef<str>>(hex: S) -> Result<Self>
Construct a Keypair
from a hex encoded private key string.
fn from_private_key(pk: PrivateKey) -> Self
fn from_private_key(pk: PrivateKey) -> Self
Construct a Keypair
PrivateKey
type.
fn private_key(&self) -> PrivateKey
fn public_key(&self) -> PublicKey
Verify a Signature
on a data with this Keypair public key.
fn from_null_private_key(pk: PublicKey) -> Self