Documentation ¶
Overview ¶
Package mheint implements homomorphic decryption to Linear-Secret-Shared-Shares (LSSS) and homomorphic re-encryption from LSSS, as well as interactive bootstrapping for the package `he/heint` See `mhe/README.md` for additional information on multiparty schemes.
Index ¶
- func NewAdditiveShare(params heint.Parameters) mhe.AdditiveShare
- type EncToShareProtocol
- func (e2s EncToShareProtocol) AllocateShare(level int) (share mhe.KeySwitchShare)
- func (e2s EncToShareProtocol) GenShare(sk *rlwe.SecretKey, ct *rlwe.Ciphertext, secretShareOut *mhe.AdditiveShare, ...)
- func (e2s EncToShareProtocol) GetShare(secretShare *mhe.AdditiveShare, aggregatePublicShare mhe.KeySwitchShare, ...)
- func (e2s EncToShareProtocol) ShallowCopy() EncToShareProtocol
- type MaskedTransformFunc
- type MaskedTransformProtocol
- func (rfp MaskedTransformProtocol) AggregateShares(share1, share2 mhe.RefreshShare, shareOut *mhe.RefreshShare) (err error)
- func (rfp MaskedTransformProtocol) AllocateShare(levelDecrypt, levelRecrypt int) mhe.RefreshShare
- func (rfp MaskedTransformProtocol) GenShare(skIn, skOut *rlwe.SecretKey, ct *rlwe.Ciphertext, crs mhe.KeySwitchCRP, ...) (err error)
- func (rfp *MaskedTransformProtocol) SampleCRP(level int, crs sampling.PRNG) mhe.KeySwitchCRP
- func (rfp MaskedTransformProtocol) ShallowCopy() MaskedTransformProtocol
- func (rfp MaskedTransformProtocol) Transform(ct *rlwe.Ciphertext, transform *MaskedTransformFunc, crs mhe.KeySwitchCRP, ...) (err error)
- type RefreshProtocol
- func (rfp RefreshProtocol) AggregateShares(share1, share2 mhe.RefreshShare, shareOut *mhe.RefreshShare) (err error)
- func (rfp RefreshProtocol) AllocateShare(inputLevel, outputLevel int) mhe.RefreshShare
- func (rfp RefreshProtocol) Finalize(ctIn *rlwe.Ciphertext, crp mhe.KeySwitchCRP, share mhe.RefreshShare, ...) (err error)
- func (rfp RefreshProtocol) GenShare(sk *rlwe.SecretKey, ct *rlwe.Ciphertext, crp mhe.KeySwitchCRP, ...) (err error)
- func (rfp *RefreshProtocol) ShallowCopy() RefreshProtocol
- type ShareToEncProtocol
- func (s2e ShareToEncProtocol) AllocateShare(level int) (share mhe.KeySwitchShare)
- func (s2e ShareToEncProtocol) GenShare(sk *rlwe.SecretKey, crp mhe.KeySwitchCRP, secretShare mhe.AdditiveShare, ...) (err error)
- func (s2e ShareToEncProtocol) GetEncryption(c0Agg mhe.KeySwitchShare, crp mhe.KeySwitchCRP, opOut *rlwe.Ciphertext) (err error)
- func (s2e ShareToEncProtocol) ShallowCopy() ShareToEncProtocol
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAdditiveShare ¶
func NewAdditiveShare(params heint.Parameters) mhe.AdditiveShare
Types ¶
type EncToShareProtocol ¶
type EncToShareProtocol struct { // 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 heint.Parameters, noiseFlooding ring.DistributionParameters) (EncToShareProtocol, error)
NewEncToShareProtocol creates a new EncToShareProtocol struct from the passed heint.Parameters.
func (EncToShareProtocol) AllocateShare ¶
func (e2s EncToShareProtocol) AllocateShare(level int) (share mhe.KeySwitchShare)
AllocateShare allocates a share of the EncToShare protocol
func (EncToShareProtocol) GenShare ¶
func (e2s EncToShareProtocol) GenShare(sk *rlwe.SecretKey, ct *rlwe.Ciphertext, secretShareOut *mhe.AdditiveShare, publicShareOut *mhe.KeySwitchShare)
GenShare 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. ct1 is degree 1 element of a rlwe.Ciphertext, i.e. rlwe.Ciphertext.Value[1].
func (EncToShareProtocol) GetShare ¶
func (e2s EncToShareProtocol) GetShare(secretShare *mhe.AdditiveShare, aggregatePublicShare mhe.KeySwitchShare, ct *rlwe.Ciphertext, secretShareOut *mhe.AdditiveShare)
GetShare 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) 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 is a struct containing a user-defined in-place function that can be applied to masked integer plaintexts, as a part of the Masked Transform Protocol. The function is called with a vector of integers modulo heint.Parameters.PlaintextModulus() of size heint.Parameters.N() as input, and must write its output on the same buffer. Transform can be the identity. Decode: if true, then the masked BFV plaintext will be decoded before applying Transform. Recode: if true, then the masked BFV 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 heint.Parameters, noiseFlooding ring.DistributionParameters) (rfp MaskedTransformProtocol, err error)
NewMaskedTransformProtocol creates a new instance of the PermuteProtocol.
func (MaskedTransformProtocol) AggregateShares ¶
func (rfp MaskedTransformProtocol) AggregateShares(share1, share2 mhe.RefreshShare, shareOut *mhe.RefreshShare) (err error)
AggregateShares sums share1 and share2 on shareOut.
func (MaskedTransformProtocol) AllocateShare ¶
func (rfp MaskedTransformProtocol) AllocateShare(levelDecrypt, levelRecrypt int) mhe.RefreshShare
AllocateShare allocates the shares of the PermuteProtocol
func (MaskedTransformProtocol) GenShare ¶
func (rfp MaskedTransformProtocol) GenShare(skIn, skOut *rlwe.SecretKey, ct *rlwe.Ciphertext, crs mhe.KeySwitchCRP, transform *MaskedTransformFunc, shareOut *mhe.RefreshShare) (err error)
GenShare generates the shares of the PermuteProtocol. ct1 is the degree 1 element of a rlwe.Ciphertext, i.e. rlwe.Ciphertext.Value[1].
func (*MaskedTransformProtocol) SampleCRP ¶
func (rfp *MaskedTransformProtocol) SampleCRP(level int, crs sampling.PRNG) mhe.KeySwitchCRP
SampleCRP samples a common random polynomial to be used in the Masked-Transform protocol from the provided common reference string.
func (MaskedTransformProtocol) ShallowCopy ¶
func (rfp 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) Transform ¶
func (rfp MaskedTransformProtocol) Transform(ct *rlwe.Ciphertext, transform *MaskedTransformFunc, crs mhe.KeySwitchCRP, share mhe.RefreshShare, ciphertextOut *rlwe.Ciphertext) (err error)
Transform applies Decrypt, Recode and Recrypt on the input ciphertext.
type RefreshProtocol ¶
type RefreshProtocol struct {
MaskedTransformProtocol
}
RefreshProtocol is a struct storing the relevant parameters for the Refresh protocol.
func NewRefreshProtocol ¶
func NewRefreshProtocol(params heint.Parameters, noiseFlooding ring.DistributionParameters) (rfp RefreshProtocol, err error)
NewRefreshProtocol creates a new Refresh protocol instance.
func (RefreshProtocol) AggregateShares ¶
func (rfp RefreshProtocol) AggregateShares(share1, share2 mhe.RefreshShare, shareOut *mhe.RefreshShare) (err error)
AggregateShares aggregates two parties' shares in the Refresh protocol.
func (RefreshProtocol) AllocateShare ¶
func (rfp RefreshProtocol) AllocateShare(inputLevel, outputLevel int) mhe.RefreshShare
AllocateShare allocates the shares of the PermuteProtocol
func (RefreshProtocol) Finalize ¶
func (rfp RefreshProtocol) Finalize(ctIn *rlwe.Ciphertext, crp mhe.KeySwitchCRP, share mhe.RefreshShare, opOut *rlwe.Ciphertext) (err error)
Finalize applies Decrypt, Recode and Recrypt on the input ciphertext.
func (RefreshProtocol) GenShare ¶
func (rfp RefreshProtocol) GenShare(sk *rlwe.SecretKey, ct *rlwe.Ciphertext, crp mhe.KeySwitchCRP, shareOut *mhe.RefreshShare) (err error)
GenShare generates a share for the Refresh protocol. ct1 is degree 1 element of a rlwe.Ciphertext, i.e. rlwe.Ciphertext.Value[1].
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 { // 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 heint.Parameters, noiseFlooding ring.DistributionParameters) (ShareToEncProtocol, error)
NewShareToEncProtocol creates a new ShareToEncProtocol struct from the passed integer parameters.
func (ShareToEncProtocol) AllocateShare ¶
func (s2e ShareToEncProtocol) AllocateShare(level int) (share mhe.KeySwitchShare)
AllocateShare allocates a share of the ShareToEnc protocol
func (ShareToEncProtocol) GenShare ¶
func (s2e ShareToEncProtocol) GenShare(sk *rlwe.SecretKey, crp mhe.KeySwitchCRP, secretShare mhe.AdditiveShare, c0ShareOut *mhe.KeySwitchShare) (err error)
GenShare 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 `crp` and the party's secret share of the message.
func (ShareToEncProtocol) GetEncryption ¶
func (s2e ShareToEncProtocol) GetEncryption(c0Agg mhe.KeySwitchShare, crp mhe.KeySwitchCRP, opOut *rlwe.Ciphertext) (err error)
GetEncryption computes the final encryption of the secret-shared message when provided with the aggregation `c0Agg` of the parties' shares in the protocol and with the common, CRS-sampled polynomial `crp`.
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.