[][src]Trait dup_crypto::keys::PrivateKey

pub trait PrivateKey: Clone + Display + Debug + PartialEq + Eq + ToBase58 {
    type Signature: Signature;
    fn from_base58(base58_string: &str) -> Result<Self, BaseConvertionError>;
fn sign(&self, message: &[u8]) -> Self::Signature; }

Define the operations that can be performed on a cryptographic private key.

A PrivateKey can be converted from/to Base58 format. When converted back and forth the value should be the same.

A PrivateKey is used to sign a message. The corresponding PublicKey will then be used to verify that signature.

Associated Types

type Signature: Signature

Signature type of associated cryptosystem.

Loading content...

Required methods

fn from_base58(base58_string: &str) -> Result<Self, BaseConvertionError>

Create a PrivateKey from a Base58 string.

The Base58 string should contains only valid Base58 characters and have a correct length. If it's not the case, a BaseConvertionError is returned with the corresponding variant.

fn sign(&self, message: &[u8]) -> Self::Signature

Sign a message with this private key.

Loading content...

Implementors

impl PrivateKey for PrivKey[src]

type Signature = Sig

impl PrivateKey for PrivateKey[src]

type Signature = Signature

fn sign(&self, message: &[u8]) -> Self::Signature[src]

Sign a message with this private key.

Loading content...