Documentation
¶
Overview ¶
Package mhefloat implements homomorphic decryption to Linear-Secret-Shared-Shares (LSSS) and homomorphic re-encryption from LSSS, as well as interactive bootstrapping for the package `he/hefloat` See `mhe/README.md` for additional information on multiparty schemes.
Index ¶
- func GetMinimumLevelForRefresh(lambda int, scale rlwe.Scale, nParties int, moduli []uint64) (minLevel int, logBound uint, ok bool)
- func NewAdditiveShare(params hefloat.Parameters, logSlots int) *mhe.AdditiveShareBigint
- type EncToShareProtocol
- func (e2s EncToShareProtocol) Allocate(level int) (share *mhe.KeySwitchingShare)
- func (e2s EncToShareProtocol) Finalize(secretShare *mhe.AdditiveShareBigint, ...) (err error)
- func (e2s EncToShareProtocol) Gen(sk *rlwe.SecretKey, logBound uint, ct *rlwe.Ciphertext, ...) (err error)
- func (e2s EncToShareProtocol) ShallowCopy() *EncToShareProtocol
- type MaskedTransformFunc
- type MaskedTransformProtocol
- func (p MaskedTransformProtocol) Aggregate(share1, share2, share3 *mhe.RefreshShare) (err error)
- func (p MaskedTransformProtocol) Allocate(levelDecrypt, levelRecrypt int) *mhe.RefreshShare
- func (p MaskedTransformProtocol) Finalize(ct *rlwe.Ciphertext, transform *MaskedTransformFunc, share *mhe.RefreshShare, ...) (err error)
- func (p MaskedTransformProtocol) Gen(skIn, skOut *rlwe.SecretKey, logBound uint, ct *rlwe.Ciphertext, seed [32]byte, ...) (err error)
- func (p MaskedTransformProtocol) ShallowCopy() *MaskedTransformProtocol
- func (p MaskedTransformProtocol) WithParams(paramsOut hefloat.Parameters) *MaskedTransformProtocol
- type RefreshProtocol
- func (rfp RefreshProtocol) Aggregate(share1, share2, shareOut *mhe.RefreshShare) (err error)
- func (rfp RefreshProtocol) Allocate(inputLevel, outputLevel int) *mhe.RefreshShare
- func (rfp RefreshProtocol) Finalize(ctIn *rlwe.Ciphertext, share *mhe.RefreshShare, opOut *rlwe.Ciphertext) (err error)
- func (rfp RefreshProtocol) Gen(sk *rlwe.SecretKey, logBound uint, ct *rlwe.Ciphertext, seed [32]byte, ...) (err error)
- func (rfp RefreshProtocol) ShallowCopy() *RefreshProtocol
- type ShareToEncProtocol
- func (s2e ShareToEncProtocol) Allocate(level int) (share *mhe.KeySwitchingShare)
- func (s2e ShareToEncProtocol) Finalize(share *mhe.KeySwitchingShare, opOut *rlwe.Ciphertext) (err error)
- func (s2e ShareToEncProtocol) Gen(sk *rlwe.SecretKey, seed [32]byte, metadata *rlwe.MetaData, ...) (err error)
- func (s2e ShareToEncProtocol) ShallowCopy() *ShareToEncProtocol
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetMinimumLevelForRefresh ¶
func GetMinimumLevelForRefresh(lambda int, scale rlwe.Scale, nParties int, moduli []uint64) (minLevel int, logBound uint, ok bool)
GetMinimumLevelForRefresh takes the security parameter lambda, the ciphertext scale, the number of parties and the moduli chain and returns the minimum level at which the collective refresh can be called with a security of at least 128-bits. It returns 3 parameters : minLevel : the minimum level at which the collective refresh must be called to ensure correctness logBound : the bit length of the masks to be sampled to mask the plaintext and ensure 128-bits of statistical indistinguishability ok : a boolean flag, which is set to false if no such instance exist
func NewAdditiveShare ¶
func NewAdditiveShare(params hefloat.Parameters, logSlots int) *mhe.AdditiveShareBigint
Types ¶
type EncToShareProtocol ¶
type EncToShareProtocol struct {
mhe.KeySwitchingProtocol[rlwe.SecretKey]
// contains filtered or unexported fields
}
EncToShareProtocol is the structure storing the parameters and temporary buffers required by the encryption-to-shares protocol.
func NewEncToShareProtocol ¶
func NewEncToShareProtocol(params hefloat.Parameters) *EncToShareProtocol
NewEncToShareProtocol creates a new EncToShareProtocol struct from the passed parameters.
func (EncToShareProtocol) Allocate ¶
func (e2s EncToShareProtocol) Allocate(level int) (share *mhe.KeySwitchingShare)
Allocate allocates a share of the EncToShare protocol
func (EncToShareProtocol) Finalize ¶
func (e2s EncToShareProtocol) Finalize(secretShare *mhe.AdditiveShareBigint, aggregatePublicShare *mhe.KeySwitchingShare, ct *rlwe.Ciphertext, secretShareOut *mhe.AdditiveShareBigint) (err error)
Finalize is the final step of the encryption-to-share protocol. It performs the masked decryption of the target ciphertext followed by a the removal of the caller's secretShare as generated in the GenShare method. If the caller is not secret-key-share holder (i.e., didn't generate a decryption share), `secretShare` can be set to nil. Therefore, in order to obtain an additive sharing of the message, only one party should call this method, and the other parties should use the secretShareOut output of the GenShare method.
func (EncToShareProtocol) Gen ¶
func (e2s EncToShareProtocol) Gen(sk *rlwe.SecretKey, logBound uint, ct *rlwe.Ciphertext, secretShareOut *mhe.AdditiveShareBigint, publicShareOut *mhe.KeySwitchingShare) (err error)
Gen generates a party's share in the encryption-to-shares protocol. This share consist in the additive secret-share of the party which is written in secretShareOut and in the public masked-decryption share written in publicShareOut. This protocol requires additional inputs which are : logBound : the bit length of the masks ct: the ciphertext to share publicShareOut is always returned in the NTT domain. The method "GetMinimumLevelForBootstrapping" should be used to get the minimum level at which EncToShare can be called while still ensure 128-bits of security, as well as the value for logBound.
func (EncToShareProtocol) ShallowCopy ¶
func (e2s EncToShareProtocol) ShallowCopy() *EncToShareProtocol
ShallowCopy creates a shallow copy of EncToShareProtocol in which all the read-only data-structures are shared with the receiver and the temporary buffers are reallocated. The receiver and the returned EncToShareProtocol can be used concurrently.
type MaskedTransformFunc ¶
MaskedTransformFunc represents a user-defined in-place function that can be evaluated on masked float plaintexts, as a part of the Masked Transform Protocol. The function is called with a vector of *Complex modulo hefloat.Parameters.Slots() as input, and must write its output on the same buffer. Transform can be the identity. Decode: if true, then the masked float plaintext will be decoded before applying Transform. Recode: if true, then the masked float plaintext will be recoded after applying Transform. i.e. : Decode (true/false) -> Transform -> Recode (true/false).
type MaskedTransformProtocol ¶
type MaskedTransformProtocol struct {
// contains filtered or unexported fields
}
MaskedTransformProtocol is a struct storing the parameters for the MaskedTransformProtocol protocol.
func NewMaskedTransformProtocol ¶
func NewMaskedTransformProtocol(paramsIn, paramsOut hefloat.Parameters, prec uint) *MaskedTransformProtocol
NewMaskedTransformProtocol creates a new instance of the PermuteProtocol. paramsIn: the hefloat.Parameters of the ciphertext before the protocol. paramsOut: the hefloat.Parameters of the ciphertext after the protocol. prec : the log2 of decimal precision of the internal encoder. The method will return an error if the maximum number of slots of the output parameters is smaller than the number of slots of the input ciphertext.
func (MaskedTransformProtocol) Aggregate ¶
func (p MaskedTransformProtocol) Aggregate(share1, share2, share3 *mhe.RefreshShare) (err error)
Aggregate sums share1 and share2 on shareOut.
func (MaskedTransformProtocol) Allocate ¶
func (p MaskedTransformProtocol) Allocate(levelDecrypt, levelRecrypt int) *mhe.RefreshShare
Allocate allocates the shares of the PermuteProtocol
func (MaskedTransformProtocol) Finalize ¶
func (p MaskedTransformProtocol) Finalize(ct *rlwe.Ciphertext, transform *MaskedTransformFunc, share *mhe.RefreshShare, ciphertextOut *rlwe.Ciphertext) (err error)
Finalize decrypts the ciphertext to LSSS-shares, applies the linear transformation on the LSSS-shares and re-encrypts the LSSS-shares to an RLWE ciphertext. The re-encrypted ciphertext's scale is set to the default scaling factor of the output parameters.
func (MaskedTransformProtocol) Gen ¶
func (p MaskedTransformProtocol) Gen(skIn, skOut *rlwe.SecretKey, logBound uint, ct *rlwe.Ciphertext, seed [32]byte, transform *MaskedTransformFunc, shareOut *mhe.RefreshShare) (err error)
Gen generates the shares of the PermuteProtocol This protocol requires additional inputs which are : skIn : the secret-key if the input ciphertext. skOut : the secret-key of the output ciphertext. logBound : the bit length of the masks. ct1 : the degree 1 element the ciphertext to refresh, i.e. ct1 = ckk.Ciphetext.Value[1]. scale : the scale of the ciphertext when entering the refresh. The method "GetMinimumLevelForBootstrapping" should be used to get the minimum level at which the masked transform can be called while still ensure 128-bits of security, as well as the value for logBound.
func (MaskedTransformProtocol) ShallowCopy ¶
func (p MaskedTransformProtocol) ShallowCopy() *MaskedTransformProtocol
ShallowCopy creates a shallow copy of MaskedTransformProtocol in which all the read-only data-structures are shared with the receiver and the temporary buffers are reallocated. The receiver and the returned MaskedTransformProtocol can be used concurrently.
func (MaskedTransformProtocol) WithParams ¶
func (p MaskedTransformProtocol) WithParams(paramsOut hefloat.Parameters) *MaskedTransformProtocol
WithParams creates a shallow copy of the target MaskedTransformProtocol but with new output parameters. The expected input parameters remain unchanged.
type RefreshProtocol ¶
type RefreshProtocol struct {
MaskedTransformProtocol
}
RefreshProtocol is a struct storing the relevant parameters for the Refresh protocol.
func NewRefreshProtocol ¶
func NewRefreshProtocol(params hefloat.Parameters, prec uint) *RefreshProtocol
NewRefreshProtocol creates a new Refresh protocol instance. prec : the log2 of decimal precision of the internal encoder.
func (RefreshProtocol) Aggregate ¶
func (rfp RefreshProtocol) Aggregate(share1, share2, shareOut *mhe.RefreshShare) (err error)
Aggregate aggregates two parties' shares in the Refresh protocol.
func (RefreshProtocol) Allocate ¶
func (rfp RefreshProtocol) Allocate(inputLevel, outputLevel int) *mhe.RefreshShare
Allocate allocates the shares of the PermuteProtocol
func (RefreshProtocol) Finalize ¶
func (rfp RefreshProtocol) Finalize(ctIn *rlwe.Ciphertext, share *mhe.RefreshShare, opOut *rlwe.Ciphertext) (err error)
Finalize applies Decrypt, Recode and Recrypt on the input ciphertext. The ciphertext scale is reset to the default scale.
func (RefreshProtocol) Gen ¶
func (rfp RefreshProtocol) Gen(sk *rlwe.SecretKey, logBound uint, ct *rlwe.Ciphertext, seed [32]byte, shareOut *mhe.RefreshShare) (err error)
Gen generates a share for the Refresh protocol. This protocol requires additional inputs which are : logBound : the bit length of the masks ct1 : the degree 1 element the ciphertext to refresh, i.e. ct1 = ckk.Ciphetext.Value[1]. scale : the scale of the ciphertext entering the refresh. The method "GetMinimumLevelForBootstrapping" should be used to get the minimum level at which the refresh can be called while still ensure 128-bits of security, as well as the value for logBound.
func (RefreshProtocol) ShallowCopy ¶
func (rfp RefreshProtocol) ShallowCopy() *RefreshProtocol
ShallowCopy creates a shallow copy of RefreshProtocol in which all the read-only data-structures are shared with the receiver and the temporary buffers are reallocated. The receiver and the returned RefreshProtocol can be used concurrently.
type ShareToEncProtocol ¶
type ShareToEncProtocol struct {
mhe.KeySwitchingProtocol[rlwe.SecretKey]
// contains filtered or unexported fields
}
ShareToEncProtocol is the structure storing the parameters and temporary buffers required by the shares-to-encryption protocol.
func NewShareToEncProtocol ¶
func NewShareToEncProtocol(params hefloat.Parameters) *ShareToEncProtocol
NewShareToEncProtocol creates a new ShareToEncProtocol struct from the passed parameters.
func (ShareToEncProtocol) Allocate ¶
func (s2e ShareToEncProtocol) Allocate(level int) (share *mhe.KeySwitchingShare)
Allocate allocates a share of the ShareToEnc protocol
func (ShareToEncProtocol) Finalize ¶
func (s2e ShareToEncProtocol) Finalize(share *mhe.KeySwitchingShare, opOut *rlwe.Ciphertext) (err error)
Finalize computes the final encryption of the secret-shared message when provided with the aggregation `c0Agg` of the parties' share in the protocol and with the common, CRS-sampled polynomial `crs`.
func (ShareToEncProtocol) Gen ¶
func (s2e ShareToEncProtocol) Gen(sk *rlwe.SecretKey, seed [32]byte, metadata *rlwe.MetaData, secretShare *mhe.AdditiveShareBigint, publicShare *mhe.KeySwitchingShare) (err error)
Gen generates a party's in the shares-to-encryption protocol given the party's secret-key share `sk`, a common polynomial sampled from the CRS `crs` and the party's secret share of the message.
func (ShareToEncProtocol) ShallowCopy ¶
func (s2e ShareToEncProtocol) ShallowCopy() *ShareToEncProtocol
ShallowCopy creates a shallow copy of ShareToEncProtocol in which all the read-only data-structures are shared with the receiver and the temporary buffers are reallocated. The receiver and the returned ShareToEncProtocol can be used concurrently.