Skip to main content

Signer

Struct Signer 

Source
pub struct Signer { /* private fields */ }
Expand description

Streaming DigestSign context.

Call update zero or more times, then finish to produce the signature.

Implementations§

Source§

impl Signer

Source

pub fn new(key: &Pkey<Private>, init: &SignInit<'_>) -> Result<Self, ErrorStack>

Create a signer.

§Errors
Source

pub fn update(&mut self, data: &[u8]) -> Result<(), ErrorStack>

Feed data into the hash.

§Errors
Source

pub fn finish(&mut self) -> Result<Vec<u8>, ErrorStack>

Finalise and return the signature.

Not supported by pure one-shot algorithms such as Ed25519 — use sign_oneshot for those.

§Errors
Source

pub fn sign_oneshot(&mut self, data: &[u8]) -> Result<Vec<u8>, ErrorStack>

One-shot sign over data.

Required for algorithms that do not support streaming (Ed25519, Ed448). For algorithms that do support streaming, prefer update + finish.

§Errors
Source

pub fn sign_into( &mut self, data: &[u8], sig: &mut [u8], ) -> Result<usize, ErrorStack>

One-shot sign over data into a caller-provided buffer sig.

The buffer must be at least as large as the maximum signature size for the key (use EVP_PKEY_get_size or the algorithm’s known fixed length). For algorithms with a fixed signature size (e.g. ML-DSA, Ed25519), the caller can pre-allocate the exact size and avoid the null-output query.

Returns the number of bytes written. The caller should truncate sig to the returned length if the actual size may differ from the buffer size.

§Errors

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.