Struct crypt_guard::hmac_sign::Sign
source · pub struct Sign {
pub data: SignatureData,
pub status: Operation,
pub hash_type: SignType,
pub length: usize,
pub veryfied: bool,
}Expand description
Represents a signing operation including the data and metadata for the operation.
Fields§
§data: SignatureData§status: Operation§hash_type: SignType§length: usize§veryfied: boolImplementations§
source§impl Sign
impl Sign
Represents a cryptographic signing operation, including data, passphrase, operational status, hash type, signature length, and verification status.
sourcepub fn new(
data: Vec<u8>,
passphrase: Vec<u8>,
status: Operation,
hash_type: SignType
) -> Self
pub fn new( data: Vec<u8>, passphrase: Vec<u8>, status: Operation, hash_type: SignType ) -> Self
Constructs a new Sign instance with specified data, passphrase, operation status, and hash type.
§Parameters
data: The data to be signed or verified.passphrase: The passphrase used for HMAC generation.status: The operation status (signing or verifying).hash_type: The hash algorithm to use for signing.
§Returns
A new Sign instance.
sourcepub fn hmac(&mut self) -> Vec<u8>
pub fn hmac(&mut self) -> Vec<u8>
Performs the HMAC operation based on the operation status: generates HMAC for signing or verifies HMAC for verification.
§Returns
HMAC as a Vec<u8> for signing or the verified data for verification.
sourcepub fn generate_hmac(&self) -> Vec<u8>
pub fn generate_hmac(&self) -> Vec<u8>
Generates HMAC for the data using the specified hash type and passphrase.
§Returns
Concatenated original data and its HMAC as a Vec<u8>.
Trait Implementations§
source§impl PartialEq for Sign
impl PartialEq for Sign
impl StructuralPartialEq for Sign
Auto Trait Implementations§
impl Freeze for Sign
impl RefUnwindSafe for Sign
impl Send for Sign
impl Sync for Sign
impl Unpin for Sign
impl UnwindSafe for Sign
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