MCFE — Multi-Client Functional Encryption¶
Multi-client functional encryption schemes.
- class pyfe4ai.schemes.mcfe.MCFE(config)[source]¶
Bases:
IPFEAbsCryptoCrypto operations for DDH-based multi-client inner-product FE.
- Parameters:
config (
dict)
- __init__(config)[source]¶
Initialise the MCFE crypto system.
- Parameters:
config (
dict) – Must containkeyswithpp(public parameters) and eithersk(encryption keys) ordk(decryption key).- Return type:
None
- encrypt(lst_pt, label)[source]¶
Encrypt a plaintext vector for one client under a label.
- Parameters:
- Return type:
- Returns:
Dict with
t(group element pair) andc(ciphertext list).- Raises:
FEKeyError – If public parameters or private keys are missing.
FEValidationError – If plaintext length or format is invalid.
- decrypt(dct_ct, dk, fusion_weight, label)[source]¶
Decrypt aggregated ciphertexts to recover the multi-client inner product.
- Parameters:
- Returns:
The inner product as an integer, or
Noneif out of bound.- Raises:
FEKeyError – If decryption key is missing.
FESchemeError – If inputs are inconsistent.
- encrypt_lst_ndarray(lst_ndarray, **kwargs)[source]¶
Encrypt a list of ndarrays element-wise with a label.
- decrypt_lst_ndarray_ct(dict_ndarray_ct, dk, fusion_weight, label)[source]¶
Decrypt ndarray ciphertexts from multiple clients.
- compute_lst_ndarray_ct(dict_ndarray_ct, **kwargs)[source]¶
Aggregate ndarray ciphertexts (delegates to
decrypt_lst_ndarray_ct()).
- class pyfe4ai.schemes.mcfe.MCFEKeyGenerator(config, **kwargs)[source]¶
Bases:
DDHKeyGeneratorBaseKey generator for DDH-based multi-client inner-product FE.
- Parameters:
config (
dict)
- __init__(config, **kwargs)[source]¶
Initialise the MCFE key generator.
- Parameters:
config (
dict) – Scheme configuration. Recognised keys:sec_param,eta(int or per-client dict),n(number of clients),s,lst_nid(client identifiers).- Return type:
None
- get_public_parameters()[source]¶
Return serialisable public parameters (g, p, n, eta, sec_param).
- Return type:
- Returns:
Dict of public parameters.
- get_decryption_keys(sid, **kwargs)[source]¶
Derive a functional decryption key for the given fusion weights.
- Parameters:
sid (
str) – Session identifier.**kwargs – Must include
credentialswithfusion_weight(dict mapping client IDs to weight lists).
- Return type:
- Returns:
Dict with
d(per-client keys) andz(aggregated secret).- Raises:
FEKeyError – If credentials are missing.
- pyfe4ai.schemes.mcfe.DMCFE¶
alias of
DecentralizedMCFE
- pyfe4ai.schemes.mcfe.DMCFEKeyGenerator¶
alias of
DecentralizedMCFEKeyGenerator
- class pyfe4ai.schemes.mcfe.DecentralizedMCFEFHMultiIPE(config, **kwargs)[source]¶
Bases:
IPFEAbsCryptoCrypto operations for decentralized function-hiding multi-client IPE over pairings.
- Parameters:
config (
dict)
- __init__(config, **kwargs)[source]¶
Perform the __init__ operation.
- Parameters:
config (
dict) – Scheme configuration dict.- Return type:
None
- decrypt(dct_ct, dk, fusion_weight, label)[source]¶
Decrypt ciphertexts and recover the inner product.
- class pyfe4ai.schemes.mcfe.DecentralizedMCFEFHMultiIPEKeyGenerator(config, **kwargs)[source]¶
Bases:
IPFEAbsKeyGenerator,ParameterCacheMixinKey generator for decentralized function-hiding multi-client IPE over pairings.
- Parameters:
config (
dict)
- __init__(config, **kwargs)[source]¶
Perform the __init__ operation.
- Parameters:
config (
dict) – Scheme configuration dict.- Return type:
None
- get_public_parameters()[source]¶
Return serialisable public parameters.
- Return type:
- Returns:
A dict of public parameters, or
Noneon error.
- pyfe4ai.schemes.mcfe.DMCFELWE¶
alias of
DecentralizedMCFELWE
- pyfe4ai.schemes.mcfe.DMCFELWEKeyGenerator¶
alias of
DecentralizedMCFELWEKeyGenerator
- pyfe4ai.schemes.mcfe.DMCFERingLWE¶
alias of
DecentralizedMCFERingLWE
- pyfe4ai.schemes.mcfe.DMCFERingLWEKeyGenerator¶
alias of
DecentralizedMCFERingLWEKeyGenerator
- class pyfe4ai.schemes.mcfe.MCFEPaillier(config, **kwargs)[source]¶
Bases:
IPFEAbsCryptoCrypto operations for Paillier-based multi-client inner-product FE.
- Parameters:
config (
dict)
- __init__(config, **kwargs)[source]¶
Perform the __init__ operation.
- Parameters:
config (
dict) – Scheme configuration dict.- Return type:
None
- decrypt(dct_ct, dk, fusion_weight, label)[source]¶
Decrypt ciphertexts and recover the inner product.
- class pyfe4ai.schemes.mcfe.MCFEPaillierKeyGenerator(config, **kwargs)[source]¶
Bases:
IPFEAbsKeyGenerator,ParameterCacheMixinKey generator for Paillier-based multi-client inner-product FE.
- Parameters:
config (
dict)
- __init__(config, **kwargs)[source]¶
Perform the __init__ operation.
- Parameters:
config (
dict) – Scheme configuration dict.- Return type:
None
- get_public_parameters()[source]¶
Return serialisable public parameters.
- Return type:
- Returns:
A dict of public parameters, or
Noneon error.
- class pyfe4ai.schemes.mcfe.DecentralizedMCFEPaillier(config, **kwargs)[source]¶
Bases:
IPFEAbsCryptoDecentralized Paillier MCFE: each client encrypts and derives functional decryption key shares locally. A combiner merges shares and decrypts the inner product.
- Protocol flow:
Each client i encrypts x_i under label ℓ.
Given a function vector y = (y_1, …, y_n), each client i locally computes a DK share from (s_i, u_i, v_i, y).
A combiner collects DK shares, aggregates, then decrypts ⟨x, y⟩ from the ciphertexts.
- Parameters:
config (
dict)
- scheme_type = 'dMCFE_PAILLIER'¶
- __init__(config, **kwargs)[source]¶
Perform the __init__ operation.
- Parameters:
config (
dict) – Scheme configuration dict.- Return type:
None
Derive this client’s DK share for the given function vector.
- Each client i computes:
dk0_i = sum_j s_i[j] * y_i[j] dk1_i = sum_j u_i[j] * y_i[j] + sum_k v_i[k] * y_flat[k]
where y_flat is the concatenation of y vectors for all clients in a fixed (sorted) order.
Aggregate per-client DK shares.
- Because sum_i v_i = 0, the correlated-noise terms cancel:
dk0 = {nid: dk0_nid} dk1 = sum_i dk1_i = sum_i (u_i · y_i)
- decrypt(dct_ct, dk, fusion_weight, label)[source]¶
Decrypt the inner product ⟨x, y⟩ from aggregated ciphertexts.
- class pyfe4ai.schemes.mcfe.DecentralizedMCFEPaillierKeyGenerator(config, **kwargs)[source]¶
Bases:
IPFEAbsKeyGenerator,ParameterCacheMixinKey generator for decentralized Paillier-based multi-client inner-product FE.
- Parameters:
config (
dict)
- __init__(config, **kwargs)[source]¶
Perform the __init__ operation.
- Parameters:
config (
dict) – Scheme configuration dict.- Return type:
None
- get_public_parameters()[source]¶
Return serialisable public parameters.
- Return type:
- Returns:
A dict of public parameters, or
Noneon error.
- pyfe4ai.schemes.mcfe.MCFEDamgardDDH¶
alias of
MCFEDamgard
- pyfe4ai.schemes.mcfe.MCFEDamgardDDHKeyGenerator¶
alias of
MCFEDamgardKeyGenerator
- class pyfe4ai.schemes.mcfe.MCFEFullySecLWE(config, **kwargs)[source]¶
Bases:
IPFEAbsCryptoCrypto operations for fully secure LWE-based multi-client inner-product FE.
- Parameters:
config (
dict)
- __init__(config, **kwargs)[source]¶
Perform the __init__ operation.
- Parameters:
config (
dict) – Scheme configuration dict.- Return type:
None
- decrypt(dct_ct, dk, fusion_weight, label)[source]¶
Decrypt ciphertexts and recover the inner product.
- class pyfe4ai.schemes.mcfe.MCFEFullySecLWEKeyGenerator(config, **kwargs)[source]¶
Bases:
IPFEAbsKeyGenerator,ParameterCacheMixinKey generator for fully secure LWE-based multi-client inner-product FE.
- Parameters:
config (
dict)
- __init__(config, **kwargs)[source]¶
Perform the __init__ operation.
- Parameters:
config (
dict) – Scheme configuration dict.- Return type:
None
- get_public_parameters()[source]¶
Return serialisable public parameters.
- Return type:
- Returns:
A dict of public parameters, or
Noneon error.
- class pyfe4ai.schemes.mcfe.MCFEFHMultiIPE(config, **kwargs)[source]¶
Bases:
IPFEAbsCryptoCrypto operations for function-hiding multi-client IPE over pairings.
- Parameters:
config (
dict)
- __init__(config, **kwargs)[source]¶
Perform the __init__ operation.
- Parameters:
config (
dict) – Scheme configuration dict.- Return type:
None
- decrypt(dct_ct, dk, fusion_weight, label)[source]¶
Decrypt ciphertexts and recover the inner product.
- class pyfe4ai.schemes.mcfe.MCFEFHMultiIPEKeyGenerator(config, **kwargs)[source]¶
Bases:
IPFEAbsKeyGenerator,ParameterCacheMixinKey generator for function-hiding multi-client IPE over pairings.
- Parameters:
config (
dict)
- __init__(config, **kwargs)[source]¶
Perform the __init__ operation.
- Parameters:
config (
dict) – Scheme configuration dict.- Return type:
None
- get_public_parameters()[source]¶
Return serialisable public parameters.
- Return type:
- Returns:
A dict of public parameters, or
Noneon error.
- class pyfe4ai.schemes.mcfe.ThresholdMCFEFHMultiIPE(config, **kwargs)[source]¶
Bases:
MCFEFHMultiIPECrypto operations for threshold function-hiding multi-client IPE over pairings.
- Parameters:
config (
dict)
- __init__(config, **kwargs)[source]¶
Perform the __init__ operation.
- Parameters:
config (
dict) – Scheme configuration dict.- Return type:
None
Compute a partial decryption share.
- class pyfe4ai.schemes.mcfe.ThresholdMCFEFHMultiIPEKeyGenerator(config, **kwargs)[source]¶
Bases:
MCFEFHMultiIPEKeyGeneratorKey generator for threshold function-hiding multi-client IPE over pairings.
- Parameters:
config (
dict)
- __init__(config, **kwargs)[source]¶
Perform the __init__ operation.
- Parameters:
config (
dict) – Scheme configuration dict.- Return type:
None
- class pyfe4ai.schemes.mcfe.MCFELWE(config, **kwargs)[source]¶
Bases:
IPFEAbsCryptoCrypto operations for LWE-based multi-client inner-product FE.
- Parameters:
config (
dict)
- __init__(config, **kwargs)[source]¶
Initialise the MCFE LWE crypto system.
- Parameters:
config (
dict) – Must containkeyswithpp(public parameters) and optionallysk(encryption keys).- Return type:
None
- encrypt(lst_pt, label)[source]¶
Encrypt a plaintext vector for one client under a label.
- Parameters:
- Return type:
- Returns:
Dict with
ct0andct1(serialised LWE ciphertext vectors).- Raises:
FEKeyError – If public parameters or encryption keys are missing.
FEValidationError – If plaintext length or values are invalid.
- decrypt(dct_ct, dk, fusion_weight, label)[source]¶
Decrypt aggregated ciphertexts to recover the multi-client inner product.
- Parameters:
- Returns:
The inner product as an integer.
- Raises:
FEKeyError – If decryption key is missing.
FEValidationError – If fusion weight length or values are invalid.
- encrypt_lst_ndarray(lst_ndarray, **kwargs)[source]¶
Encrypt a list of ndarrays element-wise with a label (requires
eta=1).
- compute_lst_ndarray_ct(dict_ndarray_ct, **kwargs)[source]¶
Aggregate ndarray ciphertexts (delegates to
decrypt_lst_ndarray_ct()).
- class pyfe4ai.schemes.mcfe.MCFELWEKeyGenerator(config, **kwargs)[source]¶
Bases:
IPFEAbsKeyGenerator,ParameterCacheMixinKey generator for LWE-based multi-client inner-product FE.
- Parameters:
config (
dict)
- __init__(config, **kwargs)[source]¶
Initialise the MCFE LWE key generator.
- Parameters:
config (
dict) – Scheme configuration. Recognised keys:sec_param,eta,n(number of clients),lwe_n,bound_x,bound_y,bound_u,label_modulus.- Return type:
None
- get_public_parameters()[source]¶
Return serialisable public parameters.
- Return type:
- Returns:
Dict containing
A,p,q,m,eta,n,lwe_n,bound_x,bound_y,bound_u,label_modulus,sec_param.
- get_decryption_keys(sid, **kwargs)[source]¶
Derive a functional decryption key for the given fusion weights.
- Parameters:
sid (
str) – Session identifier.**kwargs – Must include
credentialswithfusion_weight(dict mapping client IDs to weight lists).
- Return type:
- Returns:
Dict with
sk_y(per-client projected secret keys) andz(aggregated label masking secret).- Raises:
FEKeyError – If credentials are missing.
FEValidationError – If fusion weights are invalid or exceed
bound_y.
- class pyfe4ai.schemes.mcfe.MCFERingLWE(config, **kwargs)[source]¶
Bases:
IPFEAbsCryptoCrypto operations for Ring-LWE-based multi-client inner-product FE.
- Parameters:
config (
dict)
- __init__(config, **kwargs)[source]¶
Perform the __init__ operation.
- Parameters:
config (
dict) – Scheme configuration dict.- Return type:
None
- decrypt(dct_ct, dk, fusion_weight, label)[source]¶
Decrypt ciphertexts and recover the inner product.
- class pyfe4ai.schemes.mcfe.MCFERingLWEKeyGenerator(config, **kwargs)[source]¶
Bases:
IPFEAbsKeyGenerator,ParameterCacheMixinKey generator for Ring-LWE-based multi-client inner-product FE.
- Parameters:
config (
dict)
- __init__(config, **kwargs)[source]¶
Perform the __init__ operation.
- Parameters:
config (
dict) – Scheme configuration dict.- Return type:
None
- get_public_parameters()[source]¶
Return serialisable public parameters.
- Return type:
- Returns:
A dict of public parameters, or
Noneon error.
- class pyfe4ai.schemes.mcfe.ThresholdMCFE(config)[source]¶
Bases:
IPFEAbsCryptoCrypto operations for threshold DDH-based multi-client inner-product FE.
- Parameters:
config (
dict)
Compute a partial decryption share.
- compute_lst_ndarray_ct(dict_ndarray_ct, credentials, dk, lst_sid_enrolled)[source]¶
Compute inner products on encrypted ndarray ciphertexts.
- class pyfe4ai.schemes.mcfe.ThresholdMCFEKeyGenerator(config)[source]¶
Bases:
IPFEAbsKeyGenerator,ParameterCacheMixinKey generator for threshold DDH-based multi-client inner-product FE.
- Parameters:
config (
dict)
- get_public_parameters()[source]¶
Return serialisable public parameters.
- Return type:
- Returns:
A dict of public parameters, or
Noneon error.
- class pyfe4ai.schemes.mcfe.ThresholdMCFELWE(config, **kwargs)[source]¶
Bases:
MCFELWECrypto operations for threshold LWE-based multi-client inner-product FE.
- Parameters:
config (
dict)
- __init__(config, **kwargs)[source]¶
Perform the __init__ operation.
- Parameters:
config (
dict) – Scheme configuration dict.- Return type:
None
Compute a partial decryption share.
- compute_lst_ndarray_ct(dict_ndarray_ct, credentials, dk, lst_sid_enrolled)[source]¶
Compute inner products on encrypted ndarray ciphertexts.
- class pyfe4ai.schemes.mcfe.ThresholdMCFELWEKeyGenerator(config, **kwargs)[source]¶
Bases:
MCFELWEKeyGeneratorKey generator for threshold LWE-based multi-client inner-product FE.
- Parameters:
config (
dict)
- __init__(config, **kwargs)[source]¶
Perform the __init__ operation.
- Parameters:
config (
dict) – Scheme configuration dict.- Return type:
None
- class pyfe4ai.schemes.mcfe.ThresholdMCFERingLWE(config, **kwargs)[source]¶
Bases:
MCFERingLWECrypto operations for threshold Ring-LWE-based multi-client inner-product FE.
- Parameters:
config (
dict)
- __init__(config, **kwargs)[source]¶
Perform the __init__ operation.
- Parameters:
config (
dict) – Scheme configuration dict.- Return type:
None
Compute a partial decryption share.
- class pyfe4ai.schemes.mcfe.ThresholdMCFERingLWEKeyGenerator(config, **kwargs)[source]¶
Bases:
MCFERingLWEKeyGeneratorKey generator for threshold Ring-LWE-based multi-client inner-product FE.
- Parameters:
config (
dict)
- __init__(config, **kwargs)[source]¶
Perform the __init__ operation.
- Parameters:
config (
dict) – Scheme configuration dict.- Return type:
None
DDH¶
Chotard, Jérémy, Edouard Dufour Sans, Romain Gay, Duong Hieu Phan, and David Pointcheval. “Decentralized multi-client functional encryption for inner product.” In Advances in Cryptology ASIACRYPT 2018, Brisbane, QLD, Australia, December 2-6, pp. 703-732. Springer International Publishing, 2018.
setting: Integer based
- class pyfe4ai.schemes.mcfe.ddh.MCFEKeyGenerator(config, **kwargs)[source]¶
Bases:
DDHKeyGeneratorBaseKey generator for DDH-based multi-client inner-product FE.
- Parameters:
config (
dict)
- __init__(config, **kwargs)[source]¶
Initialise the MCFE key generator.
- Parameters:
config (
dict) – Scheme configuration. Recognised keys:sec_param,eta(int or per-client dict),n(number of clients),s,lst_nid(client identifiers).- Return type:
None
- get_public_parameters()[source]¶
Return serialisable public parameters (g, p, n, eta, sec_param).
- Return type:
- Returns:
Dict of public parameters.
- get_decryption_keys(sid, **kwargs)[source]¶
Derive a functional decryption key for the given fusion weights.
- Parameters:
sid (
str) – Session identifier.**kwargs – Must include
credentialswithfusion_weight(dict mapping client IDs to weight lists).
- Return type:
- Returns:
Dict with
d(per-client keys) andz(aggregated secret).- Raises:
FEKeyError – If credentials are missing.
- class pyfe4ai.schemes.mcfe.ddh.MCFE(config)[source]¶
Bases:
IPFEAbsCryptoCrypto operations for DDH-based multi-client inner-product FE.
- Parameters:
config (
dict)
- __init__(config)[source]¶
Initialise the MCFE crypto system.
- Parameters:
config (
dict) – Must containkeyswithpp(public parameters) and eithersk(encryption keys) ordk(decryption key).- Return type:
None
- encrypt(lst_pt, label)[source]¶
Encrypt a plaintext vector for one client under a label.
- Parameters:
- Return type:
- Returns:
Dict with
t(group element pair) andc(ciphertext list).- Raises:
FEKeyError – If public parameters or private keys are missing.
FEValidationError – If plaintext length or format is invalid.
- decrypt(dct_ct, dk, fusion_weight, label)[source]¶
Decrypt aggregated ciphertexts to recover the multi-client inner product.
- Parameters:
- Returns:
The inner product as an integer, or
Noneif out of bound.- Raises:
FEKeyError – If decryption key is missing.
FESchemeError – If inputs are inconsistent.
- encrypt_lst_ndarray(lst_ndarray, **kwargs)[source]¶
Encrypt a list of ndarrays element-wise with a label.
- decrypt_lst_ndarray_ct(dict_ndarray_ct, dk, fusion_weight, label)[source]¶
Decrypt ndarray ciphertexts from multiple clients.
- compute_lst_ndarray_ct(dict_ndarray_ct, **kwargs)[source]¶
Aggregate ndarray ciphertexts (delegates to
decrypt_lst_ndarray_ct()).
DDH Decentralized¶
Abdalla, Michel, Fabrice Benhamouda, Markulf Kohlweiss, and Hendrik Waldner. “Decentralizing inner-product functional encryption.” In IACR International Workshop on Public Key Cryptography, pp. 128-157. Cham: Springer International Publishing, 2019.
setting: Integer based
- class pyfe4ai.schemes.mcfe.ddh_decentralized.DecentralizedMCFEKeyGenerator(config, **kwargs)[source]¶
Bases:
DDHKeyGeneratorBaseKey generator for decentralized DDH-based multi-client inner-product FE.
- Parameters:
config (
dict)
- __init__(config, **kwargs)[source]¶
Perform the __init__ operation.
- Parameters:
config (
dict) – Scheme configuration dict.- Return type:
None
- get_public_parameters()[source]¶
Return serialisable public parameters.
- Return type:
- Returns:
A dict of public parameters, or
Noneon error.
- class pyfe4ai.schemes.mcfe.ddh_decentralized.DecentralizedMCFE(config)[source]¶
Bases:
IPFEAbsCryptoCrypto operations for decentralized DDH-based multi-client inner-product FE.
- Parameters:
config (
dict)
- decrypt(dct_ct, dk, fusion_weight, label)[source]¶
Decrypt ciphertexts and recover the inner product.
DDH Threshold¶
R. Xu et al., “TAPFed: Threshold Secure Aggregation for Privacy-Preserving Federated Learning,” in IEEE Transactions on Dependable and Secure Computing, doi: 10.1109/TDSC.2024.3350206.
type: public-key encryption
setting: Integer based
- class pyfe4ai.schemes.mcfe.ddh_threshold.ThresholdMCFEKeyGenerator(config)[source]¶
Bases:
IPFEAbsKeyGenerator,ParameterCacheMixinKey generator for threshold DDH-based multi-client inner-product FE.
- Parameters:
config (
dict)
- get_public_parameters()[source]¶
Return serialisable public parameters.
- Return type:
- Returns:
A dict of public parameters, or
Noneon error.
- class pyfe4ai.schemes.mcfe.ddh_threshold.ThresholdMCFE(config)[source]¶
Bases:
IPFEAbsCryptoCrypto operations for threshold DDH-based multi-client inner-product FE.
- Parameters:
config (
dict)
Compute a partial decryption share.
- compute_lst_ndarray_ct(dict_ndarray_ct, credentials, dk, lst_sid_enrolled)[source]¶
Compute inner products on encrypted ndarray ciphertexts.
Damgård DDH¶
Damgard/DDH-Based Multi-Client Inner-Product Functional Encryption | Multi-client label-aware structure inspired by | “Decentralized multi-client functional encryption for inner product” | By Jeremy Chotard, Edouard Dufour Sans, Romain Gay, Duong Hieu Phan, | David Pointcheval | Published in: ASIACRYPT 2018 | | Instantiated here with a Damgard/DDH-based inner-product FE building block | inspired by Agrawal, Libert, Stehle: | “Fully Secure Functional Encryption for Inner Products, from Standard | Assumptions” | Published in: CRYPTO 2016
type: public-key encryption
setting: Integer based
- note: research-oriented Python prototype aligned with the existing
crypto-ipfe API style
- class pyfe4ai.schemes.mcfe.damgard_ddh.MCFEDamgardKeyGenerator(config, **kwargs)[source]¶
Bases:
DamgardDDHKeyGeneratorBaseKey generator for Damgard DDH-based multi-client inner-product FE.
- Parameters:
config (
dict)
- __init__(config, **kwargs)[source]¶
Perform the __init__ operation.
- Parameters:
config (
dict) – Scheme configuration dict.- Return type:
None
- get_public_parameters()[source]¶
Return serialisable public parameters.
- Return type:
- Returns:
A dict of public parameters, or
Noneon error.
- class pyfe4ai.schemes.mcfe.damgard_ddh.MCFEDamgard(config, **kwargs)[source]¶
Bases:
IPFEAbsCryptoCrypto operations for Damgard DDH-based multi-client inner-product FE.
- Parameters:
config (
dict)
- __init__(config, **kwargs)[source]¶
Perform the __init__ operation.
- Parameters:
config (
dict) – Scheme configuration dict.- Return type:
None
- decrypt(dct_ct, dk, fusion_weight, label)[source]¶
Decrypt ciphertexts and recover the inner product.
LWE¶
LWE-Based Multi-Client Inner-Product Functional Encryption | Multi-client label-aware organization inspired by | “Decentralized multi-client functional encryption for inner product” | By Jeremy Chotard, Edouard Dufour Sans, Romain Gay, Duong Hieu Phan, | David Pointcheval | Published in: ASIACRYPT 2018 | | This prototype composes per-client simple LWE inner-product FE instances | using a bounded label embedding, with the underlying LWE line taken from | “Simple Functional Encryption Schemes for Inner Products” | By Michel Abdalla, Florian Bourse, Angelo De Caro, David Pointcheval | Published in: PKC 2015
type: public-key encryption
setting: Integer based
note: prototype implementation aligned with the existing crypto-ipfe API
- class pyfe4ai.schemes.mcfe.lwe.MCFELWEKeyGenerator(config, **kwargs)[source]¶
Bases:
IPFEAbsKeyGenerator,ParameterCacheMixinKey generator for LWE-based multi-client inner-product FE.
- Parameters:
config (
dict)
- __init__(config, **kwargs)[source]¶
Initialise the MCFE LWE key generator.
- Parameters:
config (
dict) – Scheme configuration. Recognised keys:sec_param,eta,n(number of clients),lwe_n,bound_x,bound_y,bound_u,label_modulus.- Return type:
None
- get_public_parameters()[source]¶
Return serialisable public parameters.
- Return type:
- Returns:
Dict containing
A,p,q,m,eta,n,lwe_n,bound_x,bound_y,bound_u,label_modulus,sec_param.
- get_decryption_keys(sid, **kwargs)[source]¶
Derive a functional decryption key for the given fusion weights.
- Parameters:
sid (
str) – Session identifier.**kwargs – Must include
credentialswithfusion_weight(dict mapping client IDs to weight lists).
- Return type:
- Returns:
Dict with
sk_y(per-client projected secret keys) andz(aggregated label masking secret).- Raises:
FEKeyError – If credentials are missing.
FEValidationError – If fusion weights are invalid or exceed
bound_y.
- class pyfe4ai.schemes.mcfe.lwe.MCFELWE(config, **kwargs)[source]¶
Bases:
IPFEAbsCryptoCrypto operations for LWE-based multi-client inner-product FE.
- Parameters:
config (
dict)
- __init__(config, **kwargs)[source]¶
Initialise the MCFE LWE crypto system.
- Parameters:
config (
dict) – Must containkeyswithpp(public parameters) and optionallysk(encryption keys).- Return type:
None
- encrypt(lst_pt, label)[source]¶
Encrypt a plaintext vector for one client under a label.
- Parameters:
- Return type:
- Returns:
Dict with
ct0andct1(serialised LWE ciphertext vectors).- Raises:
FEKeyError – If public parameters or encryption keys are missing.
FEValidationError – If plaintext length or values are invalid.
- decrypt(dct_ct, dk, fusion_weight, label)[source]¶
Decrypt aggregated ciphertexts to recover the multi-client inner product.
- Parameters:
- Returns:
The inner product as an integer.
- Raises:
FEKeyError – If decryption key is missing.
FEValidationError – If fusion weight length or values are invalid.
- encrypt_lst_ndarray(lst_ndarray, **kwargs)[source]¶
Encrypt a list of ndarrays element-wise with a label (requires
eta=1).
- compute_lst_ndarray_ct(dict_ndarray_ct, **kwargs)[source]¶
Aggregate ndarray ciphertexts (delegates to
decrypt_lst_ndarray_ct()).
Fully-Secure LWE¶
Fully Secure LWE-Based Multi-Client Inner-Product Functional Encryption | Multi-client label-aware organization inspired by | “Decentralized multi-client functional encryption for inner product” | By Jeremy Chotard, Edouard Dufour Sans, Romain Gay, Duong Hieu Phan, | David Pointcheval | Published in: ASIACRYPT 2018 | | Instantiated here with the fully secure LWE single-input line from | “Fully Secure Functional Encryption for Inner Products, | from Standard Assumptions” | By Shweta Agrawal, Benoit Libert, Damien Stehle | Published in: CRYPTO 2016
type: public-key encryption
setting: Integer based
note: research-oriented Python prototype aligned with the crypto-ipfe API
- class pyfe4ai.schemes.mcfe.fullysec_lwe.MCFEFullySecLWEKeyGenerator(config, **kwargs)[source]¶
Bases:
IPFEAbsKeyGenerator,ParameterCacheMixinKey generator for fully secure LWE-based multi-client inner-product FE.
- Parameters:
config (
dict)
- __init__(config, **kwargs)[source]¶
Perform the __init__ operation.
- Parameters:
config (
dict) – Scheme configuration dict.- Return type:
None
- get_public_parameters()[source]¶
Return serialisable public parameters.
- Return type:
- Returns:
A dict of public parameters, or
Noneon error.
- class pyfe4ai.schemes.mcfe.fullysec_lwe.MCFEFullySecLWE(config, **kwargs)[source]¶
Bases:
IPFEAbsCryptoCrypto operations for fully secure LWE-based multi-client inner-product FE.
- Parameters:
config (
dict)
- __init__(config, **kwargs)[source]¶
Perform the __init__ operation.
- Parameters:
config (
dict) – Scheme configuration dict.- Return type:
None
- decrypt(dct_ct, dk, fusion_weight, label)[source]¶
Decrypt ciphertexts and recover the inner product.
LWE Decentralized¶
Decentralized LWE-Based Multi-Client Inner-Product Functional Encryption | Decentralized key-share organization inspired by | “Decentralizing inner-product functional encryption” | By Michel Abdalla, Fabrice Benhamouda, Markulf Kohlweiss, Hendrik Waldner | Published in: PKC 2019 | | This prototype combines decentralized decryption-key-share derivation with | the LWE-based single-input inner-product FE line from | “Simple Functional Encryption Schemes for Inner Products” | By Michel Abdalla, Florian Bourse, Angelo De Caro, David Pointcheval | Published in: PKC 2015
type: public-key encryption
setting: Integer based
note: research prototype aligned with the existing crypto-ipfe API
- class pyfe4ai.schemes.mcfe.lwe_decentralized.DecentralizedMCFELWEKeyGenerator(config, **kwargs)[source]¶
Bases:
IPFEAbsKeyGenerator,ParameterCacheMixinKey generator for decentralized LWE-based multi-client inner-product FE.
- Parameters:
config (
dict)
- __init__(config, **kwargs)[source]¶
Perform the __init__ operation.
- Parameters:
config (
dict) – Scheme configuration dict.- Return type:
None
- get_public_parameters()[source]¶
Return serialisable public parameters.
- Return type:
- Returns:
A dict of public parameters, or
Noneon error.
- class pyfe4ai.schemes.mcfe.lwe_decentralized.DecentralizedMCFELWE(config, **kwargs)[source]¶
Bases:
IPFEAbsCryptoCrypto operations for decentralized LWE-based multi-client inner-product FE.
- Parameters:
config (
dict)
- __init__(config, **kwargs)[source]¶
Perform the __init__ operation.
- Parameters:
config (
dict) – Scheme configuration dict.- Return type:
None
- decrypt(dct_ct, dk, fusion_weight, label)[source]¶
Decrypt ciphertexts and recover the inner product.
LWE Threshold¶
Threshold LWE-Based Multi-Client Inner-Product Functional Encryption | Threshold secure aggregation organization inspired by | “TAPFed: Threshold Secure Aggregation for Privacy-Preserving Federated Learning” | Published in: IEEE TDSC | | This prototype combines threshold decryption-key sharing with the LWE-based | multi-client inner-product FE line used in this repository.
type: public-key encryption
setting: Integer based
note: research prototype aligned with the existing crypto-ipfe API
- class pyfe4ai.schemes.mcfe.lwe_threshold.ThresholdMCFELWEKeyGenerator(config, **kwargs)[source]¶
Bases:
MCFELWEKeyGeneratorKey generator for threshold LWE-based multi-client inner-product FE.
- Parameters:
config (
dict)
- __init__(config, **kwargs)[source]¶
Perform the __init__ operation.
- Parameters:
config (
dict) – Scheme configuration dict.- Return type:
None
- class pyfe4ai.schemes.mcfe.lwe_threshold.ThresholdMCFELWE(config, **kwargs)[source]¶
Bases:
MCFELWECrypto operations for threshold LWE-based multi-client inner-product FE.
- Parameters:
config (
dict)
- __init__(config, **kwargs)[source]¶
Perform the __init__ operation.
- Parameters:
config (
dict) – Scheme configuration dict.- Return type:
None
Compute a partial decryption share.
- compute_lst_ndarray_ct(dict_ndarray_ct, credentials, dk, lst_sid_enrolled)[source]¶
Compute inner products on encrypted ndarray ciphertexts.
Ring-LWE¶
Ring-LWE-Based Multi-Client Inner-Product Functional Encryption | Multi-client label-aware organization inspired by | “Decentralized multi-client functional encryption for inner product” | By Jeremy Chotard, Edouard Dufour Sans, Romain Gay, Duong Hieu Phan, | David Pointcheval | Published in: ASIACRYPT 2018 | | This prototype combines the repository’s MCFE API with the Ring-LWE | inner-product FE line from | “Efficient Lattice-Based Inner-Product Functional Encryption” | By Bermudo Mera, Karmakar, Marc, Soleimanian | ePrint: 2021/046
type: public-key encryption
setting: Integer based
note: research prototype with SIMD-style matrix encryption and labels
- class pyfe4ai.schemes.mcfe.ring_lwe.MCFERingLWEKeyGenerator(config, **kwargs)[source]¶
Bases:
IPFEAbsKeyGenerator,ParameterCacheMixinKey generator for Ring-LWE-based multi-client inner-product FE.
- Parameters:
config (
dict)
- __init__(config, **kwargs)[source]¶
Perform the __init__ operation.
- Parameters:
config (
dict) – Scheme configuration dict.- Return type:
None
- get_public_parameters()[source]¶
Return serialisable public parameters.
- Return type:
- Returns:
A dict of public parameters, or
Noneon error.
- class pyfe4ai.schemes.mcfe.ring_lwe.MCFERingLWE(config, **kwargs)[source]¶
Bases:
IPFEAbsCryptoCrypto operations for Ring-LWE-based multi-client inner-product FE.
- Parameters:
config (
dict)
- __init__(config, **kwargs)[source]¶
Perform the __init__ operation.
- Parameters:
config (
dict) – Scheme configuration dict.- Return type:
None
- decrypt(dct_ct, dk, fusion_weight, label)[source]¶
Decrypt ciphertexts and recover the inner product.
Ring-LWE Decentralized¶
Decentralized Ring-LWE-Based Multi-Client Inner-Product Functional Encryption | Decentralized key-share organization inspired by | “Decentralizing inner-product functional encryption” | By Michel Abdalla, Fabrice Benhamouda, Markulf Kohlweiss, Hendrik Waldner | Published in: PKC 2019 | | This prototype combines decentralized decryption-key-share derivation with | the Ring-LWE multi-client inner-product FE line used in this repository.
type: public-key encryption
setting: Integer based
note: research prototype aligned with the existing crypto-ipfe API
- class pyfe4ai.schemes.mcfe.ring_lwe_decentralized.DecentralizedMCFERingLWEKeyGenerator(config, **kwargs)[source]¶
Bases:
IPFEAbsKeyGenerator,ParameterCacheMixinKey generator for decentralized Ring-LWE-based multi-client inner-product FE.
- Parameters:
config (
dict)
- __init__(config, **kwargs)[source]¶
Perform the __init__ operation.
- Parameters:
config (
dict) – Scheme configuration dict.- Return type:
None
- get_public_parameters()[source]¶
Return serialisable public parameters.
- Return type:
- Returns:
A dict of public parameters, or
Noneon error.
- class pyfe4ai.schemes.mcfe.ring_lwe_decentralized.DecentralizedMCFERingLWE(config, **kwargs)[source]¶
Bases:
MCFERingLWECrypto operations for decentralized Ring-LWE-based multi-client inner-product FE.
- Parameters:
config (
dict)
Ring-LWE Threshold¶
Threshold Ring-LWE-Based Multi-Client Inner-Product Functional Encryption | Threshold secure aggregation organization inspired by | “TAPFed: Threshold Secure Aggregation for Privacy-Preserving Federated Learning” | Published in: IEEE TDSC | | This prototype combines threshold decryption-key sharing with the Ring-LWE | multi-client inner-product FE line used in this repository.
type: public-key encryption
setting: Integer based
note: research prototype aligned with the existing crypto-ipfe API
- class pyfe4ai.schemes.mcfe.ring_lwe_threshold.ThresholdMCFERingLWEKeyGenerator(config, **kwargs)[source]¶
Bases:
MCFERingLWEKeyGeneratorKey generator for threshold Ring-LWE-based multi-client inner-product FE.
- Parameters:
config (
dict)
- __init__(config, **kwargs)[source]¶
Perform the __init__ operation.
- Parameters:
config (
dict) – Scheme configuration dict.- Return type:
None
- class pyfe4ai.schemes.mcfe.ring_lwe_threshold.ThresholdMCFERingLWE(config, **kwargs)[source]¶
Bases:
MCFERingLWECrypto operations for threshold Ring-LWE-based multi-client inner-product FE.
- Parameters:
config (
dict)
- __init__(config, **kwargs)[source]¶
Perform the __init__ operation.
- Parameters:
config (
dict) – Scheme configuration dict.- Return type:
None
Compute a partial decryption share.
Paillier¶
Paillier-Based Multi-Client Inner-Product Functional Encryption | Multi-client label-aware structure inspired by | “Decentralized multi-client functional encryption for inner product” | By Jeremy Chotard, Edouard Dufour Sans, Romain Gay, Duong Hieu Phan, | David Pointcheval | Published in: ASIACRYPT 2018 | | Instantiated here with a Paillier-based inner-product FE building block | inspired by Agrawal, Libert, Stehle: | “Fully Secure Functional Encryption for Inner Products, from Standard | Assumptions” | Published in: CRYPTO 2016
type: public-key encryption
setting: Integer based
- note: research-oriented Python prototype aligned with the existing
crypto-ipfe API style
- class pyfe4ai.schemes.mcfe.paillier.MCFEPaillierKeyGenerator(config, **kwargs)[source]¶
Bases:
IPFEAbsKeyGenerator,ParameterCacheMixinKey generator for Paillier-based multi-client inner-product FE.
- Parameters:
config (
dict)
- __init__(config, **kwargs)[source]¶
Perform the __init__ operation.
- Parameters:
config (
dict) – Scheme configuration dict.- Return type:
None
- get_public_parameters()[source]¶
Return serialisable public parameters.
- Return type:
- Returns:
A dict of public parameters, or
Noneon error.
- class pyfe4ai.schemes.mcfe.paillier.MCFEPaillier(config, **kwargs)[source]¶
Bases:
IPFEAbsCryptoCrypto operations for Paillier-based multi-client inner-product FE.
- Parameters:
config (
dict)
- __init__(config, **kwargs)[source]¶
Perform the __init__ operation.
- Parameters:
config (
dict) – Scheme configuration dict.- Return type:
None
- decrypt(dct_ct, dk, fusion_weight, label)[source]¶
Decrypt ciphertexts and recover the inner product.
Paillier Decentralized¶
Decentralized Paillier-Based Multi-Client Inner-Product Functional Encryption
This module is a research-oriented Python prototype — not a verbatim transcription of any single paper. The design draws on two main references:
Decentralized DK-share derivation pattern (correlated-noise v-shares with sum_i v_i = 0, label-masked encryption, per-client local DK computation): Inspired by — Abdalla, Benhamouda, Kohlweiss, Waldner, “Decentralizing Inner-Product Functional Encryption”, PKC 2019.
Paillier-based inner-product FE building block (Paillier encryption with homomorphic aggregation, L-function extraction): Inspired by — Agrawal, Libert, Stehlé, “Fully Secure Functional Encryption for Inner Products, from Standard Assumptions”, CRYPTO 2016.
Key simplifications relative to the papers:
Trusted setup (a single party samples all client secrets) rather than the interactive DKG protocol described in the PKC 2019 compiler.
Label masking uses SHA-256 hashed to a scalar (
md5_hashalias), not the paper’s random-oracle-based PRF family.Paillier generator selection follows a simplified safe-prime pipeline rather than the full CRS generation of the CRYPTO 2016 scheme.
No formal simulation-based security proof accompanies this code; correctness has been verified via unit tests only.
type: public-key encryption
setting: Integer based
- class pyfe4ai.schemes.mcfe.paillier_decentralized.DecentralizedMCFEPaillierKeyGenerator(config, **kwargs)[source]¶
Bases:
IPFEAbsKeyGenerator,ParameterCacheMixinKey generator for decentralized Paillier-based multi-client inner-product FE.
- Parameters:
config (
dict)
- __init__(config, **kwargs)[source]¶
Perform the __init__ operation.
- Parameters:
config (
dict) – Scheme configuration dict.- Return type:
None
- get_public_parameters()[source]¶
Return serialisable public parameters.
- Return type:
- Returns:
A dict of public parameters, or
Noneon error.
- class pyfe4ai.schemes.mcfe.paillier_decentralized.DecentralizedMCFEPaillier(config, **kwargs)[source]¶
Bases:
IPFEAbsCryptoDecentralized Paillier MCFE: each client encrypts and derives functional decryption key shares locally. A combiner merges shares and decrypts the inner product.
- Protocol flow:
Each client i encrypts x_i under label ℓ.
Given a function vector y = (y_1, …, y_n), each client i locally computes a DK share from (s_i, u_i, v_i, y).
A combiner collects DK shares, aggregates, then decrypts ⟨x, y⟩ from the ciphertexts.
- Parameters:
config (
dict)
- scheme_type = 'dMCFE_PAILLIER'¶
- __init__(config, **kwargs)[source]¶
Perform the __init__ operation.
- Parameters:
config (
dict) – Scheme configuration dict.- Return type:
None
Derive this client’s DK share for the given function vector.
- Each client i computes:
dk0_i = sum_j s_i[j] * y_i[j] dk1_i = sum_j u_i[j] * y_i[j] + sum_k v_i[k] * y_flat[k]
where y_flat is the concatenation of y vectors for all clients in a fixed (sorted) order.
Aggregate per-client DK shares.
- Because sum_i v_i = 0, the correlated-noise terms cancel:
dk0 = {nid: dk0_nid} dk1 = sum_i dk1_i = sum_i (u_i · y_i)
- decrypt(dct_ct, dk, fusion_weight, label)[source]¶
Decrypt the inner product ⟨x, y⟩ from aggregated ciphertexts.
FH-Multi-IPE (Pairing)¶
Function-Hiding Multi-Client Inner-Product Encryption over Pairings | Multi-client label-aware structure inspired by | “Decentralized multi-client functional encryption for inner product” | By Jeremy Chotard, Edouard Dufour Sans, Romain Gay, Duong Hieu Phan, | David Pointcheval | Published in: ASIACRYPT 2018 | | Instantiated here with a function-hiding multi-input inner-product FE | building block based on | “Full-Hiding (Unbounded) Multi-Input Inner Product Functional Encryption | from the k-Linear Assumption” | By Palash Datta, Tatsuaki Okamoto, Jun Tomida | See ePrint 2018/061
type: public-key encryption
setting: Pairing based
- note: research-oriented Python prototype aligned with the existing
crypto-ipfe API style
- class pyfe4ai.schemes.mcfe.fh_multi_ipe_pairing.MCFEFHMultiIPEKeyGenerator(config, **kwargs)[source]¶
Bases:
IPFEAbsKeyGenerator,ParameterCacheMixinKey generator for function-hiding multi-client IPE over pairings.
- Parameters:
config (
dict)
- __init__(config, **kwargs)[source]¶
Perform the __init__ operation.
- Parameters:
config (
dict) – Scheme configuration dict.- Return type:
None
- get_public_parameters()[source]¶
Return serialisable public parameters.
- Return type:
- Returns:
A dict of public parameters, or
Noneon error.
- class pyfe4ai.schemes.mcfe.fh_multi_ipe_pairing.MCFEFHMultiIPE(config, **kwargs)[source]¶
Bases:
IPFEAbsCryptoCrypto operations for function-hiding multi-client IPE over pairings.
- Parameters:
config (
dict)
- __init__(config, **kwargs)[source]¶
Perform the __init__ operation.
- Parameters:
config (
dict) – Scheme configuration dict.- Return type:
None
- decrypt(dct_ct, dk, fusion_weight, label)[source]¶
Decrypt ciphertexts and recover the inner product.
FH-Multi-IPE Decentralized (Pairing)¶
Decentralized Function-Hiding Multi-Client Inner-Product Encryption over Pairings | Decentralized key-share organization inspired by | “Decentralizing inner-product functional encryption” | By Michel Abdalla, Fabrice Benhamouda, Markulf Kohlweiss, Hendrik Waldner | Published in: PKC 2019 | | This prototype combines decentralized function-key-share derivation with the | repository’s MCFE FHMultiIPE line. The outer label correction is distributed | across clients via additive padding shares, while each client locally derives | its own pairing-based FHMultiIPE inner key share.
type: public-key encryption
setting: Pairing based
note: research prototype aligned with the existing crypto-ipfe API
- class pyfe4ai.schemes.mcfe.fh_multi_ipe_pairing_decentralized.DecentralizedMCFEFHMultiIPEKeyGenerator(config, **kwargs)[source]¶
Bases:
IPFEAbsKeyGenerator,ParameterCacheMixinKey generator for decentralized function-hiding multi-client IPE over pairings.
- Parameters:
config (
dict)
- __init__(config, **kwargs)[source]¶
Perform the __init__ operation.
- Parameters:
config (
dict) – Scheme configuration dict.- Return type:
None
- get_public_parameters()[source]¶
Return serialisable public parameters.
- Return type:
- Returns:
A dict of public parameters, or
Noneon error.
- class pyfe4ai.schemes.mcfe.fh_multi_ipe_pairing_decentralized.DecentralizedMCFEFHMultiIPE(config, **kwargs)[source]¶
Bases:
IPFEAbsCryptoCrypto operations for decentralized function-hiding multi-client IPE over pairings.
- Parameters:
config (
dict)
- __init__(config, **kwargs)[source]¶
Perform the __init__ operation.
- Parameters:
config (
dict) – Scheme configuration dict.- Return type:
None
- decrypt(dct_ct, dk, fusion_weight, label)[source]¶
Decrypt ciphertexts and recover the inner product.
FH-Multi-IPE Threshold (Pairing)¶
Threshold Function-Hiding Multi-Client Inner-Product Encryption over Pairings | Threshold secure aggregation organization inspired by | “TAPFed: Threshold Secure Aggregation for Privacy-Preserving Federated Learning” | | This prototype combines threshold sharing of the label-correction term with | the pairing-based MCFE FHMultiIPE line used in this repository.
type: public-key encryption
setting: Pairing based
- note: research prototype aligned with the existing crypto-ipfe API
The current threshold layer shares the label-correction component, while reusing the full FHMultiIPE inner decryption key per server.
- class pyfe4ai.schemes.mcfe.fh_multi_ipe_pairing_threshold.ThresholdMCFEFHMultiIPEKeyGenerator(config, **kwargs)[source]¶
Bases:
MCFEFHMultiIPEKeyGeneratorKey generator for threshold function-hiding multi-client IPE over pairings.
- Parameters:
config (
dict)
- __init__(config, **kwargs)[source]¶
Perform the __init__ operation.
- Parameters:
config (
dict) – Scheme configuration dict.- Return type:
None
- class pyfe4ai.schemes.mcfe.fh_multi_ipe_pairing_threshold.ThresholdMCFEFHMultiIPE(config, **kwargs)[source]¶
Bases:
MCFEFHMultiIPECrypto operations for threshold function-hiding multi-client IPE over pairings.
- Parameters:
config (
dict)
- __init__(config, **kwargs)[source]¶
Perform the __init__ operation.
- Parameters:
config (
dict) – Scheme configuration dict.- Return type:
None
Compute a partial decryption share.