pub struct Key { /* private fields */ }Expand description
A 256-bit key. Its bytes live only in a page of their own that is locked in memory, so they never reach swap, and that core dumps leave out; they are zeroed when the key is dropped. A key cannot be copied, and Debug shows only its id.
Implementations§
Source§impl Key
impl Key
Sourcepub fn generate() -> Result<Key, KeyError>
pub fn generate() -> Result<Key, KeyError>
Makes a new random key, refusing if its memory cannot be locked.
§Errors
KeyError::Memory if the key’s page cannot be locked or kept out
of core dumps.
§Panics
Never: AWS-LC aborts the process rather than fail to give random bytes.
Sourcepub fn load_master(path: &Path) -> Result<Key, KeyError>
pub fn load_master(path: &Path) -> Result<Key, KeyError>
Loads the master key: the file must hold exactly 32 bytes. They are read straight into the key’s own locked page.
§Errors
KeyError::Read if the file cannot be opened or read,
KeyError::WrongSize if it holds other than 32 bytes, and
KeyError::Memory if the key’s page cannot be locked.
Trait Implementations§
Auto Trait Implementations§
impl Forget for Key
impl Freeze for Key
impl RefUnwindSafe for Key
impl Send for Key
impl Sync for Key
impl Unpin for Key
impl UnsafeUnpin for Key
impl UnwindSafe for Key
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.