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

Required methods

Create a new Keypair with cryptographically random content.

Construct a Keypair from the bytes of a PublicKey and PrivateKey.

Construct a Keypair from a hex encoded private key string.

Construct a Keypair PrivateKey type.

Signs a data bytes with a Keypair.

Verify a Signature on a data with this Keypair public key.

Provided methods

Convert this keypair to bytes.

Returns

An array of bytes, [u8; KEYPAIR_LENGTH]. The first KEY_BYTES_SIZE of bytes is the PrivateKey, and the next KEY_BYTES_SIZE bytes is the PublicKey.

Implementors