pub struct Signer<'key, 'prompt> { /* private fields */ }Expand description
A signer for a PKCS#11 key.
This implements sequoia_openpgp::crypto::Signer and hence can
be used wherever a Sequoia method needs to create a signature.
Implementations§
Source§impl<'key, 'prompt> Signer<'key, 'prompt>
impl<'key, 'prompt> Signer<'key, 'prompt>
Sourcepub fn new<P>(
prompt: P,
key: &'key Key,
user_pin: Option<AuthPin>,
composite_user_pin: Option<AuthPin>,
) -> Result<Self>where
P: Prompt + 'prompt,
pub fn new<P>(
prompt: P,
key: &'key Key,
user_pin: Option<AuthPin>,
composite_user_pin: Option<AuthPin>,
) -> Result<Self>where
P: Prompt + 'prompt,
Creates a Signer.
This is a bit ugly, because we can’t stash a PKCS#11
Session: a struct that implements Signer has to implement
Sync, but a Session is not Sync.
If the user PIN is known, pass it through to avoid prompting
the user. (If user_pin is wrong, we don’t prompt the user,
but immediately return an error.) Otherwise, the user is
prompted.
If the key is a composite key (e.g., ML-DSA-65+Ed25519, or
ML-DSA-87+Ed448), then composite_user_pin is the pin for the
composite component. Like with the user PIN, if the composite
user pin is needed and not specified, we prompt for the PIN.
Trait Implementations§
Source§impl Signer for Signer<'_, '_>
impl Signer for Signer<'_, '_>
Source§fn public(&self) -> &Key<PublicParts, UnspecifiedRole>
fn public(&self) -> &Key<PublicParts, UnspecifiedRole>
Returns a reference to the public key.
Source§fn sign(&mut self, hash_algo: HashAlgorithm, digest: &[u8]) -> Result<Signature>
fn sign(&mut self, hash_algo: HashAlgorithm, digest: &[u8]) -> Result<Signature>
Creates a signature over the
digest produced by hash_algo.Source§fn acceptable_hashes(&self) -> &[HashAlgorithm]
fn acceptable_hashes(&self) -> &[HashAlgorithm]
Returns a list of hashes that this signer accepts. Read more
Auto Trait Implementations§
impl<'key, 'prompt> !Freeze for Signer<'key, 'prompt>
impl<'key, 'prompt> !RefUnwindSafe for Signer<'key, 'prompt>
impl<'key, 'prompt> !UnwindSafe for Signer<'key, 'prompt>
impl<'key, 'prompt> Forget for Signer<'key, 'prompt>
impl<'key, 'prompt> Move for Signer<'key, 'prompt>
impl<'key, 'prompt> Send for Signer<'key, 'prompt>
impl<'key, 'prompt> Sync for Signer<'key, 'prompt>
impl<'key, 'prompt> Unpin for Signer<'key, 'prompt>
impl<'key, 'prompt> UnsafeUnpin for Signer<'key, 'prompt>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more