pub struct SignatureContext { /* private fields */ }Expand description
Signature context for digital signature operations
Implementations§
Source§impl SignatureContext
impl SignatureContext
Sourcepub fn with_provider(provider: Box<dyn CryptoProvider>) -> Self
pub fn with_provider(provider: Box<dyn CryptoProvider>) -> Self
Create a new signature context with a provider
Sourcepub fn with_default_provider() -> Self
pub fn with_default_provider() -> Self
Create a new signature context with the default provider
Sourcepub fn set_provider(&mut self, provider: Box<dyn CryptoProvider>)
pub fn set_provider(&mut self, provider: Box<dyn CryptoProvider>)
Set the cryptographic provider
Sourcepub fn provider(&self) -> Option<&dyn CryptoProvider>
pub fn provider(&self) -> Option<&dyn CryptoProvider>
Get the current provider
Sourcepub fn generate_keypair(
&mut self,
algorithm: Algorithm,
randomness: Option<&[u8]>,
) -> Result<SigKeypair>
pub fn generate_keypair( &mut self, algorithm: Algorithm, randomness: Option<&[u8]>, ) -> Result<SigKeypair>
Generate a keypair for the specified algorithm
Sourcepub fn sign(
&self,
algorithm: Algorithm,
secret_key: &SigSecretKey,
message: &[u8],
randomness: Option<&[u8]>,
) -> Result<Vec<u8>>
pub fn sign( &self, algorithm: Algorithm, secret_key: &SigSecretKey, message: &[u8], randomness: Option<&[u8]>, ) -> Result<Vec<u8>>
Sign a message using the given secret key
Sourcepub fn verify(
&self,
algorithm: Algorithm,
public_key: &SigPublicKey,
message: &[u8],
signature: &[u8],
) -> Result<bool>
pub fn verify( &self, algorithm: Algorithm, public_key: &SigPublicKey, message: &[u8], signature: &[u8], ) -> Result<bool>
Verify a signature for the given message and public key
Sourcepub fn is_initialized(&self) -> bool
pub fn is_initialized(&self) -> bool
Check if the context is initialized
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SignatureContext
impl !RefUnwindSafe for SignatureContext
impl Send for SignatureContext
impl Sync for SignatureContext
impl Unpin for SignatureContext
impl UnsafeUnpin for SignatureContext
impl !UnwindSafe for SignatureContext
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