Skip to main content

SigningKey

Trait SigningKey 

Source
pub trait SigningKey: Send + Sync {
    // Required methods
    fn supports(&self, scheme: SignatureScheme) -> bool;
    fn public_key(&self) -> PublicKey<'_>;
    fn sign(
        &self,
        scheme: SignatureScheme,
        message: &[u8],
    ) -> Result<Vec<u8>, CryptoError>;

    // Provided method
    fn to_pkcs8_der(&self) -> Result<Option<SecretVec>, CryptoError> { ... }
}
Expand description

A provider-owned signing key, including external or non-exportable keys.

Required Methods§

Source

fn supports(&self, scheme: SignatureScheme) -> bool

Reports whether this key can sign with scheme.

Source

fn public_key(&self) -> PublicKey<'_>

Returns the public key with explicit encoding.

Source

fn sign( &self, scheme: SignatureScheme, message: &[u8], ) -> Result<Vec<u8>, CryptoError>

Signs message.

Provided Methods§

Source

fn to_pkcs8_der(&self) -> Result<Option<SecretVec>, CryptoError>

Exports PKCS#8 when supported. Ok(None) means the key is non-exportable.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§