Skip to main content

Signer

Struct Signer 

Source
pub struct Signer<'a> { /* private fields */ }
Expand description

Signer struct containing a signature scheme and a signing key.

§Example

use oqs;
use signature::{Signer,Verifier};
oqs::init();
let scheme = oqs::sig::Sig::new(oqs::sig::Algorithm::MlDsa44).unwrap();
let message = [0u8; 100];
let (pk, sk) = scheme.keypair().unwrap();
let signer = oqs::sig::Signer::new(&scheme,sk);
let verifier = oqs::sig::Verifier::new(&scheme,pk);
let signature = signer.try_sign(&message).unwrap();
assert!(verifier.verify(&message, &signature).is_ok());

Implementations§

Source§

impl<'a> Signer<'a>

Source

pub fn new(scheme: &'a Sig, sk: SecretKey) -> Self

Creates a new Signer with the given signature scheme and secret key.

Trait Implementations§

Source§

impl<'a> Signer<Signature> for Signer<'a>

Available on crate feature rustcrypto only.
Source§

fn try_sign(&self, msg: &[u8]) -> Result<Signature, Error>

Attempt to sign the given message, returning a digital signature on success, or an error if something went wrong. Read more
Source§

fn sign(&self, msg: &[u8]) -> S

Sign the given message and return a digital signature

Auto Trait Implementations§

§

impl<'a> Freeze for Signer<'a>

§

impl<'a> RefUnwindSafe for Signer<'a>

§

impl<'a> Send for Signer<'a>

§

impl<'a> Sync for Signer<'a>

§

impl<'a> Unpin for Signer<'a>

§

impl<'a> UnsafeUnpin for Signer<'a>

§

impl<'a> UnwindSafe for Signer<'a>

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<S, T> SignerMut<S> for T
where T: Signer<S>,

Source§

fn try_sign(&mut self, msg: &[u8]) -> Result<S, Error>

Attempt to sign the given message, updating the state, and returning a digital signature on success, or an error if something went wrong. Read more
Source§

fn sign(&mut self, msg: &[u8]) -> S

Sign the given message, update the state, and return a digital signature.
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.