pub struct SymmetricKey(/* private fields */);Expand description
A symmetric key for local token encryption/decryption
Implementations§
Source§impl SymmetricKey
impl SymmetricKey
Sourcepub fn generate<R: CryptoRng + RngCore>(rng: &mut R) -> Self
pub fn generate<R: CryptoRng + RngCore>(rng: &mut R) -> Self
Generate a new random symmetric key
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<Self, PqPasetoError>
pub fn from_bytes(bytes: &[u8]) -> Result<Self, PqPasetoError>
Create symmetric key from bytes
Derive a symmetric key from shared secret using proper HKDF-SHA256
Uses RFC 5869 HKDF with SHA-256 for cryptographically sound key derivation. The salt is set to None for domain separation, following best practices for post-quantum key exchange scenarios.
Trait Implementations§
Source§impl Clone for SymmetricKey
impl Clone for SymmetricKey
Source§fn clone(&self) -> SymmetricKey
fn clone(&self) -> SymmetricKey
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SymmetricKey
impl Debug for SymmetricKey
Source§impl Drop for SymmetricKey
impl Drop for SymmetricKey
Auto Trait Implementations§
impl Freeze for SymmetricKey
impl RefUnwindSafe for SymmetricKey
impl Send for SymmetricKey
impl Sync for SymmetricKey
impl Unpin for SymmetricKey
impl UnwindSafe for SymmetricKey
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