pub struct KeyGenerator { /* private fields */ }Expand description
Key generator
Implementations§
Source§impl KeyGenerator
impl KeyGenerator
pub fn new() -> Self
pub fn initialize(&mut self) -> Result<(), CryptographicError>
Sourcepub fn set_entropy_source(&mut self, source: EntropySource)
pub fn set_entropy_source(&mut self, source: EntropySource)
Set the preferred entropy source for key generation.
Sourcepub fn get_entropy_source(&self) -> Option<&EntropySource>
pub fn get_entropy_source(&self) -> Option<&EntropySource>
Get the currently selected entropy source, if any.
Sourcepub fn list_entropy_sources(&self) -> Vec<String>
pub fn list_entropy_sources(&self) -> Vec<String>
List the available entropy sources by name.
Sourcepub fn generate_key_data(
&mut self,
key_size: usize,
) -> Result<Vec<u8>, CryptographicError>
pub fn generate_key_data( &mut self, key_size: usize, ) -> Result<Vec<u8>, CryptographicError>
Generate random key data of the requested size using the selected
entropy source. For HardwareRNG, OSRandom, and Quantum (used as a
placeholder since a real quantum RNG is not available) the bytes are
filled with rand::random(). The generated material is also folded into
the quality metrics as a simple entropy estimate.
pub fn generate_key( &mut self, key_id: String, key_type: KeyType, algorithm: KeyAlgorithm, security_level: SecurityLevel, ) -> Result<Key, CryptographicError>
pub fn derive_public_key( &mut self, private_key: &Key, public_key_id: String, ) -> Result<Key, CryptographicError>
Auto Trait Implementations§
impl Freeze for KeyGenerator
impl RefUnwindSafe for KeyGenerator
impl Send for KeyGenerator
impl Sync for KeyGenerator
impl Unpin for KeyGenerator
impl UnsafeUnpin for KeyGenerator
impl UnwindSafe for KeyGenerator
Blanket Implementations§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
Aggregate shares in an MPC protocol.
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<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 more