pub struct KeyGenerator { /* private fields */ }Expand description
Key generator
Implementations§
Source§impl KeyGenerator
impl KeyGenerator
Sourcepub fn initialize(&mut self) -> Result<(), CryptographicError>
pub fn initialize(&mut self) -> Result<(), CryptographicError>
Populates the generation-algorithm registry; CryptographicError propagates.
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 OSRandom the bytes are drawn from the OS CSPRNG (rand::random()).
For HardwareRNG and Quantum, the generator fails closed honestly when physical
hardware entropy devices are unattached, preventing security illusions.
Sourcepub fn generate_key(
&mut self,
key_id: String,
key_type: KeyType,
algorithm: KeyAlgorithm,
security_level: SecurityLevel,
) -> Result<Key, CryptographicError>
pub fn generate_key( &mut self, key_id: String, key_type: KeyType, algorithm: KeyAlgorithm, security_level: SecurityLevel, ) -> Result<Key, CryptographicError>
Generates a Key under algorithm at security_level; UnsupportedAlgorithm when unregistered.
Sourcepub fn derive_public_key(
&mut self,
private_key: &Key,
public_key_id: String,
) -> Result<Key, CryptographicError>
pub fn derive_public_key( &mut self, private_key: &Key, public_key_id: String, ) -> Result<Key, CryptographicError>
Derives the public key from private_key.
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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