Struct nis1_crypto::keypair::Keypair[][src]

pub struct Keypair {
    pub private_key: PrivateKey,
    pub public_key: PublicKey,
}
Expand description

It represents an Nis1 asymmetric private/public encryption key.

Fields

private_key: PrivateKey

The private half of this keypair.

public_key: PublicKey

The public half of this keypair.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

Create a new Nis1 Keypair with cryptographically random content.

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

Construct a Nis1 Keypair from a hex encoded private key string.

Inputs

  • hex: an S representing the hex private key (String or &str).

Returns

A Result whose okay value is an Nis1 Keypair or whose error value is an failure::Error describing the error that occurred.

Construct a Nis1 Keypair PrivateKey type.

Inputs

  • private_key: representing the PrivateKey type.

Returns

A Keypair

Signs a data bytes with a Nis1 Keypair.

Inputs

  • data: an &[u8] representing the data to sign.

Returns

A Signature the signature hash.

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

Inputs

  • data: an &[u8] the data to verify.

  • signature: an Signature the signature hash.

Returns

Returns Ok if the Signature was a valid signature created by this Nis1 Keypair

Convert this keypair to bytes. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.