[−][src]Struct yaca::SignContext
Context for Sign
operations
Implementations
impl SignContext
[src]
pub fn initialize(algo: &DigestAlgorithm, prv_key: &Key) -> Result<SignContext>
[src]
Initializes a signature context for asymmetric signatures
algo
is a digest algorithm that will be used.prv_key
is a private key that will be used, algorithm is deduced based on key type, supported key types:- For verification use
VerifyContext
with matching public key. - For RSA operations the default padding used is
Padding::Pkcs1
. It can be changed usingCtxPad::set_property_padding()
. - For
DigestAlgorithm::Sha384
andDigestAlgorithm::Sha512
theRSA
key size must be bigger than 512 bits. - Using
DigestAlgorithm::Md5
algorithm forDSA
andECDSA
operations is prohibited. - Using
DigestAlgorithm::Md5
orDigestAlgorithm::Sha224
withPadding::X931
is prohibited.
pub fn initialize_hmac(
algo: &DigestAlgorithm,
sym_key: &Key
) -> Result<SignContext>
[src]
algo: &DigestAlgorithm,
sym_key: &Key
) -> Result<SignContext>
Initializes a signature context for HMAC
algo
is a digest algorithm that will be used.sym_key
is a key that will be used, supported key types:- For verification, calculate message HMAC and compare with
received MAC using
Yaca::memcmp()
.
pub fn initialize_cmac(
algo: &EncryptAlgorithm,
sym_key: &Key
) -> Result<SignContext>
[src]
algo: &EncryptAlgorithm,
sym_key: &Key
) -> Result<SignContext>
Initializes a signature context for CMAC
algo
is an encryption algorithm that will be used.sym_key
is a key that will be used, supported key types:- For verification, calculate message CMAC and compare with
received MAC using
Yaca::memcmp()
.
pub fn update(&self, message: &[u8]) -> Result<()>
[src]
Feeds the message into the digital signature or MAC algorithm
message
is a chunk of data to calculate signature or MAC from.
pub fn finalize(&self) -> Result<Vec<u8>>
[src]
Calculates the final signature or MAC
- Returns the calculated signature or MAC.
- Skipping
SignContext::update()
and calling onlySignContext::finalize()
will produce a signature or MAC of an empty message.
Trait Implementations
impl ContextWithPadding for SignContext
[src]
pub fn set_property_padding(&self, padding: &Padding) -> Result<()>
[src]
impl Drop for SignContext
[src]
Auto Trait Implementations
impl RefUnwindSafe for SignContext
impl !Send for SignContext
impl !Sync for SignContext
impl Unpin for SignContext
impl UnwindSafe for SignContext
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,