pub struct ClientKey { /* private fields */ }
Available on crate feature
integer
only.Expand description
Key of the client
This struct contains the keys that are of interest to the user as they will allow to encrypt and decrypt data.
This key MUST NOT be sent to the server.
Implementations§
source§impl ClientKey
impl ClientKey
sourcepub fn generate_with_seed<C: Into<Config>>(config: C, seed: Seed) -> Self
pub fn generate_with_seed<C: Into<Config>>(config: C, seed: Seed) -> Self
Generates a key from a config and uses a seed.
Using the same seed between generations allows to regenerate the same key.
use bincode;
use tfhe::{ClientKey, ConfigBuilder, Seed};
let builder = ConfigBuilder::default();
let config = builder.build();
let cks1 = ClientKey::generate_with_seed(config.clone(), Seed(125));
let cks2 = ClientKey::generate(config.clone());
let cks3 = ClientKey::generate_with_seed(config.clone(), Seed(125));
// The keys created with the same seed are equal
assert_eq!(
bincode::serialize(&cks1).unwrap(),
bincode::serialize(&cks3).unwrap()
);
// Which is not the case for keys not created using the same seed
assert_ne!(
bincode::serialize(&cks1).unwrap(),
bincode::serialize(&cks2).unwrap()
);
pub fn into_raw_parts(self) -> (ClientKey, Option<WopbsParameters>)
pub fn from_raw_parts( key: ClientKey, wopbs_block_parameters: Option<WopbsParameters> ) -> Self
sourcepub fn generate_server_key(&self) -> ServerKey
pub fn generate_server_key(&self) -> ServerKey
Generates a new ServerKey
The ServerKey
generated is meant to be used to initialize the global state
using crate::high_level_api::set_server_key.
sourcepub fn generate_compressed_server_key(&self) -> CompressedServerKey
pub fn generate_compressed_server_key(&self) -> CompressedServerKey
Generates a new CompressedServerKey
Trait Implementations§
source§impl<'de> Deserialize<'de> for ClientKey
impl<'de> Deserialize<'de> for ClientKey
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl<Id, T> FheTryEncrypt<T, ClientKey> for CompressedFheInt<Id>
impl<Id, T> FheTryEncrypt<T, ClientKey> for CompressedFheInt<Id>
source§impl<Id, T> FheTryEncrypt<T, ClientKey> for CompressedFheUint<Id>
impl<Id, T> FheTryEncrypt<T, ClientKey> for CompressedFheUint<Id>
source§impl<Id, T> FheTryEncrypt<T, ClientKey> for FheInt<Id>
impl<Id, T> FheTryEncrypt<T, ClientKey> for FheInt<Id>
source§impl<Id, T> FheTryEncrypt<T, ClientKey> for FheUint<Id>
impl<Id, T> FheTryEncrypt<T, ClientKey> for FheUint<Id>
source§impl FheTryEncrypt<bool, ClientKey> for CompressedFheBool
impl FheTryEncrypt<bool, ClientKey> for CompressedFheBool
Auto Trait Implementations§
impl Freeze for ClientKey
impl RefUnwindSafe for ClientKey
impl Send for ClientKey
impl Sync for ClientKey
impl Unpin for ClientKey
impl UnwindSafe for ClientKey
Blanket Implementations§
source§impl<'short, T, Target> AsGeneralizedRef<'short, &'short Target> for T
impl<'short, T, Target> AsGeneralizedRef<'short, &'short Target> for T
fn as_generalized_ref(&'short self) -> &'short Target
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