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 tfhe::{ClientKey, ConfigBuilder, Seed};
let builder = ConfigBuilder::default();
let config = builder.build();
let cks1 = ClientKey::generate_with_seed(config, Seed(125));
let cks2 = ClientKey::generate(config);
let cks3 = ClientKey::generate_with_seed(config, 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 computation_parameters(&self) -> PBSParameters
pub fn into_raw_parts( self, ) -> (ClientKey, Option<(CompactPrivateKey<Vec<u64>>, ShortintKeySwitchingParameters)>, Option<CompressionPrivateKeys>, Tag)
pub fn from_raw_parts( key: ClientKey, dedicated_compact_private_key: Option<(CompactPrivateKey<Vec<u64>>, ShortintKeySwitchingParameters)>, compression_key: Option<CompressionPrivateKeys>, tag: Tag, ) -> 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<'a, Clear, Id> FheTryEncrypt<&'a [Clear], ClientKey> for CpuFheIntArray<Id>
impl<'a, Clear, Id> FheTryEncrypt<&'a [Clear], ClientKey> for CpuFheIntArray<Id>
Source§impl<'a, Clear, Id> FheTryEncrypt<&'a [Clear], ClientKey> for FheUintArray<Id>
impl<'a, Clear, Id> FheTryEncrypt<&'a [Clear], ClientKey> for FheUintArray<Id>
Source§impl<'a, Clear, Id> FheTryEncrypt<&'a [Clear], ClientKey> for GpuFheIntArray<Id>
Available on crate feature gpu only.
impl<'a, Clear, Id> FheTryEncrypt<&'a [Clear], ClientKey> for GpuFheIntArray<Id>
Available on crate feature
gpu only.Source§impl<'a, Clear, Id> FheTryEncrypt<&'a [Clear], ClientKey> for FheArrayBase<GpuOwned<CudaUnsignedRadixCiphertext>, Id>
Available on crate feature gpu only.
impl<'a, Clear, Id> FheTryEncrypt<&'a [Clear], ClientKey> for FheArrayBase<GpuOwned<CudaUnsignedRadixCiphertext>, Id>
Available on crate feature
gpu only.Source§impl<'a, Clear, Id> FheTryEncrypt<&'a [Clear], ClientKey> for FheArrayBase<InnerIntArray, Id>
impl<'a, Clear, Id> FheTryEncrypt<&'a [Clear], ClientKey> for FheArrayBase<InnerIntArray, Id>
Source§impl<'a, Clear, Id> FheTryEncrypt<&'a [Clear], ClientKey> for FheArrayBase<Vec<RadixCiphertext>, Id>
impl<'a, Clear, Id> FheTryEncrypt<&'a [Clear], ClientKey> for FheArrayBase<Vec<RadixCiphertext>, Id>
Source§impl FheTryEncrypt<&[bool], ClientKey> for CpuFheBoolArray
impl FheTryEncrypt<&[bool], ClientKey> for CpuFheBoolArray
Source§impl<'a> FheTryEncrypt<&'a [bool], ClientKey> for FheBoolArray
impl<'a> FheTryEncrypt<&'a [bool], ClientKey> for FheBoolArray
Source§impl FheTryEncrypt<&[bool], ClientKey> for GpuFheBoolArray
Available on crate feature gpu only.
impl FheTryEncrypt<&[bool], ClientKey> for GpuFheBoolArray
Available on crate feature
gpu only.Source§impl<'a, Clear, Id> FheTryEncrypt<(&'a [Clear], Vec<usize>), ClientKey> for FheUintArray<Id>
impl<'a, Clear, Id> FheTryEncrypt<(&'a [Clear], Vec<usize>), ClientKey> for FheUintArray<Id>
Source§impl<'a, Clear, Id> FheTryEncrypt<(&'a [Clear], Vec<usize>), ClientKey> for FheArrayBase<GpuOwned<CudaUnsignedRadixCiphertext>, Id>
Available on crate feature gpu only.
impl<'a, Clear, Id> FheTryEncrypt<(&'a [Clear], Vec<usize>), ClientKey> for FheArrayBase<GpuOwned<CudaUnsignedRadixCiphertext>, Id>
Available on crate feature
gpu only.Source§impl<'a, Clear, Id> FheTryEncrypt<(&'a [Clear], Vec<usize>), ClientKey> for FheArrayBase<Vec<RadixCiphertext>, Id>
impl<'a, Clear, Id> FheTryEncrypt<(&'a [Clear], Vec<usize>), ClientKey> for FheArrayBase<Vec<RadixCiphertext>, Id>
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
Source§impl Unversionize for ClientKeywhere
ClientKeyVersions: VersionsDispatch<Self>,
impl Unversionize for ClientKeywhere
ClientKeyVersions: VersionsDispatch<Self>,
Source§fn unversionize(
versioned: Self::VersionedOwned,
) -> Result<Self, UnversionizeError>
fn unversionize( versioned: Self::VersionedOwned, ) -> Result<Self, UnversionizeError>
Creates an object from a versioned enum, and eventually upgrades from previous
variants.
Source§impl UnversionizeVec for ClientKeywhere
ClientKeyVersions: VersionsDispatch<Self>,
impl UnversionizeVec for ClientKeywhere
ClientKeyVersions: VersionsDispatch<Self>,
fn unversionize_vec( versioned: Self::VersionedVec, ) -> Result<Vec<Self>, UnversionizeError>
Source§impl Upgrade<ClientKey> for ClientKeyV0
impl Upgrade<ClientKey> for ClientKeyV0
Source§impl Version for ClientKeywhere
IntegerClientKey: VersionizeOwned + Unversionize + Versionize,
Tag: VersionizeOwned + Unversionize + Versionize,
impl Version for ClientKeywhere
IntegerClientKey: VersionizeOwned + Unversionize + Versionize,
Tag: VersionizeOwned + Unversionize + Versionize,
Source§impl Versionize for ClientKeywhere
ClientKeyVersions: VersionsDispatch<Self>,
impl Versionize for ClientKeywhere
ClientKeyVersions: VersionsDispatch<Self>,
Source§type Versioned<'vers> = <ClientKeyVersions as VersionsDispatch<ClientKey>>::Ref<'vers>
type Versioned<'vers> = <ClientKeyVersions as VersionsDispatch<ClientKey>>::Ref<'vers>
The equivalent versioned type. It should have a variant for each version.
It may own the underlying data or only hold a read-only reference to it.
Source§fn versionize(&self) -> Self::Versioned<'_>
fn versionize(&self) -> Self::Versioned<'_>
Wraps the object into a versioned enum with a variant for each version. This will
use references on the underlying types if possible.
Source§impl VersionizeOwned for ClientKeywhere
ClientKeyVersions: VersionsDispatch<Self>,
impl VersionizeOwned for ClientKeywhere
ClientKeyVersions: VersionsDispatch<Self>,
type VersionedOwned = <ClientKeyVersions as VersionsDispatch<ClientKey>>::Owned
Source§fn versionize_owned(self) -> Self::VersionedOwned
fn versionize_owned(self) -> Self::VersionedOwned
Wraps the object into a versioned enum with a variant for each version. This will
clone the underlying types.
Source§impl VersionizeSlice for ClientKeywhere
ClientKeyVersions: VersionsDispatch<Self>,
impl VersionizeSlice for ClientKeywhere
ClientKeyVersions: VersionsDispatch<Self>,
type VersionedSlice<'vers> = Vec<<ClientKey as Versionize>::Versioned<'vers>>
fn versionize_slice(slice: &[Self]) -> Self::VersionedSlice<'_>
Source§impl VersionizeVec for ClientKeywhere
ClientKeyVersions: VersionsDispatch<Self>,
impl VersionizeVec for ClientKeywhere
ClientKeyVersions: VersionsDispatch<Self>,
type VersionedVec = Vec<<ClientKey as VersionizeOwned>::VersionedOwned>
fn versionize_vec(vec: Vec<Self>) -> Self::VersionedVec
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<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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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