Repository navigation
v0.3.0
Privacy fixes: every scheme that was insecure in v0.2.0 now implements a
published construction (four threshold variants add an experimental
threshold layer of our own on top of one, and dMCFE-DDH an experimental
carry mask), and every scheme carries a
review status. Keys, ciphertexts and partial decryptions of the affected
schemes are not compatible with v0.2.0. Read the README Scheme Status
table and Known Issues before relying on any privacy property.
Security
- MCFE-Paillier implements ABMPSW20 (Abdalla et al., SCN 2020) Fig. 3:
c = (1 + N)^x H(l)^s mod N^2with a full-domain hash intoZ_{N^2}^*,
s ~ D_{Z,sigma}withsigma > sqrt(kappa + 2n log2(2X)) N^{5/2}, and the
single aggregated keysum y s. Previously a single ciphertext revealed a
client's<x_i, y_i>to the key holder, and keys were brute-forceable. - MCFE-LWE / MCFE-FullySec-LWE implement ABMPSW20 Fig. 4
(c = round_q0(Z . H(l) + floor(q/K) x), aggregated keysum y Z) with
parameters derived from the Appendix C.3 constraints (selective and
adaptive choice ofm0respectively). Previously the key holder learned
x_i mod landx_iup to a few candidates. - MCFE-Damgard implements ABMPSW20 Fig. 2 (
D_k-MDDH,k = mddh_k,
default 1, where it coincides with CDGPP18). Previously two ciphertexts of
one client under two labels revealed its plaintexts. - tMCFE-DDH is CDGPP18 with the aggregated key Shamir-shared over
Z_q;
anytservers interpolate[H(l)]^din the exponent. Previously the
combiner could strip each client's MD5-scalar label mask. - tMCFE-LWE is ABMPSW20 Fig. 4 with a Shamir-shared key and
noise-flooded partial decryptions (each is an LWE sample under the
server's share instead of an exact linear function of it). The noise is
derived from a per-server secret, the label and the server's Lagrange
coefficient for the enrolled set, so repeated requests cannot be
averaged. The threshold layer is our own, so the
scheme's status is experimental. - Paillier parameter caches (SIFE, MIFE, MCFE, dMCFE) no longer store
the primesp, q: the factorization decrypts SIFE ciphertexts directly
and MCFE ciphertexts from two labels. Caches written by earlier versions
are regenerated with a freshN. - Labels: ndarray element labels were plain JSON strings, so a chosen
user label could reproduce an element's label (two ciphertexts under one
label leakx - x'); user and element labels are now hashed in disjoint
domains (pyfe4ai.schemes.mcfe.labels). - Threshold key shares record a digest of their fusion weights and servers
refuse ciphertexts presented under other weights. - SIFE-Paillier samples keys from
D_{Z,sigma},sigma > sqrt(kappa) N^{5/2}(ALS16); keys used to be drawn from a range small enough to
brute-force from the public key. - MIFE Damgard, Paillier, LWE, FullySec-LWE and Ring-LWE follow
ACFGU18 (CRYPTO 2018) Fig. 4: each slot encryptsx_i + u_i mod Lunder
its single-input IPFE with a one-time padu_i, the functional key adds
z = sum <u_i, y_i>, and decryption decodes only the sum (ALS16 Figs. 7, 9
and 8, ABDP15, and BMMS21 Sec. 6 as the per-slot IPFEs). Previously the
key holder learned every client's<x_i, y_i>. MIFE-Paillier keys are
Gaussian (they used to be brute-forceable). - tMIFE-LWE Shamir-shares the padded MIFE-LWE key and floods each
partial decryption withD_{Z, 2^kappa B}(Bbounds the decryption
noise;qenlarged), derandomised per request (experimental). - dMCFE-DDH, dMCFE-LWE, dMCFE-Paillier follow ABMPSW20 App. D.1, Fig. 14
(DMCFE from MCFE): encryption and decryption are those of the reviewed
MCFE, and each client publishes an MCFE2 (DCR, Fig. 3) encryption of its
key contribution under the labelH(y); zero-sum MCFE2 keys make the
shares combine to exactly the MCFE1 functional key. Previously the
combiner could strip each client's label mask, and dMCFE-Paillier keys
were brute-forceable. - MCFE-Ring-LWE implements BMMS21 (PKC 2022) Sec. 6, the
identity-based MCFE-compiler: clients encryptx_i + u_i + H(u'_i, l)and
the key for(y, l)carries the label's pad term, so keys are bound to a
label. dMCFE-Ring-LWE follows BMMS21's identity-based DMCFE (ABKW19 +
GDSum, realised with pairwise PRF zero-sum masks). tMCFE-Ring-LWE
Shamir-shares the identity-based key and floods partial decryptions
(experimental). Previously all three masked inputs with a small public
label scalar. - FH-MCFE implements AGT21b (TCC 2021) Sec. 6.2 as recapped in NPS24
(IACR CiC 2024) Sec. 2: one function-hiding IPFE per client
(pyfe4ai.schemes.mcfe.fh_ipe, ACFGU18 Fig. 12 withn = 1and LV16
padding), ciphertexts carryH1(tag)and every functional key embeds a
fresh zero sharing. dMCFE-FH-Multi-IPE implements NPS24 Fig. 1
(selective FH-DMCFE): the zero sharing lives in the encryption keys and
each client derives its own key from an explicittag-fand its own
weights (H2(tag-f)), deterministically, one key per client andtag-f.
tMCFE-FH-Multi-IPE Shamir-shares the FH-MCFE key exponents (servers
hold their shares as group elements); partial decryptions are combined in
G_T(experimental). Previously all three masked inputs with a public label
scalar and ran over the symmetric groupSS512, where SXDH fails; the
family now defaults toMNT224and rejects symmetric groups. - All pairing-based schemes (SIFE FH-IPE and partial FH-IPE, MIFE
FH-IPE and FH-Multi-IPE, quadratic Quad, SGP and MIQFE, the FH-MCFE
family) default to the asymmetric groupMNT224instead of the symmetric
SS512and reject symmetric groups: their constructions assume SXDH or a
generic asymmetric bilinear group, and DDH is easy in a symmetric one. - Review of the remaining schemes against their papers:
- SIFE-DDH, SIFE-DDH-Dynamic and MIFE-DDH published ciphertext components
as the integer product of two residues modp; trial division (or
factoring) recovered the plaintext from the ciphertext alone. Every
element is now reduced modp, and keys modq(a key with a large
weight used to reveal the master secret / the MIFE pads). - SIFE partial-FH-IPE (Gay20 Fig. 8) handed the master secret key
(b, U, V)to every encryptor, so any client decrypted everything and
recovered every key's weights.get_private_keysnow returnsNoneand
Enc'is run by the key generator (sec_encrypt). The default subspace
dimension equalledeta(a squareMrevealsV); it is now 1 (see
below) andMis resampled until it has full rank. - SIFE FH-IPE (KLMMRW18) had no privacy for
eta = 1(B* = 1) and let
anyone recognise zero vectors; vectors are now padded to(x, 1, 0),
(y, 0, 1). - MIFE FH-IPE ran independent per-slot instances and decoded every slot,
revealing each<x_i, y_i>and allowing slot keys of different
functional keys to be recombined; it now implements ACFGU18 Fig. 12. - MIFE in federated learning: MIFE has no labels, so one functional key
combines any ciphertexts of a client and reveals differences between
its values.encrypt_gradient/aggregate_gradientsrefuse MIFE
schemes (use MCFE). - tMIFE-DDH is rebuilt on MIFE-DDH with the functional key Shamir-shared
modq(as tMCFE-DDH); key shares are bound to their weights. - Quadratic Quad now implements Gay20 Fig. 4 (it encrypted
x (x) ywith
an IPFE before): ciphertexts of4n + 2m + 4G1 andmG2 elements. - Gaussian samples wider than
2^40(FullySec-LWE keys and noise) were
rounded doubles whose low bits were all zero; they now use the
arbitrary-precision sampler. - charm serialises the identity of G1 into a point outside the group;
pyfe4ai.utils.pairing_backend.PairingGroupwrites it explicitly.
- SIFE-DDH, SIFE-DDH-Dynamic and MIFE-DDH published ciphertext components
- Independent verification of the rebuilt schemes found:
- Function-hiding keys (FH-MCFE, FH-DMCFE, tMCFE-FH, MIFE FH-IPE)
carriedweights_id, an unsalted SHA-256 ofy: any key holder could
brute-forceyand link keys for the same function. Keys now carry a
randomkey_id(FH-DMCFE shares onlytag_f); decryption no longer
needs or checksy, and threshold servers do not need it either.
Clients receive their slot key without the outerA'(only key
generation uses it). - SIFE partial-FH-IPE keys reveal
M^T y, which for small
eta - subspace_dimusually determines a bounded integery; the
defaultsubspace_dimis now 1 and the leakage is documented. - tMIFE-DDH applied key shares to unchecked ciphertext elements: an
element outside the order-q subgroup leaked one bit of a server's share
through the Legendre symbol. Servers (and MIFE-DDH decryption) now
require subgroup elements. All threshold servers refuse a key share
issued to another server.
- Function-hiding keys (FH-MCFE, FH-DMCFE, tMCFE-FH, MIFE FH-IPE)
- DOT18 and DSGPP18 reviews:
- Quadratic SGP handed the master secret key
(s, t)to every encryptor;
as in DSGPP18 Fig. 2 the public key is now(g1^s, g2^t), encryption
uses it only andget_private_keysreturnsNone. Floats were
truncated silently; inputs are validated. - MIFE FH-Multi-IPE (DOT18 Sec. 3.1) produced deterministic keys for
n = 1withk = 1; it now requiresn >= 2,k >= 1and
len(lst_nid) == n, checks that every slot is present, and its
decryption helpers no longer ask fory. - Quadratic MI-SGP had no published basis (per-client copies of SGP): the
key holder learned every client'sx_i^T F_i y_iand could mix sub-keys.
It is replaced byquadratic/miqfe, the MIFE for quadratic functions of
Agrawal, Goyal, Tomida (TCC 2022, Sec. 5): per-user encryption keys made
of master ciphertexts (a corrupted user learns its own key, not the master
secret), function
classsum_{i<k} c[(i,j,k,l)] x_i[j] x_k[l](cross-user terms), built from
the TAO20 FH-IPFE and the paper's SK-MCFE schemes (Figs. 1 and 9).
- Quadratic SGP handed the master secret key
- SIFE-Paillier and MIFE-Paillier decryption returned whatever the
decryption equation produced. The ciphertextct0 = 1 + N,ct1 = 1
turnsct0^{-k}into-k mod N, so anyone shown the output of a
decryption (e.g. an inference client) learnt the functional key.
Decryption now checks ciphertext lengths and ranges and returnsNone
unless the result is a valid encoding within+-eta X Y
(modular_utils.check_zn2_elements,decode_paillier). - dMCFE-DDH reduced every client's key contribution mod
qbefore the
MCFE2 layer, whose decryption is the integer sum: anyone holding the
published shares read the carry (0..n-1) of that sum, a comparison
oracle on the clients' secrets. ABMPSW20 states Fig. 14 for MCFEs without
a discrete log in decryption only. Contributions are now masked with
q rho_i,rho_i < 2^(stat_param + bits(n))derived from a new per-client
key andH(y); the scheme becomes experimental (our own argument). - dMCFE-LWE reduced every contribution mod
qas well, so the integer
sum also told how manyy_i t_iwere negative in each coordinate. The
contributions are now sent over the integers, as the functional key
sum y_i Z_i in Z^(n0 + m0)of ABMPSW20 Fig. 4 / Fig. 14. - SIFE-LWE and SIFE-Ring-LWE encoded a plaintext as
trunc(x q / p)
instead offloor(q / p) x. The two differ by a small term that is not
linear inx, while ABDP15's proof relies on the linear ciphertext
homomorphism of its PKE and BMMS21's last game onfloor(q/K)times the
message; the residue was hidden only statistically by the ciphertext
noise. Both now usefloor(q / p) x mod q(center_lwe_vector,
center_matrix); found while an independent review of the new
sife/fullysec_ring_lweflagged the same encoding there. Ciphertexts
change; decryption is unaffected. - tMIFE-LWE (experimental) enlarged
qfor its flooding noise but kept
themof the base modulus, so the binaryrof a ciphertext had about
half the length the leftover hash lemma needs forA^T rto be close to
uniform (toy defaults:m = 753where2139is needed); ABDP15's
semantic-security argument then fails.mandqare now iterated to a
fixed point; cached parameters are regenerated. - tMIFE-LWE (experimental) servers decrypted any ciphertexts they were
handed. A partial decryption is linear inct0, so a combiner submitting
ct0 = c e_jfor chosencread the shared functional key off the
partials coordinate by coordinate (the flooding hides a fixed noise term,
not a chosen multiple of the key). Clients now tag every ciphertext with
one HMAC-SHA256 per server, under per-(client, server) keys sampled by
setup, and a server refuses ciphertexts whose tag for it does not verify.
A corrupted client can still choose its own slot's ciphertext, which
reveals only that slot's key part. - tMCFE-Ring-LWE (experimental) servers decrypted any ciphertexts they
were handed; a partial decryption is linear inct1, so a combiner
recovered the functional-key partsS_i y_iexactly in a few queries
with chosenct1. As for tMIFE-LWE, clients now tag every ciphertext (and
every ndarray chunk) for every server, over the (chunk) label and the
ciphertext; servers refuse untagged, altered or other-label ciphertexts. - tMCFE-FH-Multi-IPE (experimental) servers decrypted whatever round the
combiner submitted (FH ciphertexts hide their label). Ciphertexts now
carry the encoded label, tagged together with the ciphertext for every
server, andshare_decrypttakes the label the server agrees to decrypt. - tMIFE-LWE and tMCFE-Ring-LWE seeded the flooding noise with the JSON of
the request, so the same ciphertexts with an extra field, another server's
tag or (Ring-LWE) coefficients written asv + qdrew fresh noise, and
averaging such partials removes it. The noise is now seeded with a digest
of the values the key part depends on (ct0for tMIFE-LWE;ct1and the
label or chunk for tMCFE-Ring-LWE), so neither the encoding, nor extra
fields, nor the other half of a ciphertext re-tagged by a corrupted client
draws fresh noise (threshold_utils.ciphertexts_digest); the enrolled set
enters only through the server's Lagrange coefficient (two sets with the
same coefficient drew different noise), and tMCFE-Ring-LWE's noise keys
no longer change when a key is re-shared for anothern_chunks. A
corrupted client varying its own slot still draws fresh noise (averaging
needs about2^(2 stat_param)partials; documented); tMCFE-Ring-LWE
also refuses ciphertexts of the wrong shape
(ring_lwe_utils.canonical_ring_ciphertext). Tags use the shared
threshold_utils.client_server_mac_keys,tag_ciphertextand
check_ciphertext_tags. - tMCFE-DDH servers decrypted whatever label the submitted ciphertexts
carried (the key is label-independent), so they could not restrict
decryption to the rounds they mean to serve: a combiner could have any
round decrypted at any time.share_decryptnow takes the label the
server agrees to decrypt and refuses ciphertexts under any other. - tMCFE-FH-Multi-IPE (experimental) handed every server Shamir shares of
the FH-MCFE key exponentse_iinZ_p. The key hidesyonly as
[e_i]_2:tcolluding servers (one ift = 1) interpolatede_iand
solved for the weights. Servers now hold their shares in the exponent
([e^(k)]_2,[z^(k)]_T) and raise their pairing product to their
Lagrange coefficient;tservers interpolate the FH-MCFE key itself. - dMCFE-FH-Multi-IPE used
tag-f = (tag_f, H(y))over all clients'
weights, so a client's key share depended on the others' weights: a
corrupted client derived its share for a guess of the honest clients'
weights and learnt whether the guess was right from whether decryption
succeeded. As in NPS24 Fig. 1, a client's share now depends on an explicit
tag_fand its owny_ionly; a client object refuses a second weight
vector under atag_fit already used. - ML adapter:
FESchemeWrapperholds the master key, and
aggregate_gradientsissued a key for any weights, so weights(1, 0)or
a subset of the clients decrypted one client's gradient; labels could be
reused. It now needs a ciphertext and a non-zero weight for every enrolled
client (allow_partial=Truerelaxes this), refuses a second encryption by
a client under one label and a second weight vector for one label, and is
documented as a single-trust-domain simulation. standardprofile: the statistical parameterstat_paramkept its
default 64 and accepted any explicit value (stat_param = 1gave
flooding at statistical distance about 1/2), although the profile claims
128 bits and refuses weaker explicit values. It is now 128 (thekappaof
the Ring-LWE schemes) and lower values are refused: a distance of
2^-128per sample instead of2^-64. ABMPSW20 moduli grow by about 64
bits (mcfe/lwepicksn0of about 7200 to 8200 instead of 4600 to
5600), tMCFE-Ring-LWE moves toring_n = 16384, and tMIFE-LWE to
lwe_nof about 6000, for whichWIDE_LWE_128_LOG_RATIOnow extends to
n = 6144(same estimator and method).standardprofile: a config that was aMappingbut not adict
(e.g.MappingProxyType) skipped the profile while the key generator
recordedsecurity_profile = "standard"(sife/ddhran on a 128-bit
group). EveryMappingis now resolved.- Parameter cache: cached discrete-log groups and DCR moduli were used
without any check (a planted 5-bit group or a prime "RSA modulus" was
accepted, also understandard). DL groups are now checked for primality,
size, a safe-prime structure (a cached cofactorrwith a smallq
passed a first version of the check), the order of their generators and,
at RFC 3526 sizes, for being the RFC prime; DCR moduli for size,
compositeness and prime factors below 2^16, Paillier bases for not being
1 mod N(crypto_utils.is_dl_group,is_dcr_modulus). Everything else
a cache holds is now either re-derived on load or expanded from a stored
seed: the Ring-LWE parameters and public polynomiala
(ring_lwe_utils.seeded_polynomial;a = 0used to be accepted), the
ABDP15 / tMIFE-LWE parameters includingsigma_f(lwe_n = 1,
sigma_q = 0,m = 8orsigma_f = 1used to be accepted), the ALS16
parameters and matrixA, the Paillier baseg = H(seed)^(2N)
(crypto_utils.paillier_base;g = N^2 - 1used to reveal the
plaintexts) and the Damgard elementh, hashed into the group (a planted
h = ghad a known discrete logarithm).
A file that fails, or does not parse (e.g. after an interrupted write), is
regenerated, and files are written atomically. Since no check can tell
whether someone knows the factors of a DCR modulus, thestandardprofile
never loads or stores the Paillier moduli and the dMCFEN2(they are
generated for every key generator);toykeeps the cache. - Ring-LWE parameters (SIFE, MIFE, MCFE, tMCFE, dMCFE):
bmms21_parameters
cites BMMS21 Sec. 4.2 but usedsigma = 1andsigma1 = 2 sqrt(l) X,
which miss its smoothing conditions (the mhe-RLWE condition of G1 -> G2
needssigma sqrt(1 - ...) > eta(Z^(n + n l)), about 5.6, and had 0.71;
G3 -> G4 needssigma' >= sqrt(2) eta(Z^n)and hadsigma' = 1). The
widths now follow Sec. 4.2 (ring_lwe_utils.bmms21_selective_parameters),
which adds about 10 bits toq. Thestandardprofile checked the
moduli against the Homomorphic Encryption Standard's bound, which assumes
errors of width 3.2 (the standard SIFE-Ring-LWE hadsigma1 = 2) and which
the lattice estimator puts at about 125 bits; it now uses
RING_LWE_128_LOG_Q, estimated with the same tool and rule as the LWE
tables for widths 2 to 16 andn = 1024to32768, read at the smallest
width among the RLWE problems of the proof (about 8). Cached parameters
are regenerated. - Threshold schemes assume honest-but-curious servers; this is now stated
in the README,SECURITY.mdandthreshold_utils. Nothing proves a
partial decryption correct, socombine_decryptand
decrypt_lst_ndarray_ctof every threshold scheme accept partial
decryptions for several enrolled sets and raiseFESchemeErrorif their
results disagree (threshold_utils.combine_consistently).
Added
security_profileconfig key for every key generator
(pyfe4ai.schemes.profiles)."toy"(default) leaves configs unchanged,
so all defaults stay as they were."standard"presets 128-bit-oriented
sizes: a 3072-bit DL group (RFC 3526 MODP group 15), a PaillierNof
about 3072 bits (bit_length = 1536), Ring-LWEkappa = 128withring_n = "auto"
(smallest dimension whose derivedqmeetsRING_LWE_128_LOG_Q, a
lattice-estimator table read at the smallest RLWE width of the scheme's
proof, re-checked after derivation, flooding included)
and the BN254 pairing group (about 100-bit, with aFESecurityWarning).
The ABMPSW20 MCFE-LWE family (mcfe/lwe,fullysec_lwe,lwe_threshold,
lwe_decentralized) getslwe_n = "auto": the smallest dimension whose
derivedqmeetslwe_utils.DENSE_LWE_128_LOG_Q, a lattice-estimator
table for LWE(n0, q, ceil(2 sqrt(n0))) with a uniform secret (the
assumption of the scheme's proof), regenerated by
tools/estimate_dense_lwe.py; understandardits decentralised variant
combines key shares under a DCR modulus of at least 3072 bits.
Explicit values below the profile, and the schemes without a usable
secure parameter set (SIFE / MIFEfullysec_lweand dMCFE-Paillier),
raiseFEValidationError.- ABDP15 LWE IPFE (
sife/lwe,mife/lwe) understandard:lwe_n = "auto"
picks the smallest dimension whose(q, sigma)meets
lwe_utils.WIDE_LWE_128_LOG_RATIO, a lattice-estimator table of the
largestlog2(q / sigma)per dimension and error width for the LWE problem
of the public keyA S + E(regenerated bytools/estimate_wide_lwe.py);
explicit dimensions are checked against it. New config keymatrix_mode
(key generators and crypto objects; forwarded by the ML adapter):
"memory"keeps the expanded public matrix (n = 1088: 0.1 s per
encryption, 2.7 GB),"stream"expands it for every batch (3.4 s, 0.5 GB).
pyfe4ai.utils.lwe_matrix(SeededMatrix,LimbMatrix),
pyfe4ai.schemes.abdp15_lwe,sampling_utils.rand_bit_matrix.
tMIFE-LWE gets the samelwe_n = "auto"at its flooding-enlargedq
(about 6000 forX = Y = 50withstat_param = 128; the table covers
dimensions up to 6144), andstandardfixes itsmatrix_modeto
"stream"(itsAwould take more than 400 GB in memory): key generation
38 minutes, one encryption 572 s, 10.6 s each in batches of 64."memory"mode refuses a matrix larger than the
machine's physical memory. sife/fullysec_ring_lwe: the adaptively secure Ring-LWE IPFE of BMMS21
(Bermudo Mera, Karmakar, Marc, Soleimanian, PKC 2022, Sec. 5), the ring
counterpart of ALS16. The paper takesm = 3key polynomials, but under
its own constraints (Appendix C.1: the Ring-LHL widthsigma'grows like
q^(2/m), the decryption noise likeq^(4/m)) no modulus exists for
m <= 4;m = "auto"takes the smallestm >= 5that admits one (within
the 128-bit Ring-LWE bound understandard). Widths follow Theorems 1 and 2
and Appendix C.1 for signed inputs, with complexity leveraging over
(2X + 1)^(2 eta); one vector per ciphertext.standard: eta = 10,
X = Y = 50 gives n = 8192, m = 8 (encrypt 2.4 s, decrypt 0.5 s).
ring_lwe_utils.bmms21_adaptive_parameters,bmms21_adaptive_log2_q,
bmms21_adaptive_choice.lwe_n = "auto"for the MCFE-LWE family;lwe_utils.DENSE_LWE_128_LOG_Q,
check_dense_lwe,dense_lwe_n,resolve_lwe_n;
profiles.STANDARD_DCR_PRIME_BITS;modular_utils.pow_signed_many
(fixed-base exponentiation of one base to many exponents).ring_n = "auto";ring_lwe_utils.RING_LWE_128_LOG_Q(regenerated by
tools/estimate_ring_lwe.py),ring_lwe_bound,check_ring_lwe,
ring_lwe_auto_n,resolve_ring_n,bmms21_selective_parameters;
crypto_utils.RFC3526_PRIMES.pyfe4ai.utils.validation.int_vector: scheme inputs must be integers
(integral floats accepted); non-integral values raise
FEValidationErrorinstead of being truncated.pyfe4ai.utils.ring_lwe_utils.bmms21_parameters,check_ring_nand
DEFAULT_RING_N;FHIPE.keygen(..., r=...).dlog_boundcrypto option for SIFE-DDH, MIFE-DDH, MCFE-DDH and
tMCFE-DDH (results beyond the default10^(precision + 2)decrypt to
None).pyfe4ai.schemes.status(SchemeStatus,get_scheme_status, exported
frompyfe4ai): status (reviewed/experimental/unreviewed/
known-insecure), fidelity, reference and issue for all registered
schemes; key generators and crypto objects of known-insecure schemes emit
pyfe4ai.FESecurityWarning;FESchemeWrapper.status;
markdown_table()renders the README table, which a test keeps in sync.XofRandom(SHAKE-256 bit source for derandomised sampling) and anrng
argument fordiscrete_gaussian_bigint.discrete_gaussian_bigint(arbitrary-width rounded Gaussian),
hash_to_zn2_star,hash_to_zq_vector,abmpsw20_lwe_parameters,
round_to_q0,decode_rounded_inner_product.- Config keys
stat_param(ABMPSW20 schemes, SIFE-Paillier; default 64) and
mddh_k(MCFE-Damgard). pyfe4ai.utils.pairing_backend.check_asymmetric(detects symmetric
groups by pairing twoG1elements) andDEFAULT_PAIRING_GROUP.pyfe4ai.schemes.mcfe.fh_ipe(FHIPE),
pyfe4ai.schemes.mcfe.decentralize(MCFE2 and zero-sum keys for
Fig. 14),labels.chunk_label,MCFERingLWE.key_chunks(the ML adapter
passes the resultingn_chunkswhen requesting Ring-LWE keys).tag_fargument of the dMCFE-FH-Multi-IPE key derivation.
Changed (breaking)
- tMCFE-DDH:
share_decrypt(dict_ct, credentials, dk, lst_sid_enrolled, label),compute_lst_ndarray_ct(..., lst_sid_enrolled, label)and
decrypt_lst_ndarray_ct(partials, label)take the label to decrypt;
combine_decrypt(partials, label=None)checks it when given. - Exports and registry:
HybridAlphaMIFEandHybridAlphaMIFEKeyGenerator
are removed (see Removed);MultiInputQuadraticSGPand
MultiInputQuadraticSGPKeyGeneratorare replaced byMultiInputQuadratic
andMultiInputQuadraticKeyGenerator, the ML adapter's registry key
("quadratic", "multi_input_sgp")by("quadratic", "miqfe")and
config_types.MultiInputSGPConfigbyMultiInputQuadraticConfig. The
static methodThresholdMIFE.Lis removed (use
threshold_utils.lagrange_coefficient_at_zero). - tMCFE-FH-Multi-IPE: key shares hold
kasG2elements andzas aGT
element (serialised) instead of integers, plusmac_keys; client keys
carrymac_keys; ciphertexts are{ct, label, tags};
share_decrypt(dict_ct, credentials, dk, lst_sid_enrolled, label),
compute_lst_ndarray_ct(..., lst_sid_enrolled, label),
decrypt_lst_ndarray_ct(partials, label),combine_decrypt(partials, label=None); partial decryptions carrylabel. - tMCFE-Ring-LWE: client keys and key shares carry
mac_keys, ciphertexts
and ndarray chunkstags. - dMCFE-FH-Multi-IPE:
derive_function_decryption_key_share(weights, tag_f)
takes this client's weights (or a dict, of which only its entry is used)
and a required non-emptytag_f. - tMIFE-LWE: client keys carry
mac_keys({sid: key}), key shares
mac_keys({nid: key}) and ciphertextstags({sid: tag});
ciphertexts without valid tags are refused. - MCFE-Paillier:
sk = {s},dk = {k},ct = {c}. MCFE-LWE /
FullySec-LWE:sk = {z},dk = {sk_y},ct = {c}; the config keys
bound_uandlabel_modulusare ignored and parameters are no longer
cached in./config. MCFE-Damgard:sk = {s},dk = {d},ct = {c}, no
hin the public parameters. - tMCFE-DDH:
sk = {s},dk = {d, sid, lst_sid}(label-independent),
ct = {c, label}, partial decryption{c_y, u_d, label, sid, lst_sid_enrolled}; key shares also carryweights_id. tMCFE-LWE:
dk = {sk_y, sid, lst_sid, weights_id, noise_key}, partial decryption
{w, c_y, label, sid, lst_sid_enrolled}, validated like the DDH threshold
scheme. Thelabelfields hold the encoded label. - The ndarray helpers of all rebuilt MCFE schemes encrypt each element
under its ownElementLabel(one ciphertext per slot and label); labels
are hashed throughencode_label, which also changes MCFE-DDH
ciphertexts relative to v0.2.0. - Decrypting under a wrong label returns
Nonefor MCFE-Paillier and
MCFE-Damgard and an arbitrary in-range value for the LWE schemes. - MIFE Damgard / Paillier / LWE / FullySec-LWE / Ring-LWE: client keys
carry the padu; functional keys carryz({k1, k2, z},{k, z},
{sk_y, z}); decryption needs a ciphertext for every slot of the key.
tMIFE-LWE key shares carrynoise_key. - dMCFE-DDH / -LWE / -Paillier: key shares are MCFE2 ciphertexts
{c, nid, weights_id}, every client must contribute (with zero weights
if absent), and the combined key is the MCFE1 key. - MCFE / dMCFE / tMCFE-Ring-LWE: functional keys are bound to a label
(credentialsneedlabel, optionallyn_chunks;
derive_function_decryption_key_share(fusion_weight, label, n_chunks));
ndarray ciphertexts pack values into chunks ofring_ncoefficients. - FH-MCFE family: client keys
{imsk}(dMCFE addst_tilde,seed),
functional keys{dk: {nid: {k, z}}, weights_id}; tMCFE key shares
{k, z, sid, lst_sid, weights_id}and partial decryptions
{w, ct_digest, sid, lst_sid_enrolled}. The config keyssec_level,
u_boundandlabel_modulusare ignored and parameters are no longer
cached. - Decryption keys of the SIFE schemes (DDH, LWE, Damgard, FullySec-LWE,
Ring-LWE) carry their weightsy, and decryption raises
FESchemeErrorfor other weights; MIFE/FH keys carryweights_id.
Ciphertext lengths are checked. - SIFE-FullySec-LWE:
K = 2 eta X Y + 1, encodingfloor(q / K) x
(caches carry a construction tag and are regenerated). - SIFE-Ring-LWE / MIFE / MCFE:
ring_ndefaults to 32 (it was claimed to be
derived but always was 32) and must be a power of two. - MIFE-DDH: client keys
{h, u}(no secret slot key),ct = {t, c}, keys
must cover every slot. tMIFE-DDH: shares{d, z, sid, lst_sid, weights_id}, partial decryptions{c_y, w, ct_digest, sid, lst_sid_enrolled}. MIFE FH-IPE:sk = {imsk},ct = {ct},
dk = {dk, z, weights_id}, no parameter cache. Quad:ct = {ct_x, ct_y, ct},dk = {f, k}, no parameter cache. - SIFE FH-IPE ciphertexts and keys have
eta + 2components. - Pairing-based schemes:
pairing_group_paramdefaults toMNT224;
SS512andSS1024raiseFEValidationError. Parameters, keys and
ciphertexts created overSS512cannot be reused (cached parameters are
regenerated).
Changed
- SIFE-LWE, MIFE-LWE and tMIFE-LWE publish the matrix
Aas a 32-byte seed
(pp["A_seed"]replaces them x lwe_ndigit matrixpp["A"]), expanded
with SHAKE-128, and encrypt with exact numpy products over 31-bit limbs
(whole batches in the ndarray helpers);qis the largest prime with the
derived bit length. Public parameters, keys and cached parameters are not
compatible with earlier versions. hash_to_zq_vectorcuts one SHAKE-256 stream instead of calling SHAKE-256
once per coordinate (hashing a label of MCFE-LWE at n0 = 8192 drops from
about 12 ms to 3.6 ms). Its outputs change, so ciphertexts ofmcfe/lwe,
fullysec_lwe,lwe_threshold,lwe_decentralized,mcfe/ring_lweand
ring_lwe_decentralizedare not compatible with earlier versions.- MCFE2 key shares of the decentralised MCFE schemes (
ddh_decentralized,
lwe_decentralized,paillier_decentralized) raise one label hash to all
key coordinates with a fixed-base method (about 4 times faster at 3072
bits; same outputs). - Safe primes are generated by sieving candidates
qand2q + 1against
the primes below 2^16 before the primality tests: a 1536-bit safe prime
takes seconds instead of tens of seconds (all Paillier setups and the
dMCFE modulus benefit). The tests themselves are unchanged. group_generator_fe(DL schemes) returns the RFC 3526 group for 2048- and
3072-bit requests instead of generating a fresh safe prime; smaller
sizes, including the default, are generated as before.
Removed
quadratic/multi_input_sgp(replaced byquadratic/miqfe, see above).mife/ddh_hybrid_alpha(HybridAlpha): it duplicated MIFE-DDH without the
paper's inference-prevention filter, and the published design leaks
individual updates (MIFE without labels; a stateless filter that allows
keys forSandSminus one client).dlog_solver.PairingDLogCacheMixin, which had no users (it trusted a
dlog table read from./config/crypto), and the unused helpers
crypto_utils.md5_hashandgroup_generator_paillier.- The
jsonpickledependency (never imported). - The unused modules
schemes/lwe_base.py,schemes/ring_lwe_base.pyand
schemes/paillier_base.pyand the helperslabel_scalar_from_hashand
decode_fullysec_lwe_inner_product. - The repository-root
config.yaml, an unused copy of the bundled
pyfe4ai/config.yaml.
Build
Dockerfile.pairing: the deprecatedcontinuumio/miniconda3base is
replaced bycondaforge/miniforge3:26.5.3-0, pinned by digest; the PBC
1.0.0 archive is checked against its SHA-256 before it is built; the image
runs as an unprivileged user.environment.ymluses theconda-forge
channel.
Fixed
benchmarks/benchmark_ndarray_helpers.pyran every group before applying
--group, so--group sifefailed withoutcharm-crypto, and its warm-up
rounds ran after the timed ones. It now runs the warm-up and then only the
selected groups.- The ndarray helpers truncated
x 10^precisiontoward zero (0.57became
0.56at precision 2) and turned NaN and infinities into-2^63. They now
round to nearest and refuse non-finite or too large values
(validation.scale_to_int). - Ring-LWE MIFE / MCFE / dMCFE and FH-MCFE keys truncated fractional weights
(0.5became0), andthreshold_utils.fusion_weight_idgave1.5and
1the same digest; weights now go throughvalidation.int_vector.
Ring-LWE MIFE / MCFE plaintext rows of different lengths were cut or
padded silently and are now refused; so are ciphertexts of the wrong shape
(short polynomials were truncated byzip) and ndarray layers whose
first_chunkis negative or beyond the key (a negative index picked chunk
keys from the end of the list). - MIFE-LWE sized its noise for
eta-dimensional vectors, but decryption adds
the noise of allnslots, so the decryption margin shrank with
sqrt(n). As in ACFGU18 (footnote 14), the ALS16 / ABDP15 parameters are
now chosen as if the vectors had dimensionn * eta; cached parameters are
regenerated. - The ABDP15 plaintext modulus
pwas random in its bit range, so
lwe_n = "auto"could pick different dimensions on different runs (the
README'sn = 832foreta = 1was one such draw; the deterministic
choice is 768).
pis now the smallest prime of that size. - SIFE / MIFE FullySec-LWE (ALS16) used
m = 1.01 n log2 q; ALS16 Theorem 2
needsm >= 4 n log2 q. The recipe now uses4 n log2 q(also inside
the width derivation), sizes the row normB_tauoftauwithsqrt(m)
instead ofsqrt(n)(with the largerm, the old bound let about 0.1% of
extreme decryptions fail at toy sizes), uses at least the 12-sigma tail
cut for itsomega(sqrt(log n))(log2 nalone left dimensions below
4096 a few sigma of margin) and takes the largest prime of the
derived size (a random draw could exceed it by one bit); cached parameters
are regenerated. Thestandardrefusal now quotes the resulting sizes
(n = 3328to4352, 80 to 145 MB per ciphertext). sife/fullysec_ring_lwewith an explicitring_nandm = "auto"under
standardtookm = 5, whoseqexceeds the bound, and refused; it now
takes the smallestmthat meets the bound.- SIFE-Paillier truncated fractional plaintexts and weights (
[1.7, 2.9]
encrypted as[1, 2], a weight0.5became0); the sameabs(int(v))
checks were in MIFE/MCFE LWE, Paillier and Damgard, dMCFE-LWE /
-Paillier and partial FH-IPE. They now refuse non-integral values
(validation.strict_int), and so do MCFE-DDH key derivation, encryption
and decryption (gp.mpz(2.5)was 2); rationals are checked exactly
(Fraction(2^60 + 1, 2)passed through a float).scale_to_intrefuses a
negative precision;
a key generator config that is not aMappingis refused (it could skip
the security profile). - MCFE-DDH and tMCFE-DDH put the plaintext into the message of the
exception for a malformed plaintext, andint_vectorthe offending value;
messages now name only the problem (and the type). - SIFE FH-IPE decryption required the weights
yalthough its keys hide
them;fusion_weightis now optional (checked if given). - The logging configuration is read with
yaml.safe_loadsemantics
(SafeLoader); dependencies have lower bounds (gmpy2>=2.2for
prev_prime,numpy>=1.22,PyYAML>=5.4). - The ndarray combiners of the threshold schemes crashed with a
TypeError
(or returned NaN, tMCFE-LWE) when an element's partial decryptions
disagreed, and took the output shape from the first server; they now
check that all servers' outputs have one structure (lists of arrays) and
raiseFESchemeErrorfor malformed outputs and for an element that does
not decrypt (threshold_utils.combine_elementwise). - The ndarray helpers of the other schemes did the same for an element that
does not decrypt (result outside the decryption bound, or key and
ciphertext do not match): aTypeErrorin most schemes, a silent NaN in
MCFE-Ring-LWE, MIFE FH-Multi-IPE,quadandsgp. They now raise
FESchemeErrornaming the element (ipfe.decoded_layer), as
ml_adapter.compute_lineardoes for a result that does not decrypt. - SIFE-Paillier
decrypt_lst_ndarray_ctdecoded inline without the checks
ofdecrypt(ciphertexts inZ_{N^2}^*, result in range), so a wrong key
gave wrapped values instead of an error; it now callsdecryptper
element. - ML adapter:
aggregate_gradientson a SIFE wrapper returned the first
client's result when given several; it now refuses more than one. Fractional
weights were quantised but the result was not scaled back (weights0.5
gave10^precisiontimes the sum); the result is now rescaled, and
fractional weights without a precision, or not representable at it, are
refused. The policy does not stop very unequal weights, which separate
two clients' gradients in one aggregate; this is now documented.
EncryptedGradient.from_dictallocated whatever shape it was given; it now
bounds the shape and requires one entry per element. - SIFE-FullySec-LWE decoded
+-eta X Ywith a random sign (Kwas
2 eta X Y). SIFE-Damgard could not decrypt in an instance holding the
encryption key. SIFE-LWE's ndarray helper skipped thebound_xcheck.
The MIFE Ring-LWE key generator overwrote the SIFE parameter cache. - Ring-LWE plaintext modulus (SIFE, MIFE, MCFE):
pwas exactly
2 l X Y, so inner products of+-l X Ywere ambiguous; it is now
2 l X Y + 2(parameter caches are regenerated). - Safe primes below 64 bits could have one bit too many (
next_prime
stepped past the size, about 1% of 16-bit draws), which made a test fail
intermittently. - Key generators accepted
nand alst_nidof another length; bounds,
noise widths and moduli were then sized fornslots (MCFE-LWE with
n = 2and 10 clients decrypted 160 instead of 810). They now raise
FEValidationError, as threshold schemes do for repeated server ids.
Documentation
- README: Scheme Status table, rewritten Known Issues, the scheme table
cites the implemented constructions (ACFGU18 Fig. 4, ABMPSW20, BMMS21
Sec. 6, AGT21b, NPS24, ACFGU18 Fig. 12, Gay20 Fig. 4); the ALS16 link
pointed to a different paper (ePrint 2016/011, now 2015/608); landing
page matrix updated; the docs index no longer claims a uniform
setup / keygen / encrypt / decryptAPI. - README and docs: the usage example's advice (adding
standardnext to an
explicitsec_param = 128is refused),sife/fullysec_ring_lwein the
scheme table and features, the landing page's scheme count (39), the size
of the dMCFE-DDH modulus (about 6410 bits with the carry mask), the docs index's group size
(3072 bits); a Sphinx page forpyfe4ai.utils.validation;config_types
listsstat_param,matrix_mode,m,lwe_n = "auto"and the crypto
config'sdlog_bound; the benchmarks README listsbenchmark_ntt.py. - Tests: a bare
pytestfrom the repository root works without an install
(pythonpath); the core lane no longer collects pairing tests
(test_fh_ipe.py,test_pairing_groups.py); the ACFGU18 pad test no
longer fails when a padded slot hits the plain value by chance (about 0.3%
of runs for MIFE FullySec-LWE); the README status table is compared in full
withstatus.markdown_table(). - Docs site: a Security & Status page whose scheme table and counts are
rendered frompyfe4ai.schemes.statusat build time;GLOSSARY.md, which
was never rendered and named config keys that no longer exist
(poly_degree,group), is nowglossary.rst, corrected and extended
(security_profile,stat_param,matrix_mode,label,tag_f,
mac_keys); every class is documented once instead of twice; the
ML-adapter and quantization docstrings render (they were NumPy style),
as do 16 over-indentedArgs:sections and 57 bullet items; placeholder
docstrings are replaced; nitpicky build warnings went from 171 to 0. - Landing page: experimental schemes are marked in the matrix, MIQFE is
listed, the ML-adapter card no longer claims to wrap any scheme, a
security-profile card, the toy-parameter warning in the snippet, how to
installcharm-crypto, social-preview tags, a navigation bar that fits
phones, and WCAG AA contrast. - README,
CONTRIBUTING.md,SECURITY.md,CODE_OF_CONDUCT.md, issue and
PR templates: vulnerabilities are reported through GitHub private
vulnerability reporting; the prerequisites ofcharm-crypto; a checklist
for adding a scheme; LWE dimensions default to 32–64 (not 16–64); the
examples and benchmarks READMEs list every script and say which need
charm-crypto.