pub struct UnboundCipherKey {
algorithm: &'static Algorithm,
key_bytes: Buffer<'static, &'static [u8]>,
}Expand description
A key bound to a particular cipher algorithm.
Fields§
§algorithm: &'static Algorithm§key_bytes: Buffer<'static, &'static [u8]>Implementations§
Source§impl UnboundCipherKey
impl UnboundCipherKey
Sourcepub fn new(
algorithm: &'static Algorithm,
key_bytes: &[u8],
) -> Result<Self, Unspecified>
pub fn new( algorithm: &'static Algorithm, key_bytes: &[u8], ) -> Result<Self, Unspecified>
Constructs an UnboundCipherKey.
§Errors
Unspecifiedifkey_bytes.len()does not match the length required byalgorithm.
Sourcefn validate_key_material(&self) -> Result<(), KeyRejected>
fn validate_key_material(&self) -> Result<(), KeyRejected>
Validates the key material against algorithm-specific constraints beyond
the length check performed by UnboundCipherKey::new.
For DES algorithms (behind legacy-des), this rejects weak DES subkeys
and degenerate key configurations (e.g. K1 == K2 for 2TDEA). For other
algorithms this is a no-op since the only constraint is key length.
The streaming cipher constructors call this because they pass raw key
bytes directly to the EVP API rather than going through
SymmetricCipherKey construction, which would otherwise perform these
checks. This is necessary because the EVP layer internally uses
DES_set_key_unchecked, which skips weak-key detection.
Trait Implementations§
Source§impl Debug for UnboundCipherKey
impl Debug for UnboundCipherKey
Source§impl TryInto<SymmetricCipherKey> for UnboundCipherKey
impl TryInto<SymmetricCipherKey> for UnboundCipherKey
Source§type Error = KeyRejected
type Error = KeyRejected
The type returned in the event of a conversion error.
Auto Trait Implementations§
impl Freeze for UnboundCipherKey
impl RefUnwindSafe for UnboundCipherKey
impl Send for UnboundCipherKey
impl Sync for UnboundCipherKey
impl Unpin for UnboundCipherKey
impl UnsafeUnpin for UnboundCipherKey
impl UnwindSafe for UnboundCipherKey
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