mheint

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 20, 2024 License: Apache-2.0, BSD-3-Clause, ISC, + 1 more Imports: 7 Imported by: 0

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

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 {
	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 heint.Parameters) *EncToShareProtocol

NewEncToShareProtocol creates a new EncToShareProtocol struct from the passed heint.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.AdditiveShare, aggregatePublicShare *mhe.KeySwitchingShare, ct *rlwe.Ciphertext, secretShareOut *mhe.AdditiveShare)

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, ct *rlwe.Ciphertext, secretShareOut *mhe.AdditiveShare, 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. ct1 is degree 1 element of a rlwe.Ciphertext, i.e. rlwe.Ciphertext.Value[1].

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

type MaskedTransformFunc struct {
	Decode bool
	Func   func(coeffs []uint64)
	Encode bool
}

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.TK() 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) *MaskedTransformProtocol

NewMaskedTransformProtocol creates a new instance of the PermuteProtocol.

func (MaskedTransformProtocol) Aggregate

func (p MaskedTransformProtocol) Aggregate(share1, share2, share3 *mhe.RefreshShare) (err error)

Aggregate aggregates the public aggregatable transcripts: share3 = share1 + share2.

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 applies Decrypt, Recode and Recrypt on the input ciphertext.

func (MaskedTransformProtocol) Gen

func (p MaskedTransformProtocol) Gen(skIn, skOut *rlwe.SecretKey, ct *rlwe.Ciphertext, seed [32]byte, transform *MaskedTransformFunc, shareOut *mhe.RefreshShare) (err error)

Gen generates the shares of the PermuteProtocol. ct1 is the degree 1 element of a rlwe.Ciphertext, i.e. rlwe.Ciphertext.Value[1].

func (MaskedTransformProtocol) ShallowCopy

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

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 heint.Parameters) *RefreshProtocol

NewRefreshProtocol creates a new Refresh protocol instance.

func (RefreshProtocol) Aggregate

func (rfp RefreshProtocol) Aggregate(share1, share2, share3 *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.

func (RefreshProtocol) Gen

func (rfp RefreshProtocol) Gen(sk *rlwe.SecretKey, ct *rlwe.Ciphertext, seed [32]byte, share *mhe.RefreshShare) (err error)

Gen 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 {
	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 heint.Parameters) *ShareToEncProtocol

NewShareToEncProtocol creates a new ShareToEncProtocol struct from the passed integer 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' shares in the protocol and with the common, CRS-sampled polynomial `crp`.

func (ShareToEncProtocol) Gen

func (s2e ShareToEncProtocol) Gen(sk *rlwe.SecretKey, seed [32]byte, secretShare *mhe.AdditiveShare, 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 `crp` 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL