Documentation ¶
Overview ¶
Package mhe implements RLWE-based scheme agnostic multiparty key-generation and proxy re-rencryption. See README.md for more details about multiparty homomorphic encryption.
Index ¶
- func NoiseEvaluationKey(params rlwe.Parameters, nbParties int) (std float64)
- func NoiseGaloisKey(params rlwe.Parameters, nbParties int) (std float64)
- func NoiseKeySwitch(params rlwe.Parameters, nbParties int, noisect, noiseflood float64) (std float64)
- func NoisePublicKeySwitch(params rlwe.Parameters, nbParties int, noisect, noiseflood float64) (std float64)
- func NoiseRelinearizationKey(params rlwe.Parameters, nbParties int) (std float64)
- type AdditiveShare
- type AdditiveShareBigint
- type CRS
- type Combiner
- type EvaluationKeyGenCRP
- type EvaluationKeyGenProtocol
- func (evkg EvaluationKeyGenProtocol) AggregateShares(share1, share2 EvaluationKeyGenShare, share3 *EvaluationKeyGenShare) (err error)
- func (evkg EvaluationKeyGenProtocol) AllocateShare(evkParams ...rlwe.EvaluationKeyParameters) EvaluationKeyGenShare
- func (evkg EvaluationKeyGenProtocol) GenEvaluationKey(share EvaluationKeyGenShare, crp EvaluationKeyGenCRP, evk *rlwe.EvaluationKey) (err error)
- func (evkg EvaluationKeyGenProtocol) GenShare(skIn, skOut *rlwe.SecretKey, crp EvaluationKeyGenCRP, ...) (err error)
- func (evkg EvaluationKeyGenProtocol) SampleCRP(crs CRS, evkParams ...rlwe.EvaluationKeyParameters) EvaluationKeyGenCRP
- func (evkg EvaluationKeyGenProtocol) ShallowCopy() EvaluationKeyGenProtocol
- type EvaluationKeyGenShare
- func (share EvaluationKeyGenShare) BinarySize() int
- func (share EvaluationKeyGenShare) MarshalBinary() (p []byte, err error)
- func (share *EvaluationKeyGenShare) ReadFrom(r io.Reader) (n int64, err error)
- func (share *EvaluationKeyGenShare) UnmarshalBinary(p []byte) (err error)
- func (share EvaluationKeyGenShare) WriteTo(w io.Writer) (n int64, err error)
- type GaloisKeyGenCRP
- type GaloisKeyGenProtocol
- func (gkg GaloisKeyGenProtocol) AggregateShares(share1, share2 GaloisKeyGenShare, share3 *GaloisKeyGenShare) (err error)
- func (gkg GaloisKeyGenProtocol) AllocateShare(evkParams ...rlwe.EvaluationKeyParameters) (gkgShare GaloisKeyGenShare)
- func (gkg GaloisKeyGenProtocol) GenGaloisKey(share GaloisKeyGenShare, crp GaloisKeyGenCRP, gk *rlwe.GaloisKey) (err error)
- func (gkg GaloisKeyGenProtocol) GenShare(sk *rlwe.SecretKey, galEl uint64, crp GaloisKeyGenCRP, ...) (err error)
- func (gkg GaloisKeyGenProtocol) SampleCRP(crs CRS, evkParams ...rlwe.EvaluationKeyParameters) GaloisKeyGenCRP
- func (gkg GaloisKeyGenProtocol) ShallowCopy() GaloisKeyGenProtocol
- type GaloisKeyGenShare
- func (share GaloisKeyGenShare) BinarySize() int
- func (share GaloisKeyGenShare) MarshalBinary() (p []byte, err error)
- func (share *GaloisKeyGenShare) ReadFrom(r io.Reader) (n int64, err error)
- func (share *GaloisKeyGenShare) UnmarshalBinary(p []byte) (err error)
- func (share GaloisKeyGenShare) WriteTo(w io.Writer) (n int64, err error)
- type KeySwitchCRP
- type KeySwitchProtocol
- func (cks KeySwitchProtocol) AggregateShares(share1, share2 KeySwitchShare, shareOut *KeySwitchShare) (err error)
- func (cks KeySwitchProtocol) AllocateShare(level int) KeySwitchShare
- func (cks KeySwitchProtocol) GenShare(skInput, skOutput *rlwe.SecretKey, ct *rlwe.Ciphertext, ...)
- func (cks KeySwitchProtocol) KeySwitch(ctIn *rlwe.Ciphertext, combined KeySwitchShare, opOut *rlwe.Ciphertext)
- func (cks KeySwitchProtocol) SampleCRP(level int, crs CRS) KeySwitchCRP
- func (cks KeySwitchProtocol) ShallowCopy() KeySwitchProtocol
- type KeySwitchShare
- func (ckss KeySwitchShare) BinarySize() int
- func (ckss KeySwitchShare) Level() int
- func (ckss KeySwitchShare) MarshalBinary() (p []byte, err error)
- func (ckss *KeySwitchShare) ReadFrom(r io.Reader) (n int64, err error)
- func (ckss *KeySwitchShare) UnmarshalBinary(p []byte) (err error)
- func (ckss KeySwitchShare) WriteTo(w io.Writer) (n int64, err error)
- type PublicKeyGenCRP
- type PublicKeyGenProtocol
- func (ckg PublicKeyGenProtocol) AggregateShares(share1, share2 PublicKeyGenShare, shareOut *PublicKeyGenShare)
- func (ckg PublicKeyGenProtocol) AllocateShare() PublicKeyGenShare
- func (ckg PublicKeyGenProtocol) GenPublicKey(roundShare PublicKeyGenShare, crp PublicKeyGenCRP, pubkey *rlwe.PublicKey)
- func (ckg PublicKeyGenProtocol) GenShare(sk *rlwe.SecretKey, crp PublicKeyGenCRP, shareOut *PublicKeyGenShare)
- func (ckg PublicKeyGenProtocol) SampleCRP(crs CRS) PublicKeyGenCRP
- func (ckg PublicKeyGenProtocol) ShallowCopy() PublicKeyGenProtocol
- type PublicKeyGenShare
- func (share PublicKeyGenShare) BinarySize() int
- func (share PublicKeyGenShare) MarshalBinary() (p []byte, err error)
- func (share *PublicKeyGenShare) ReadFrom(r io.Reader) (n int64, err error)
- func (share *PublicKeyGenShare) UnmarshalBinary(p []byte) (err error)
- func (share PublicKeyGenShare) WriteTo(w io.Writer) (n int64, err error)
- type PublicKeySwitchProtocol
- func (pcks PublicKeySwitchProtocol) AggregateShares(share1, share2 PublicKeySwitchShare, shareOut *PublicKeySwitchShare) (err error)
- func (pcks PublicKeySwitchProtocol) AllocateShare(levelQ int) (s PublicKeySwitchShare)
- func (pcks PublicKeySwitchProtocol) GenShare(sk *rlwe.SecretKey, pk *rlwe.PublicKey, ct *rlwe.Ciphertext, ...)
- func (pcks PublicKeySwitchProtocol) KeySwitch(ctIn *rlwe.Ciphertext, combined PublicKeySwitchShare, opOut *rlwe.Ciphertext)
- func (pcks PublicKeySwitchProtocol) ShallowCopy() PublicKeySwitchProtocol
- type PublicKeySwitchShare
- func (share PublicKeySwitchShare) BinarySize() int
- func (share PublicKeySwitchShare) MarshalBinary() (p []byte, err error)
- func (share *PublicKeySwitchShare) ReadFrom(r io.Reader) (n int64, err error)
- func (share *PublicKeySwitchShare) UnmarshalBinary(p []byte) (err error)
- func (share PublicKeySwitchShare) WriteTo(w io.Writer) (n int64, err error)
- type RefreshShare
- func (share RefreshShare) BinarySize() int
- func (share RefreshShare) MarshalBinary() (p []byte, err error)
- func (share *RefreshShare) ReadFrom(r io.Reader) (n int64, err error)
- func (share *RefreshShare) UnmarshalBinary(p []byte) (err error)
- func (share RefreshShare) WriteTo(w io.Writer) (n int64, err error)
- type RelinearizationKeyGenCRP
- type RelinearizationKeyGenProtocol
- func (ekg RelinearizationKeyGenProtocol) AggregateShares(share1, share2 RelinearizationKeyGenShare, ...)
- func (ekg RelinearizationKeyGenProtocol) AllocateShare(evkParams ...rlwe.EvaluationKeyParameters) (ephSk *rlwe.SecretKey, r1 RelinearizationKeyGenShare, ...)
- func (ekg RelinearizationKeyGenProtocol) GenRelinearizationKey(round1 RelinearizationKeyGenShare, round2 RelinearizationKeyGenShare, ...)
- func (ekg RelinearizationKeyGenProtocol) GenShareRoundOne(sk *rlwe.SecretKey, crp RelinearizationKeyGenCRP, ephSkOut *rlwe.SecretKey, ...)
- func (ekg RelinearizationKeyGenProtocol) GenShareRoundTwo(ephSk, sk *rlwe.SecretKey, round1 RelinearizationKeyGenShare, ...)
- func (ekg RelinearizationKeyGenProtocol) SampleCRP(crs CRS, evkParams ...rlwe.EvaluationKeyParameters) RelinearizationKeyGenCRP
- func (ekg *RelinearizationKeyGenProtocol) ShallowCopy() RelinearizationKeyGenProtocol
- type RelinearizationKeyGenShare
- func (share RelinearizationKeyGenShare) BinarySize() int
- func (share RelinearizationKeyGenShare) MarshalBinary() (data []byte, err error)
- func (share *RelinearizationKeyGenShare) ReadFrom(r io.Reader) (n int64, err error)
- func (share *RelinearizationKeyGenShare) UnmarshalBinary(data []byte) (err error)
- func (share RelinearizationKeyGenShare) WriteTo(w io.Writer) (n int64, err error)
- type ShamirPolynomial
- type ShamirPublicPoint
- type ShamirSecretShare
- func (s ShamirSecretShare) BinarySize() int
- func (s ShamirSecretShare) MarshalBinary() (p []byte, err error)
- func (s *ShamirSecretShare) ReadFrom(r io.Reader) (n int64, err error)
- func (s *ShamirSecretShare) UnmarshalBinary(p []byte) (err error)
- func (s ShamirSecretShare) WriteTo(w io.Writer) (n int64, err error)
- type TestParametersLiteral
- type Thresholdizer
- func (thr Thresholdizer) AggregateShares(share1, share2 ShamirSecretShare, outShare *ShamirSecretShare) (err error)
- func (thr Thresholdizer) AllocateThresholdSecretShare() ShamirSecretShare
- func (thr Thresholdizer) GenShamirPolynomial(threshold int, secret *rlwe.SecretKey) (ShamirPolynomial, error)
- func (thr Thresholdizer) GenShamirSecretShare(recipient ShamirPublicPoint, secretPoly ShamirPolynomial, ...)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NoiseEvaluationKey ¶
func NoiseEvaluationKey(params rlwe.Parameters, nbParties int) (std float64)
NoiseEvaluationKey returns the standard deviation of the noise of each individual elements in a collective EvaluationKey.
func NoiseGaloisKey ¶
func NoiseGaloisKey(params rlwe.Parameters, nbParties int) (std float64)
NoiseGaloisKey returns the standard deviation of the noise of each individual elements in a collective GaloisKey.
func NoiseKeySwitch ¶
func NoiseKeySwitch(params rlwe.Parameters, nbParties int, noisect, noiseflood float64) (std float64)
NoiseKeySwitch returns the standard deviation of the noise of a ciphertext after the KeySwitch protocol
func NoisePublicKeySwitch ¶
func NoisePublicKeySwitch(params rlwe.Parameters, nbParties int, noisect, noiseflood float64) (std float64)
func NoiseRelinearizationKey ¶
func NoiseRelinearizationKey(params rlwe.Parameters, nbParties int) (std float64)
NoiseRelinearizationKey returns the standard deviation of the noise of each individual elements in the collective RelinearizationKey.
Types ¶
type AdditiveShare ¶
type AdditiveShare struct {
}AdditiveShare is a type for storing additively shared values in Z_Q[X] (RNS domain).
func NewAdditiveShare ¶
func NewAdditiveShare(r *ring.Ring) AdditiveShare
NewAdditiveShare instantiates a new additive share struct for the ring defined by the given parameters at maximum level.
type AdditiveShareBigint ¶
type AdditiveShareBigint struct {
}AdditiveShareBigint is a type for storing additively shared values in Z (positional domain).
func NewAdditiveShareBigint ¶
func NewAdditiveShareBigint(n int) AdditiveShareBigint
NewAdditiveShareBigint instantiates a new additive share struct composed of n big.Int elements.
type CRS ¶
CRS is an interface for Common Reference Strings. CRSs are PRNGs for which the read bits are the same for all parties.
type Combiner ¶
type Combiner struct {
// contains filtered or unexported fields
}
Combiner is a type for generating t-out-of-t additive shares from local t-out-of-N shares. It implements the `Combine` operation as presented in "An Efficient Threshold Access-Structure for RLWE-Based Multiparty Homomorphic Encryption" (2022) by Mouchet, C., Bertrand, E., and Hubaux, J. P. (https://eprint.iacr.org/2022/780).
func NewCombiner ¶
func NewCombiner(params rlwe.Parameters, own ShamirPublicPoint, others []ShamirPublicPoint, threshold int) Combiner
NewCombiner creates a new Combiner struct from the parameters and the set of ShamirPublicPoints. Note that the other parameter may contain the instantiator's own ShamirPublicPoint.
func (Combiner) GenAdditiveShare ¶
func (cmb Combiner) GenAdditiveShare(activesPoints []ShamirPublicPoint, ownPoint ShamirPublicPoint, ownShare ShamirSecretShare, skOut *rlwe.SecretKey) (err error)
GenAdditiveShare generates a t-out-of-t additive share of the secret from a local aggregated share ownSecret and the set of active identities, identified by their ShamirPublicPoint. It stores the resulting additive share in skOut.
type EvaluationKeyGenCRP ¶
EvaluationKeyGenCRP is a type for common reference polynomials in the EvaluationKey Generation protocol.
func (EvaluationKeyGenCRP) BaseRNSDecompositionVectorSize ¶
func (crp EvaluationKeyGenCRP) BaseRNSDecompositionVectorSize() int
BaseRNSDecompositionVectorSize returns the number of element in the RNS decomposition basis: Ceil(lenQi / lenPi)
func (EvaluationKeyGenCRP) BaseTwoDecompositionVectorSize ¶
func (crp EvaluationKeyGenCRP) BaseTwoDecompositionVectorSize() (base []int)
BaseTwoDecompositionVectorSize returns the number of element in the Power of two decomposition basis for each prime of Q.
func (EvaluationKeyGenCRP) LevelP ¶
func (crp EvaluationKeyGenCRP) LevelP() int
LevelP returns the level of the auxiliary switching key modulus of the target share.
func (EvaluationKeyGenCRP) LevelQ ¶
func (crp EvaluationKeyGenCRP) LevelQ() int
LevelQ returns the level of the ciphertext modulus of the target share.
type EvaluationKeyGenProtocol ¶
type EvaluationKeyGenProtocol struct {
// contains filtered or unexported fields
}
EvaluationKeyGenProtocol is the structure storing the parameters for the collective EvaluationKey generation.
func NewEvaluationKeyGenProtocol ¶
func NewEvaluationKeyGenProtocol(params rlwe.ParameterProvider) (evkg EvaluationKeyGenProtocol)
NewEvaluationKeyGenProtocol creates a EvaluationKeyGenProtocol instance.
func (EvaluationKeyGenProtocol) AggregateShares ¶
func (evkg EvaluationKeyGenProtocol) AggregateShares(share1, share2 EvaluationKeyGenShare, share3 *EvaluationKeyGenShare) (err error)
AggregateShares computes share3 = share1 + share2.
func (EvaluationKeyGenProtocol) AllocateShare ¶
func (evkg EvaluationKeyGenProtocol) AllocateShare(evkParams ...rlwe.EvaluationKeyParameters) EvaluationKeyGenShare
AllocateShare allocates a party's share in the EvaluationKey Generation.
func (EvaluationKeyGenProtocol) GenEvaluationKey ¶
func (evkg EvaluationKeyGenProtocol) GenEvaluationKey(share EvaluationKeyGenShare, crp EvaluationKeyGenCRP, evk *rlwe.EvaluationKey) (err error)
GenEvaluationKey finalizes the EvaluationKey Generation and populates the input Evaluationkey with the computed collective EvaluationKey.
func (EvaluationKeyGenProtocol) GenShare ¶
func (evkg EvaluationKeyGenProtocol) GenShare(skIn, skOut *rlwe.SecretKey, crp EvaluationKeyGenCRP, shareOut *EvaluationKeyGenShare) (err error)
GenShare generates a party's share in the EvaluationKey Generation.
func (EvaluationKeyGenProtocol) SampleCRP ¶
func (evkg EvaluationKeyGenProtocol) SampleCRP(crs CRS, evkParams ...rlwe.EvaluationKeyParameters) EvaluationKeyGenCRP
SampleCRP samples a common random polynomial to be used in the EvaluationKey Generation from the provided common reference string.
func (EvaluationKeyGenProtocol) ShallowCopy ¶
func (evkg EvaluationKeyGenProtocol) ShallowCopy() EvaluationKeyGenProtocol
ShallowCopy creates a shallow copy of EvaluationKeyGenProtocol in which all the read-only data-structures are shared with the receiver and the temporary buffers are reallocated. The receiver and the returned EvaluationKeyGenProtocol can be used concurrently.
type EvaluationKeyGenShare ¶
type EvaluationKeyGenShare struct {
}EvaluationKeyGenShare is represent a Party's share in the EvaluationKey Generation protocol.
func (EvaluationKeyGenShare) BinarySize ¶
func (share EvaluationKeyGenShare) BinarySize() int
BinarySize returns the serialized size of the object in bytes.
func (EvaluationKeyGenShare) MarshalBinary ¶
func (share EvaluationKeyGenShare) MarshalBinary() (p []byte, err error)
MarshalBinary encodes the object into a binary form on a newly allocated slice of bytes.
func (*EvaluationKeyGenShare) ReadFrom ¶
func (share *EvaluationKeyGenShare) ReadFrom(r io.Reader) (n int64, err error)
ReadFrom reads on the object from an io.Writer. It implements the io.ReaderFrom interface.
Unless r implements the buffer.Reader interface (see see lattice/utils/buffer/reader.go), it will be wrapped into a bufio.Reader. Since this requires allocation, it is preferable to pass a buffer.Reader directly:
- When reading multiple values from a io.Reader, it is preferable to first first wrap io.Reader in a pre-allocated bufio.Reader.
- When reading from a var b []byte, it is preferable to pass a buffer.NewBuffer(b) as w (see lattice/utils/buffer/buffer.go).
func (*EvaluationKeyGenShare) UnmarshalBinary ¶
func (share *EvaluationKeyGenShare) UnmarshalBinary(p []byte) (err error)
UnmarshalBinary decodes a slice of bytes generated by MarshalBinary or WriteTo on the object.
func (EvaluationKeyGenShare) WriteTo ¶
func (share EvaluationKeyGenShare) WriteTo(w io.Writer) (n int64, err error)
WriteTo writes the object on an io.Writer. It implements the io.WriterTo interface, and will write exactly object.BinarySize() bytes on w.
Unless w implements the buffer.Writer interface (see lattice/utils/buffer/writer.go), it will be wrapped into a bufio.Writer. Since this requires allocations, it is preferable to pass a buffer.Writer directly:
- When writing multiple times to a io.Writer, it is preferable to first wrap the io.Writer in a pre-allocated bufio.Writer.
- When writing to a pre-allocated var b []byte, it is preferable to pass buffer.NewBuffer(b) as w (see lattice/utils/buffer/buffer.go).
type GaloisKeyGenCRP ¶
type GaloisKeyGenCRP struct {
EvaluationKeyGenCRP
}
GaloisKeyGenCRP is a type for common reference polynomials in the GaloisKey Generation protocol.
type GaloisKeyGenProtocol ¶
type GaloisKeyGenProtocol struct { EvaluationKeyGenProtocol // contains filtered or unexported fields }
GaloisKeyGenProtocol is the structure storing the parameters for the collective GaloisKeys generation.
func NewGaloisKeyGenProtocol ¶
func NewGaloisKeyGenProtocol(params rlwe.ParameterProvider) (gkg GaloisKeyGenProtocol)
NewGaloisKeyGenProtocol creates a GaloisKeyGenProtocol instance.
func (GaloisKeyGenProtocol) AggregateShares ¶
func (gkg GaloisKeyGenProtocol) AggregateShares(share1, share2 GaloisKeyGenShare, share3 *GaloisKeyGenShare) (err error)
AggregateShares computes share3 = share1 + share2.
func (GaloisKeyGenProtocol) AllocateShare ¶
func (gkg GaloisKeyGenProtocol) AllocateShare(evkParams ...rlwe.EvaluationKeyParameters) (gkgShare GaloisKeyGenShare)
AllocateShare allocates a party's share in the GaloisKey Generation.
func (GaloisKeyGenProtocol) GenGaloisKey ¶
func (gkg GaloisKeyGenProtocol) GenGaloisKey(share GaloisKeyGenShare, crp GaloisKeyGenCRP, gk *rlwe.GaloisKey) (err error)
GenGaloisKey finalizes the GaloisKey Generation and populates the input GaloisKey with the computed collective GaloisKey.
func (GaloisKeyGenProtocol) GenShare ¶
func (gkg GaloisKeyGenProtocol) GenShare(sk *rlwe.SecretKey, galEl uint64, crp GaloisKeyGenCRP, shareOut *GaloisKeyGenShare) (err error)
GenShare generates a party's share in the GaloisKey Generation.
func (GaloisKeyGenProtocol) SampleCRP ¶
func (gkg GaloisKeyGenProtocol) SampleCRP(crs CRS, evkParams ...rlwe.EvaluationKeyParameters) GaloisKeyGenCRP
SampleCRP samples a common random polynomial to be used in the GaloisKey Generation from the provided common reference string.
func (GaloisKeyGenProtocol) ShallowCopy ¶
func (gkg GaloisKeyGenProtocol) ShallowCopy() GaloisKeyGenProtocol
ShallowCopy creates a shallow copy of GaloisKeyGenProtocol in which all the read-only data-structures are shared with the receiver and the temporary buffers are reallocated. The receiver and the returned GaloisKeyGenProtocol can be used concurrently.
type GaloisKeyGenShare ¶
type GaloisKeyGenShare struct {}
GaloisKeyGenShare is represent a Party's share in the GaloisKey Generation protocol.
func (GaloisKeyGenShare) BinarySize ¶
func (share GaloisKeyGenShare) BinarySize() int
BinarySize returns the serialized size of the object in bytes.
func (GaloisKeyGenShare) MarshalBinary ¶
func (share GaloisKeyGenShare) MarshalBinary() (p []byte, err error)
MarshalBinary encodes the object into a binary form on a newly allocated slice of bytes.
func (*GaloisKeyGenShare) ReadFrom ¶
func (share *GaloisKeyGenShare) ReadFrom(r io.Reader) (n int64, err error)
ReadFrom reads on the object from an io.Writer. It implements the io.ReaderFrom interface.
Unless r implements the buffer.Reader interface (see see lattice/utils/buffer/reader.go), it will be wrapped into a bufio.Reader. Since this requires allocation, it is preferable to pass a buffer.Reader directly:
- When reading multiple values from a io.Reader, it is preferable to first first wrap io.Reader in a pre-allocated bufio.Reader.
- When reading from a var b []byte, it is preferable to pass a buffer.NewBuffer(b) as w (see lattice/utils/buffer/buffer.go).
func (*GaloisKeyGenShare) UnmarshalBinary ¶
func (share *GaloisKeyGenShare) UnmarshalBinary(p []byte) (err error)
UnmarshalBinary decodes a slice of bytes generated by MarshalBinary or WriteTo on the object.
func (GaloisKeyGenShare) WriteTo ¶
func (share GaloisKeyGenShare) WriteTo(w io.Writer) (n int64, err error)
WriteTo writes the object on an io.Writer. It implements the io.WriterTo interface, and will write exactly object.BinarySize() bytes on w.
Unless w implements the buffer.Writer interface (see lattice/utils/buffer/writer.go), it will be wrapped into a bufio.Writer. Since this requires allocations, it is preferable to pass a buffer.Writer directly:
- When writing multiple times to a io.Writer, it is preferable to first wrap the io.Writer in a pre-allocated bufio.Writer.
- When writing to a pre-allocated var b []byte, it is preferable to pass buffer.NewBuffer(b) as w (see lattice/utils/buffer/buffer.go).
type KeySwitchCRP ¶
KeySwitchCRP is a type for common reference polynomials in the KeySwitch protocol.
type KeySwitchProtocol ¶
type KeySwitchProtocol struct {
// contains filtered or unexported fields
}
KeySwitchProtocol is the structure storing the parameters and and precomputations for the collective key-switching protocol.
func NewKeySwitchProtocol ¶
func NewKeySwitchProtocol(params rlwe.ParameterProvider, noiseFlooding ring.DistributionParameters) (KeySwitchProtocol, error)
NewKeySwitchProtocol creates a new KeySwitchProtocol that will be used to perform a collective key-switching on a ciphertext encrypted under a collective public-key, whose secret-shares are distributed among j parties, re-encrypting the ciphertext under another public-key, whose secret-shares are also known to the parties.
func (KeySwitchProtocol) AggregateShares ¶
func (cks KeySwitchProtocol) AggregateShares(share1, share2 KeySwitchShare, shareOut *KeySwitchShare) (err error)
AggregateShares is the second part of the unique round of the KeySwitchProtocol protocol. Upon receiving the j-1 elements each party computes :
[ctx[0] + sum((skInput_i - skOutput_i) * ctx[0] + e_i), ctx[1]]
func (KeySwitchProtocol) AllocateShare ¶
func (cks KeySwitchProtocol) AllocateShare(level int) KeySwitchShare
AllocateShare allocates the shares of the KeySwitchProtocol
func (KeySwitchProtocol) GenShare ¶
func (cks KeySwitchProtocol) GenShare(skInput, skOutput *rlwe.SecretKey, ct *rlwe.Ciphertext, shareOut *KeySwitchShare)
GenShare computes a party's share in the KeySwitchcol from secret-key skInput to secret-key skOutput. ct is the rlwe.Ciphertext to keyswitch. Note that ct.Value[0] is not used by the function and can be nil/zero.
Expected noise: ctNoise + encFreshSk + smudging
func (KeySwitchProtocol) KeySwitch ¶
func (cks KeySwitchProtocol) KeySwitch(ctIn *rlwe.Ciphertext, combined KeySwitchShare, opOut *rlwe.Ciphertext)
KeySwitch performs the actual keyswitching operation on a ciphertext ct and put the result in opOut
func (KeySwitchProtocol) SampleCRP ¶
func (cks KeySwitchProtocol) SampleCRP(level int, crs CRS) KeySwitchCRP
SampleCRP samples a common random polynomial to be used in the KeySwitch protocol from the provided common reference string.
func (KeySwitchProtocol) ShallowCopy ¶
func (cks KeySwitchProtocol) ShallowCopy() KeySwitchProtocol
ShallowCopy creates a shallow copy of KeySwitchProtocol in which all the read-only data-structures are shared with the receiver and the temporary bufers are reallocated. The receiver and the returned KeySwitchProtocol can be used concurrently.
type KeySwitchShare ¶
type KeySwitchShare struct {
}KeySwitchShare is a type for the KeySwitch protocol shares.
func (KeySwitchShare) BinarySize ¶
func (ckss KeySwitchShare) BinarySize() int
BinarySize returns the serialized size of the object in bytes.
func (KeySwitchShare) Level ¶
func (ckss KeySwitchShare) Level() int
Level returns the level of the target share.
func (KeySwitchShare) MarshalBinary ¶
func (ckss KeySwitchShare) MarshalBinary() (p []byte, err error)
MarshalBinary encodes a KeySwitch share on a slice of bytes.
func (*KeySwitchShare) ReadFrom ¶
func (ckss *KeySwitchShare) ReadFrom(r io.Reader) (n int64, err error)
ReadFrom reads on the object from an io.Writer. It implements the io.ReaderFrom interface.
Unless r implements the buffer.Reader interface (see see lattice/utils/buffer/reader.go), it will be wrapped into a bufio.Reader. Since this requires allocation, it is preferable to pass a buffer.Reader directly:
- When reading multiple values from a io.Reader, it is preferable to first first wrap io.Reader in a pre-allocated bufio.Reader.
- When reading from a var b []byte, it is preferable to pass a buffer.NewBuffer(b) as w (see lattice/utils/buffer/buffer.go).
func (*KeySwitchShare) UnmarshalBinary ¶
func (ckss *KeySwitchShare) UnmarshalBinary(p []byte) (err error)
UnmarshalBinary decodes a slice of bytes generated by MarshalBinary or WriteTo on the object.
func (KeySwitchShare) WriteTo ¶
func (ckss KeySwitchShare) WriteTo(w io.Writer) (n int64, err error)
WriteTo writes the object on an io.Writer. It implements the io.WriterTo interface, and will write exactly object.BinarySize() bytes on w.
Unless w implements the buffer.Writer interface (see lattice/utils/buffer/writer.go), it will be wrapped into a bufio.Writer. Since this requires allocations, it is preferable to pass a buffer.Writer directly:
- When writing multiple times to a io.Writer, it is preferable to first wrap the io.Writer in a pre-allocated bufio.Writer.
- When writing to a pre-allocated var b []byte, it is preferable to pass buffer.NewBuffer(b) as w (see lattice/utils/buffer/buffer.go).
type PublicKeyGenCRP ¶
PublicKeyGenCRP is a type for common reference polynomials in the PublicKeyGen protocol.
type PublicKeyGenProtocol ¶
type PublicKeyGenProtocol struct {
// contains filtered or unexported fields
}
PublicKeyGenProtocol is the structure storing the parameters and and precomputations for the collective encryption key generation protocol.
func NewPublicKeyGenProtocol ¶
func NewPublicKeyGenProtocol(params rlwe.ParameterProvider) PublicKeyGenProtocol
NewPublicKeyGenProtocol creates a new PublicKeyGenProtocol instance
func (PublicKeyGenProtocol) AggregateShares ¶
func (ckg PublicKeyGenProtocol) AggregateShares(share1, share2 PublicKeyGenShare, shareOut *PublicKeyGenShare)
AggregateShares aggregates a new share to the aggregate key
func (PublicKeyGenProtocol) AllocateShare ¶
func (ckg PublicKeyGenProtocol) AllocateShare() PublicKeyGenShare
AllocateShare allocates the share of the PublicKeyGen protocol.
func (PublicKeyGenProtocol) GenPublicKey ¶
func (ckg PublicKeyGenProtocol) GenPublicKey(roundShare PublicKeyGenShare, crp PublicKeyGenCRP, pubkey *rlwe.PublicKey)
GenPublicKey return the current aggregation of the received shares as a bfv.PublicKey.
func (PublicKeyGenProtocol) GenShare ¶
func (ckg PublicKeyGenProtocol) GenShare(sk *rlwe.SecretKey, crp PublicKeyGenCRP, shareOut *PublicKeyGenShare)
GenShare generates the party's public key share from its secret key as:
crp*s_i + e_i
for the receiver protocol. Has no effect is the share was already generated.
func (PublicKeyGenProtocol) SampleCRP ¶
func (ckg PublicKeyGenProtocol) SampleCRP(crs CRS) PublicKeyGenCRP
SampleCRP samples a common random polynomial to be used in the PublicKeyGen protocol from the provided common reference string.
func (PublicKeyGenProtocol) ShallowCopy ¶
func (ckg PublicKeyGenProtocol) ShallowCopy() PublicKeyGenProtocol
ShallowCopy creates a shallow copy of PublicKeyGenProtocol in which all the read-only data-structures are shared with the receiver and the temporary buffers are reallocated. The receiver and the returned PublicKeyGenProtocol can be used concurrently.
type PublicKeyGenShare ¶
type PublicKeyGenShare struct {
}PublicKeyGenShare is a struct storing the PublicKeyGen protocol's share.
func (PublicKeyGenShare) BinarySize ¶
func (share PublicKeyGenShare) BinarySize() int
BinarySize returns the serialized size of the object in bytes.
func (PublicKeyGenShare) MarshalBinary ¶
func (share PublicKeyGenShare) MarshalBinary() (p []byte, err error)
MarshalBinary encodes the object into a binary form on a newly allocated slice of bytes.
func (*PublicKeyGenShare) ReadFrom ¶
func (share *PublicKeyGenShare) ReadFrom(r io.Reader) (n int64, err error)
ReadFrom reads on the object from an io.Writer. It implements the io.ReaderFrom interface.
Unless r implements the buffer.Reader interface (see see lattice/utils/buffer/reader.go), it will be wrapped into a bufio.Reader. Since this requires allocation, it is preferable to pass a buffer.Reader directly:
- When reading multiple values from a io.Reader, it is preferable to first first wrap io.Reader in a pre-allocated bufio.Reader.
- When reading from a var b []byte, it is preferable to pass a buffer.NewBuffer(b) as w (see lattice/utils/buffer/buffer.go).
func (*PublicKeyGenShare) UnmarshalBinary ¶
func (share *PublicKeyGenShare) UnmarshalBinary(p []byte) (err error)
UnmarshalBinary decodes a slice of bytes generated by MarshalBinary or WriteTo on the object.
func (PublicKeyGenShare) WriteTo ¶
func (share PublicKeyGenShare) WriteTo(w io.Writer) (n int64, err error)
WriteTo writes the object on an io.Writer. It implements the io.WriterTo interface, and will write exactly object.BinarySize() bytes on w.
Unless w implements the buffer.Writer interface (see lattice/utils/buffer/writer.go), it will be wrapped into a bufio.Writer. Since this requires allocations, it is preferable to pass a buffer.Writer directly:
- When writing multiple times to a io.Writer, it is preferable to first wrap the io.Writer in a pre-allocated bufio.Writer.
- When writing to a pre-allocated var b []byte, it is preferable to pass buffer.NewBuffer(b) as w (see lattice/utils/buffer/buffer.go).
type PublicKeySwitchProtocol ¶
PublicKeySwitchProtocol is the structure storing the parameters for the collective public key-switching.
func NewPublicKeySwitchProtocol ¶
func NewPublicKeySwitchProtocol(params rlwe.ParameterProvider, noiseFlooding ring.DistributionParameters) (pcks PublicKeySwitchProtocol, err error)
NewPublicKeySwitchProtocol creates a new PublicKeySwitchProtocol object and will be used to re-encrypt a ciphertext ctx encrypted under a secret-shared key among j parties under a new collective public-key.
func (PublicKeySwitchProtocol) AggregateShares ¶
func (pcks PublicKeySwitchProtocol) AggregateShares(share1, share2 PublicKeySwitchShare, shareOut *PublicKeySwitchShare) (err error)
AggregateShares is the second part of the first and unique round of the PublicKeySwitchProtocol protocol. Each party upon receiving the j-1 elements from the other parties computes :
[ctx[0] + sum(s_i * ctx[0] + u_i * pk[0] + e_0i), sum(u_i * pk[1] + e_1i)]
func (PublicKeySwitchProtocol) AllocateShare ¶
func (pcks PublicKeySwitchProtocol) AllocateShare(levelQ int) (s PublicKeySwitchShare)
AllocateShare allocates the shares of the PublicKeySwitch protocol.
func (PublicKeySwitchProtocol) GenShare ¶
func (pcks PublicKeySwitchProtocol) GenShare(sk *rlwe.SecretKey, pk *rlwe.PublicKey, ct *rlwe.Ciphertext, shareOut *PublicKeySwitchShare)
GenShare computes a party's share in the PublicKeySwitch protocol from secret-key sk to public-key pk. ct is the rlwe.Ciphertext to keyswitch. Note that ct.Value[0] is not used by the function and can be nil/zero.
Expected noise: ctNoise + encFreshPk + smudging
func (PublicKeySwitchProtocol) KeySwitch ¶
func (pcks PublicKeySwitchProtocol) KeySwitch(ctIn *rlwe.Ciphertext, combined PublicKeySwitchShare, opOut *rlwe.Ciphertext)
KeySwitch performs the actual keyswitching operation on a ciphertext ct and put the result in opOut
func (PublicKeySwitchProtocol) ShallowCopy ¶
func (pcks PublicKeySwitchProtocol) ShallowCopy() PublicKeySwitchProtocol
ShallowCopy creates a shallow copy of PublicKeySwitchProtocol in which all the read-only data-structures are shared with the receiver and the temporary bufers are reallocated. The receiver and the returned PublicKeySwitchProtocol can be used concurrently.
type PublicKeySwitchShare ¶
PublicKeySwitchShare represents a party's share in the PublicKeySwitch protocol.
func (PublicKeySwitchShare) BinarySize ¶
func (share PublicKeySwitchShare) BinarySize() int
BinarySize returns the serialized size of the object in bytes.
func (PublicKeySwitchShare) MarshalBinary ¶
func (share PublicKeySwitchShare) MarshalBinary() (p []byte, err error)
MarshalBinary encodes the object into a binary form on a newly allocated slice of bytes.
func (*PublicKeySwitchShare) ReadFrom ¶
func (share *PublicKeySwitchShare) ReadFrom(r io.Reader) (n int64, err error)
ReadFrom reads on the object from an io.Writer. It implements the io.ReaderFrom interface.
Unless r implements the buffer.Reader interface (see see lattice/utils/buffer/reader.go), it will be wrapped into a bufio.Reader. Since this requires allocation, it is preferable to pass a buffer.Reader directly:
- When reading multiple values from a io.Reader, it is preferable to first first wrap io.Reader in a pre-allocated bufio.Reader.
- When reading from a var b []byte, it is preferable to pass a buffer.NewBuffer(b) as w (see lattice/utils/buffer/buffer.go).
func (*PublicKeySwitchShare) UnmarshalBinary ¶
func (share *PublicKeySwitchShare) UnmarshalBinary(p []byte) (err error)
UnmarshalBinary decodes a slice of bytes generated by MarshalBinary or WriteTo on the object.
func (PublicKeySwitchShare) WriteTo ¶
func (share PublicKeySwitchShare) WriteTo(w io.Writer) (n int64, err error)
WriteTo writes the object on an io.Writer. It implements the io.WriterTo interface, and will write exactly object.BinarySize() bytes on w.
Unless w implements the buffer.Writer interface (see lattice/utils/buffer/writer.go), it will be wrapped into a bufio.Writer. Since this requires allocations, it is preferable to pass a buffer.Writer directly:
- When writing multiple times to a io.Writer, it is preferable to first wrap the io.Writer in a pre-allocated bufio.Writer.
- When writing to a pre-allocated var b []byte, it is preferable to pass buffer.NewBuffer(b) as w (see lattice/utils/buffer/buffer.go).
type RefreshShare ¶
type RefreshShare struct {}
RefreshShare is a struct storing the decryption and recryption shares.
func (RefreshShare) BinarySize ¶
func (share RefreshShare) BinarySize() int
BinarySize returns the serialized size of the object in bytes.
func (RefreshShare) MarshalBinary ¶
func (share RefreshShare) MarshalBinary() (p []byte, err error)
MarshalBinary encodes the object into a binary form on a newly allocated slice of bytes.
func (*RefreshShare) ReadFrom ¶
func (share *RefreshShare) ReadFrom(r io.Reader) (n int64, err error)
ReadFrom reads on the object from an io.Writer. It implements the io.ReaderFrom interface.
Unless r implements the buffer.Reader interface (see see lattice/utils/buffer/reader.go), it will be wrapped into a bufio.Reader. Since this requires allocation, it is preferable to pass a buffer.Reader directly:
- When reading multiple values from a io.Reader, it is preferable to first first wrap io.Reader in a pre-allocated bufio.Reader.
- When reading from a var b []byte, it is preferable to pass a buffer.NewBuffer(b) as w (see lattice/utils/buffer/buffer.go).
func (*RefreshShare) UnmarshalBinary ¶
func (share *RefreshShare) UnmarshalBinary(p []byte) (err error)
UnmarshalBinary decodes a slice of bytes generated by MarshalBinary or WriteTo on the object.
func (RefreshShare) WriteTo ¶
func (share RefreshShare) WriteTo(w io.Writer) (n int64, err error)
WriteTo writes the object on an io.Writer. It implements the io.WriterTo interface, and will write exactly object.BinarySize() bytes on w.
Unless w implements the buffer.Writer interface (see lattice/utils/buffer/writer.go), it will be wrapped into a bufio.Writer. Since this requires allocations, it is preferable to pass a buffer.Writer directly:
- When writing multiple times to a io.Writer, it is preferable to first wrap the io.Writer in a pre-allocated bufio.Writer.
- When writing to a pre-allocated var b []byte, it is preferable to pass buffer.NewBuffer(b) as w (see lattice/utils/buffer/buffer.go).
type RelinearizationKeyGenCRP ¶
RelinearizationKeyGenCRP is a type for common reference polynomials in the RelinearizationKeyGen protocol.
type RelinearizationKeyGenProtocol ¶
type RelinearizationKeyGenProtocol struct {
// contains filtered or unexported fields
}
RelinearizationKeyGenProtocol is the structure storing the parameters and and precomputations for the collective relinearization key generation protocol.
func NewRelinearizationKeyGenProtocol ¶
func NewRelinearizationKeyGenProtocol(params rlwe.ParameterProvider) RelinearizationKeyGenProtocol
NewRelinearizationKeyGenProtocol creates a new RelinearizationKeyGen protocol struct.
func (RelinearizationKeyGenProtocol) AggregateShares ¶
func (ekg RelinearizationKeyGenProtocol) AggregateShares(share1, share2 RelinearizationKeyGenShare, shareOut *RelinearizationKeyGenShare)
AggregateShares combines two RelinearizationKeyGen shares into a single one.
func (RelinearizationKeyGenProtocol) AllocateShare ¶
func (ekg RelinearizationKeyGenProtocol) AllocateShare(evkParams ...rlwe.EvaluationKeyParameters) (ephSk *rlwe.SecretKey, r1 RelinearizationKeyGenShare, r2 RelinearizationKeyGenShare)
AllocateShare allocates the share of the EKG protocol.
func (RelinearizationKeyGenProtocol) GenRelinearizationKey ¶
func (ekg RelinearizationKeyGenProtocol) GenRelinearizationKey(round1 RelinearizationKeyGenShare, round2 RelinearizationKeyGenShare, evalKeyOut *rlwe.RelinearizationKey)
GenRelinearizationKey computes the generated RLK from the public shares and write the result in evalKeyOut.
round1 = [u * a + s * P + e0, s * a + e1]
round2 = sum([s_i * {u * a + s * P + e0} + e_i2, (u_i - s_i) * {s * a + e1} + e_i3])
= [-sua + P*s^2 + s*e0 + e2, sua + ue1 - s^2a -s*e1 + e3]
[round2[0] + round2[1], round1[1]] = [- s^2a - s*e1 + P*s^2 + s*e0 + u*e1 + e2 + e3, s * a + e1]
= [s * b + P * s^2 + s*e0 + u*e1 + e2 + e3, b]
func (RelinearizationKeyGenProtocol) GenShareRoundOne ¶
func (ekg RelinearizationKeyGenProtocol) GenShareRoundOne(sk *rlwe.SecretKey, crp RelinearizationKeyGenCRP, ephSkOut *rlwe.SecretKey, shareOut *RelinearizationKeyGenShare)
GenShareRoundOne is the first of three rounds of the RelinearizationKeyGenProtocol protocol. Each party generates a pseudo encryption of its secret share of the key s_i under its ephemeral key u_i : [-u_i*a + s_i*w + e_i] and broadcasts it to the other j-1 parties.
round1 = [-u_i * a + s_i * P + e_0i, s_i* a + e_i1]
func (RelinearizationKeyGenProtocol) GenShareRoundTwo ¶
func (ekg RelinearizationKeyGenProtocol) GenShareRoundTwo(ephSk, sk *rlwe.SecretKey, round1 RelinearizationKeyGenShare, shareOut *RelinearizationKeyGenShare)
GenShareRoundTwo is the second of three rounds of the RelinearizationKeyGenProtocol protocol. Upon receiving the j-1 shares, each party computes :
round1 = sum([-u_i * a + s_i * P + e_0i, s_i* a + e_i1])
= [u * a + s * P + e0, s * a + e1]
round2 = [s_i * round1[0] + e_i2, (u_i - s_i) * round1[1] + e_i3]
= [s_i * {u * a + s * P + e0} + e_i2, (u_i - s_i) * {s * a + e1} + e_i3]
and broadcasts both values to the other j-1 parties.
func (RelinearizationKeyGenProtocol) SampleCRP ¶
func (ekg RelinearizationKeyGenProtocol) SampleCRP(crs CRS, evkParams ...rlwe.EvaluationKeyParameters) RelinearizationKeyGenCRP
SampleCRP samples a common random polynomial to be used in the RelinearizationKeyGen protocol from the provided common reference string.
func (*RelinearizationKeyGenProtocol) ShallowCopy ¶
func (ekg *RelinearizationKeyGenProtocol) ShallowCopy() RelinearizationKeyGenProtocol
ShallowCopy creates a shallow copy of RelinearizationKeyGenProtocol in which all the read-only data-structures are shared with the receiver and the temporary buffers are reallocated. The receiver and the returned RelinearizationKeyGenProtocol can be used concurrently.
type RelinearizationKeyGenShare ¶
type RelinearizationKeyGenShare struct {
}RelinearizationKeyGenShare is a share in the RelinearizationKeyGen protocol.
func (RelinearizationKeyGenShare) BinarySize ¶
func (share RelinearizationKeyGenShare) BinarySize() int
BinarySize returns the serialized size of the object in bytes.
func (RelinearizationKeyGenShare) MarshalBinary ¶
func (share RelinearizationKeyGenShare) MarshalBinary() (data []byte, err error)
MarshalBinary encodes the object into a binary form on a newly allocated slice of bytes.
func (*RelinearizationKeyGenShare) ReadFrom ¶
func (share *RelinearizationKeyGenShare) ReadFrom(r io.Reader) (n int64, err error)
ReadFrom reads on the object from an io.Writer. It implements the io.ReaderFrom interface.
Unless r implements the buffer.Reader interface (see see lattice/utils/buffer/reader.go), it will be wrapped into a bufio.Reader. Since this requires allocation, it is preferable to pass a buffer.Reader directly:
- When reading multiple values from a io.Reader, it is preferable to first first wrap io.Reader in a pre-allocated bufio.Reader.
- When reading from a var b []byte, it is preferable to pass a buffer.NewBuffer(b) as w (see lattice/utils/buffer/buffer.go).
func (*RelinearizationKeyGenShare) UnmarshalBinary ¶
func (share *RelinearizationKeyGenShare) UnmarshalBinary(data []byte) (err error)
UnmarshalBinary decodes a slice of bytes generated by MarshalBinary or WriteTo on the object.
func (RelinearizationKeyGenShare) WriteTo ¶
func (share RelinearizationKeyGenShare) WriteTo(w io.Writer) (n int64, err error)
WriteTo writes the object on an io.Writer. It implements the io.WriterTo interface, and will write exactly object.BinarySize() bytes on w.
Unless w implements the buffer.Writer interface (see lattice/utils/buffer/writer.go), it will be wrapped into a bufio.Writer. Since this requires allocations, it is preferable to pass a buffer.Writer directly:
- When writing multiple times to a io.Writer, it is preferable to first wrap the io.Writer in a pre-allocated bufio.Writer.
- When writing to a pre-allocated var b []byte, it is preferable to pass buffer.NewBuffer(b) as w (see lattice/utils/buffer/buffer.go).
type ShamirPolynomial ¶
ShamirPolynomial represents a polynomial with ringqp.Poly coefficients. It is used by the Thresholdizer type to produce t-out-of-N-threshold shares of an ringqp.Poly.
See Thresholdizer type.
type ShamirPublicPoint ¶
type ShamirPublicPoint uint64
ShamirPublicPoint is a type for Shamir public point associated with a party identity within the t-out-of-N-threshold scheme.
See Thresholdizer and Combiner types.
type ShamirSecretShare ¶
type ShamirSecretShare struct {
}ShamirSecretShare represents a t-out-of-N-threshold secret-share.
See Thresholdizer and Combiner types.
func (ShamirSecretShare) BinarySize ¶
func (s ShamirSecretShare) BinarySize() int
BinarySize returns the serialized size of the object in bytes.
func (ShamirSecretShare) MarshalBinary ¶
func (s ShamirSecretShare) MarshalBinary() (p []byte, err error)
MarshalBinary encodes the object into a binary form on a newly allocated slice of bytes.
func (*ShamirSecretShare) ReadFrom ¶
func (s *ShamirSecretShare) ReadFrom(r io.Reader) (n int64, err error)
ReadFrom reads on the object from an io.Writer. It implements the io.ReaderFrom interface.
Unless r implements the buffer.Reader interface (see see lattice/utils/buffer/reader.go), it will be wrapped into a bufio.Reader. Since this requires allocation, it is preferable to pass a buffer.Reader directly:
- When reading multiple values from a io.Reader, it is preferable to first first wrap io.Reader in a pre-allocated bufio.Reader.
- When reading from a var b []byte, it is preferable to pass a buffer.NewBuffer(b) as w (see lattice/utils/buffer/buffer.go).
func (*ShamirSecretShare) UnmarshalBinary ¶
func (s *ShamirSecretShare) UnmarshalBinary(p []byte) (err error)
UnmarshalBinary decodes a slice of bytes generated by MarshalBinary or WriteTo on the object.
func (ShamirSecretShare) WriteTo ¶
func (s ShamirSecretShare) WriteTo(w io.Writer) (n int64, err error)
WriteTo writes the object on an io.Writer. It implements the io.WriterTo interface, and will write exactly object.BinarySize() bytes on w.
Unless w implements the buffer.Writer interface (see lattice/utils/buffer/writer.go), it will be wrapped into a bufio.Writer. Since this requires allocations, it is preferable to pass a buffer.Writer directly:
- When writing multiple times to a io.Writer, it is preferable to first wrap the io.Writer in a pre-allocated bufio.Writer.
- When writing to a pre-allocated var b []byte, it is preferable to pass buffer.NewBuffer(b) as w (see lattice/utils/buffer/buffer.go).
type TestParametersLiteral ¶
type TestParametersLiteral struct { BaseTwoDecomposition int rlwe.ParametersLiteral }
type Thresholdizer ¶
type Thresholdizer struct {
// contains filtered or unexported fields
}
Thresholdizer is a type for generating secret-shares of ringqp.Poly types such that the resulting sharing has a t-out-of-N-threshold access-structure. It implements the `Thresholdize` operation as presented in "An Efficient Threshold Access-Structure for RLWE-Based Multiparty Homomorphic Encryption" (2022) by Mouchet, C., Bertrand, E., and Hubaux, J. P. (https://eprint.iacr.org/2022/780).
See the `mhe` package README.md.
func NewThresholdizer ¶
func NewThresholdizer(params rlwe.ParameterProvider) Thresholdizer
NewThresholdizer creates a new Thresholdizer instance from parameters.
func (Thresholdizer) AggregateShares ¶
func (thr Thresholdizer) AggregateShares(share1, share2 ShamirSecretShare, outShare *ShamirSecretShare) (err error)
AggregateShares aggregates two ShamirSecretShare and stores the result in outShare.
func (Thresholdizer) AllocateThresholdSecretShare ¶
func (thr Thresholdizer) AllocateThresholdSecretShare() ShamirSecretShare
AllocateThresholdSecretShare allocates a ShamirSecretShare struct.
func (Thresholdizer) GenShamirPolynomial ¶
func (thr Thresholdizer) GenShamirPolynomial(threshold int, secret *rlwe.SecretKey) (ShamirPolynomial, error)
GenShamirPolynomial generates a new secret ShamirPolynomial to be used in the Thresholdizer.GenShamirSecretShare method. It does so by sampling a random polynomial of degree threshold - 1 and with its constant term equal to secret.
func (Thresholdizer) GenShamirSecretShare ¶
func (thr Thresholdizer) GenShamirSecretShare(recipient ShamirPublicPoint, secretPoly ShamirPolynomial, shareOut *ShamirSecretShare)
GenShamirSecretShare generates a secret share for the given recipient, identified by its ShamirPublicPoint. The result is stored in ShareOut and should be sent to this party.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
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.
|
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. |
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.
|
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. |