Module functional_encryption

Module functional_encryption 

Source
Expand description

Functional Encryption (FE) primitives

Functional encryption allows a client with a secret key SK_f to learn f(x) from an encryption of x, without learning anything else about x. This is useful for privacy-preserving computation where you want to compute on encrypted data.

This module implements Inner Product Functional Encryption (IPFE), one of the most practical forms of FE, allowing computation of inner products over encrypted vectors.

§Example

use chie_crypto::functional_encryption::*;

// Setup master keys for vectors of length 3
let (msk, mpk) = ipfe_setup(3);

// Encrypt a vector [5, 10, 15]
let plaintext = vec![5, 10, 15];
let ciphertext = ipfe_encrypt(&mpk, &plaintext).unwrap();

// Generate a functional key for computing inner product with [1, 2, 3]
let func_vector = vec![1, 2, 3];
let func_key = ipfe_keygen(&msk, &func_vector).unwrap();

// Decrypt to get the inner product: 5*1 + 10*2 + 15*3 = 70
let result = ipfe_decrypt(&func_key, &ciphertext).unwrap();
assert_eq!(result, 70);

Structs§

IpfeCiphertext
Ciphertext for IPFE
IpfeFunctionalKey
Functional secret key for computing inner products
IpfeMasterPublicKey
Master public key for IPFE
IpfeMasterSecretKey
Master secret key for IPFE
MultiClientIpfe
Multi-client IPFE setup for privacy-preserving aggregation

Enums§

FunctionalEncryptionError
Functional encryption error types

Functions§

ipfe_decrypt
Decrypt a ciphertext using a functional key to compute the inner product
ipfe_encrypt
Encrypt a plaintext vector using the master public key
ipfe_keygen
Generate a functional secret key for computing inner product with a given vector
ipfe_setup
Generate master secret and public keys for IPFE

Type Aliases§

FunctionalEncryptionResult
Result type for functional encryption operations