pub struct EncryptionKey {
pub epoch: u64,
pub algorithm: String,
/* private fields */
}Expand description
An encryption key for channel communication.
Fields§
§epoch: u64Key epoch (incremented on rotation)
algorithm: StringAlgorithm name
Implementations§
Source§impl EncryptionKey
impl EncryptionKey
Sourcepub fn generate_for(scheme: &EncryptionScheme) -> Self
pub fn generate_for(scheme: &EncryptionScheme) -> Self
Generate a new random encryption key for a specific scheme.
Sourcepub fn from_bytes(bytes: [u8; 32], epoch: u64) -> Self
pub fn from_bytes(bytes: [u8; 32], epoch: u64) -> Self
Create from raw bytes.
Sourcepub fn from_bytes_with_algorithm(
bytes: [u8; 32],
epoch: u64,
algorithm: &str,
) -> Self
pub fn from_bytes_with_algorithm( bytes: [u8; 32], epoch: u64, algorithm: &str, ) -> Self
Create from raw bytes with a specific algorithm tag.
Sourcepub fn fingerprint(&self) -> String
pub fn fingerprint(&self) -> String
Get hex-encoded fingerprint (first 8 bytes of key hash).
Trait Implementations§
Source§impl Clone for EncryptionKey
impl Clone for EncryptionKey
Source§fn clone(&self) -> EncryptionKey
fn clone(&self) -> EncryptionKey
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for EncryptionKey
impl RefUnwindSafe for EncryptionKey
impl Send for EncryptionKey
impl Sync for EncryptionKey
impl Unpin for EncryptionKey
impl UnsafeUnpin for EncryptionKey
impl UnwindSafe for EncryptionKey
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