Struct KeyGenerator

Source
pub struct KeyGenerator<SGen, SC, P> { /* private fields */ }

Implementations§

Source§

impl<SGen: SymKeyGenWrapper, SC: SymKeyComposerWrapper, P: PkFromUserKeyWrapper> KeyGenerator<SGen, SC, P>

Source

pub fn done_fetch_sym_key( master_key: &impl SymKeyWrapper, server_out: &str, non_registered: bool, ) -> Result<SC::SymmetricKeyWrapper, SdkError>

§Get the key from server fetch

Decrypted the server output with the master key

Source

pub fn done_fetch_sym_key_by_private_key( private_key: &impl SkWrapper, server_out: &str, non_registered: bool, ) -> Result<SC::SymmetricKeyWrapper, SdkError>

§Get the key from server fetch

decrypt it with the private key

Source

pub fn decrypt_sym_key( master_key: &impl SymKeyWrapper, encrypted_symmetric_key_info: &GeneratedSymKeyHeadServerOutput, ) -> Result<SC::SymmetricKeyWrapper, SdkError>

§Get a symmetric key which was encrypted by a master key

Backwards the process in prepare_register_sym_key.

  1. get the bytes of the encrypted symmetric key
  2. get the sym internal format by decrypting it with the master key
  3. return the key incl. key id in the right format
Source

pub fn decrypt_sym_key_by_private_key( private_key: &impl SkWrapper, encrypted_symmetric_key_info: &GeneratedSymKeyHeadServerOutput, ) -> Result<SC::SymmetricKeyWrapper, SdkError>

§Get a symmetric key which was encrypted by a public key
Source

pub fn generate_non_register_sym_key( master_key: &impl SymKeyWrapper, ) -> Result<(SGen::SymmetricKeyWrapper, GeneratedSymKeyHeadServerOutput), SdkError>

§Simulates the server key output

This is used when the keys are not managed by the sentclose server.

First call prepare_register_sym_key_internally to encrypt the key, then decrypt_sym_key_internally to get the raw key.

Return both, the decrypted to use it, the encrypted to save it and use it for the next time with decrypt_sym_key_internally

Source

pub fn generate_non_register_sym_key_by_public_key( reply_public_key: &UserPublicKeyData, ) -> Result<(SGen::SymmetricKeyWrapper, GeneratedSymKeyHeadServerOutput), SdkError>

Auto Trait Implementations§

§

impl<SGen, SC, P> Freeze for KeyGenerator<SGen, SC, P>

§

impl<SGen, SC, P> RefUnwindSafe for KeyGenerator<SGen, SC, P>

§

impl<SGen, SC, P> Send for KeyGenerator<SGen, SC, P>
where SGen: Send, SC: Send, P: Send,

§

impl<SGen, SC, P> Sync for KeyGenerator<SGen, SC, P>
where SGen: Sync, SC: Sync, P: Sync,

§

impl<SGen, SC, P> Unpin for KeyGenerator<SGen, SC, P>
where SGen: Unpin, SC: Unpin, P: Unpin,

§

impl<SGen, SC, P> UnwindSafe for KeyGenerator<SGen, SC, P>
where SGen: UnwindSafe, SC: UnwindSafe, P: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.