[][src]Trait rpki::crypto::signer::Signer

pub trait Signer {
    type KeyId;
    type Error: Debug + Display;
    fn create_key(
        &mut self,
        algorithm: PublicKeyFormat
    ) -> Result<Self::KeyId, Self::Error>;
fn get_key_info(
        &self,
        key: &Self::KeyId
    ) -> Result<PublicKey, KeyError<Self::Error>>;
fn destroy_key(
        &mut self,
        key: &Self::KeyId
    ) -> Result<(), KeyError<Self::Error>>;
fn sign<D: AsRef<[u8]> + ?Sized>(
        &self,
        key: &Self::KeyId,
        algorithm: SignatureAlgorithm,
        data: &D
    ) -> Result<Signature, SigningError<Self::Error>>;
fn sign_one_off<D: AsRef<[u8]> + ?Sized>(
        &self,
        algorithm: SignatureAlgorithm,
        data: &D
    ) -> Result<(Signature, PublicKey), Self::Error>; }

A type that allow creating signatures.

Associated Types

type KeyId

The type used for identifying keys.

type Error: Debug + Display

An operational error happened in the signer.

Loading content...

Required methods

fn create_key(
    &mut self,
    algorithm: PublicKeyFormat
) -> Result<Self::KeyId, Self::Error>

Creates a new key and returns an identifier.

fn get_key_info(
    &self,
    key: &Self::KeyId
) -> Result<PublicKey, KeyError<Self::Error>>

Returns the public key information for the given key.

If the key identified by key does not exist, returns None.

fn destroy_key(
    &mut self,
    key: &Self::KeyId
) -> Result<(), KeyError<Self::Error>>

Destroys a key.

Returns whether the key identified by key existed.

fn sign<D: AsRef<[u8]> + ?Sized>(
    &self,
    key: &Self::KeyId,
    algorithm: SignatureAlgorithm,
    data: &D
) -> Result<Signature, SigningError<Self::Error>>

Signs data.

fn sign_one_off<D: AsRef<[u8]> + ?Sized>(
    &self,
    algorithm: SignatureAlgorithm,
    data: &D
) -> Result<(Signature, PublicKey), Self::Error>

Signs data using a one time use keypair.

Returns both the signature and the public key of the key pair, but will not store this key pair.

Loading content...

Implementors

Loading content...