ThresholdKey renamed to ThresholdPublicKey
This commit is contained in:
4 files changed
+36
-36
No files matched your search
+7
-7
@@ -59,7 +59,7 @@ type dbThresholdKey struct {
|
|||||||
N string
|
N string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *dbThresholdKey) FromThresholdKey(key *ThresholdKey) {
|
func (this *dbThresholdKey) FromThresholdPublicKey(key *ThresholdPublicKey) {
|
||||||
this.TotalNumberOfDecryptionServers = key.TotalNumberOfDecryptionServers
|
this.TotalNumberOfDecryptionServers = key.TotalNumberOfDecryptionServers
|
||||||
this.Threshold = key.Threshold
|
this.Threshold = key.Threshold
|
||||||
this.V = fmt.Sprintf("%x", key.V)
|
this.V = fmt.Sprintf("%x", key.V)
|
||||||
@@ -70,7 +70,7 @@ func (this *dbThresholdKey) FromThresholdKey(key *ThresholdKey) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *dbThresholdKey) ToThresholdKey(key *ThresholdKey) error {
|
func (this *dbThresholdKey) ToThresholdPublicKey(key *ThresholdPublicKey) error {
|
||||||
key.TotalNumberOfDecryptionServers = this.TotalNumberOfDecryptionServers
|
key.TotalNumberOfDecryptionServers = this.TotalNumberOfDecryptionServers
|
||||||
key.Threshold = this.Threshold
|
key.Threshold = this.Threshold
|
||||||
oks := make([]bool, 2)
|
oks := make([]bool, 2)
|
||||||
@@ -91,18 +91,18 @@ func (this *dbThresholdKey) ToThresholdKey(key *ThresholdKey) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *ThresholdKey) GetBSON() (interface{}, error) {
|
func (this *ThresholdPublicKey) GetBSON() (interface{}, error) {
|
||||||
r := new(dbThresholdKey)
|
r := new(dbThresholdKey)
|
||||||
r.FromThresholdKey(this)
|
r.FromThresholdPublicKey(this)
|
||||||
return r, nil
|
return r, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *ThresholdKey) SetBSON(raw bson.Raw) error {
|
func (this *ThresholdPublicKey) SetBSON(raw bson.Raw) error {
|
||||||
r := new(dbThresholdKey)
|
r := new(dbThresholdKey)
|
||||||
if err := raw.Unmarshal(r); err != nil {
|
if err := raw.Unmarshal(r); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return r.ToThresholdKey(this)
|
return r.ToThresholdPublicKey(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
type dbPrivateKey struct {
|
type dbPrivateKey struct {
|
||||||
@@ -175,7 +175,7 @@ func (this *dbPartialDecryptionZKP) FromPartialDecryptionZKP(pd *PartialDecrypti
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *dbPartialDecryptionZKP) ToPartialDecryptionZKP(pd *PartialDecryptionZKP) error {
|
func (this *dbPartialDecryptionZKP) ToPartialDecryptionZKP(pd *PartialDecryptionZKP) error {
|
||||||
pd.Key = new(ThresholdKey)
|
pd.Key = new(ThresholdPublicKey)
|
||||||
|
|
||||||
var oks = make([]bool, 6)
|
var oks = make([]bool, 6)
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -81,7 +81,7 @@ func TestGetBSONEmptyKey(t *testing.T) {
|
|||||||
|
|
||||||
func TestPartialDecryptionZKPJsonification(t *testing.T) {
|
func TestPartialDecryptionZKPJsonification(t *testing.T) {
|
||||||
pd := new(PartialDecryptionZKP)
|
pd := new(PartialDecryptionZKP)
|
||||||
pd.Key = new(ThresholdKey)
|
pd.Key = new(ThresholdPublicKey)
|
||||||
pd.Key.Threshold = 98
|
pd.Key.Threshold = 98
|
||||||
pd.Key.TotalNumberOfDecryptionServers = 230
|
pd.Key.TotalNumberOfDecryptionServers = 230
|
||||||
pd.Id = 1
|
pd.Id = 1
|
||||||
@@ -99,7 +99,7 @@ func TestPartialDecryptionZKPJsonification(t *testing.T) {
|
|||||||
|
|
||||||
func TestPartialDecryptionZKPBSONification(t *testing.T) {
|
func TestPartialDecryptionZKPBSONification(t *testing.T) {
|
||||||
pd := new(PartialDecryptionZKP)
|
pd := new(PartialDecryptionZKP)
|
||||||
pd.Key = new(ThresholdKey)
|
pd.Key = new(ThresholdPublicKey)
|
||||||
pd.Key.Threshold = 98
|
pd.Key.Threshold = 98
|
||||||
pd.Key.TotalNumberOfDecryptionServers = 230
|
pd.Key.TotalNumberOfDecryptionServers = 230
|
||||||
pd.Id = 1
|
pd.Id = 1
|
||||||
@@ -116,12 +116,12 @@ func TestPartialDecryptionZKPBSONification(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestThresholdKeyBSON(t *testing.T) {
|
func TestThresholdKeyBSON(t *testing.T) {
|
||||||
key := &ThresholdKey{
|
key := &ThresholdPublicKey{
|
||||||
PublicKey: PublicKey{b(9)},
|
PublicKey: PublicKey{b(9)},
|
||||||
TotalNumberOfDecryptionServers: 7,
|
TotalNumberOfDecryptionServers: 7,
|
||||||
Threshold: 6,
|
Threshold: 6,
|
||||||
V: b(3),
|
V: b(3),
|
||||||
Vi: []*big.Int{b(2), b(34)},
|
Vi: []*big.Int{b(2), b(34)},
|
||||||
}
|
}
|
||||||
AssertBSONIsGood(key, new(ThresholdKey), t)
|
AssertBSONIsGood(key, new(ThresholdPublicKey), t)
|
||||||
}
|
}
|
||||||
+16
-16
@@ -23,7 +23,7 @@ import (
|
|||||||
// A Generalization of Paillier’s Public-Key System
|
// A Generalization of Paillier’s Public-Key System
|
||||||
// with Applications to Electronic Voting
|
// with Applications to Electronic Voting
|
||||||
// Aarhus University, Dept. of Computer Science, BRICS
|
// Aarhus University, Dept. of Computer Science, BRICS
|
||||||
type ThresholdKey struct {
|
type ThresholdPublicKey struct {
|
||||||
PublicKey
|
PublicKey
|
||||||
TotalNumberOfDecryptionServers int
|
TotalNumberOfDecryptionServers int
|
||||||
Threshold int
|
Threshold int
|
||||||
@@ -34,21 +34,21 @@ type ThresholdKey struct {
|
|||||||
// Returns the value of [(4*delta^2)]^-1 mod n.
|
// Returns the value of [(4*delta^2)]^-1 mod n.
|
||||||
// It is a constant value for the given `ThresholdKey` and is used in the last
|
// It is a constant value for the given `ThresholdKey` and is used in the last
|
||||||
// step of share combining.
|
// step of share combining.
|
||||||
func (tk *ThresholdKey) combineSharesConstant() *big.Int {
|
func (tk *ThresholdPublicKey) combineSharesConstant() *big.Int {
|
||||||
tmp := new(big.Int).Mul(FOUR, new(big.Int).Mul(tk.delta(), tk.delta()))
|
tmp := new(big.Int).Mul(FOUR, new(big.Int).Mul(tk.delta(), tk.delta()))
|
||||||
return (&big.Int{}).ModInverse(tmp, tk.N)
|
return (&big.Int{}).ModInverse(tmp, tk.N)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the factorial of the number of `TotalNumberOfDecryptionServers`.
|
// Returns the factorial of the number of `TotalNumberOfDecryptionServers`.
|
||||||
// It is a contant value for the given `ThresholdKey`.
|
// It is a contant value for the given `ThresholdKey`.
|
||||||
func (tk *ThresholdKey) delta() *big.Int {
|
func (tk *ThresholdPublicKey) delta() *big.Int {
|
||||||
return Factorial(tk.TotalNumberOfDecryptionServers)
|
return Factorial(tk.TotalNumberOfDecryptionServers)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checks if the number of received, unique shares is less than the
|
// Checks if the number of received, unique shares is less than the
|
||||||
// required threshold.
|
// required threshold.
|
||||||
// This method does not execute ZKP on received shares.
|
// This method does not execute ZKP on received shares.
|
||||||
func (tk *ThresholdKey) makeVerificationBeforeCombiningPartialDecryptions(shares []*PartialDecryption) error {
|
func (tk *ThresholdPublicKey) makeVerificationBeforeCombiningPartialDecryptions(shares []*PartialDecryption) error {
|
||||||
if len(shares) < tk.Threshold {
|
if len(shares) < tk.Threshold {
|
||||||
return errors.New("Threshold not meet")
|
return errors.New("Threshold not meet")
|
||||||
}
|
}
|
||||||
@@ -62,7 +62,7 @@ func (tk *ThresholdKey) makeVerificationBeforeCombiningPartialDecryptions(shares
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tk *ThresholdKey) updateLambda(share1, share2 *PartialDecryption, lambda *big.Int) *big.Int {
|
func (tk *ThresholdPublicKey) updateLambda(share1, share2 *PartialDecryption, lambda *big.Int) *big.Int {
|
||||||
num := new(big.Int).Mul(lambda, big.NewInt(int64(-share2.Id)))
|
num := new(big.Int).Mul(lambda, big.NewInt(int64(-share2.Id)))
|
||||||
denom := big.NewInt(int64(share1.Id - share2.Id))
|
denom := big.NewInt(int64(share1.Id - share2.Id))
|
||||||
return new(big.Int).Div(num, denom)
|
return new(big.Int).Div(num, denom)
|
||||||
@@ -70,7 +70,7 @@ func (tk *ThresholdKey) updateLambda(share1, share2 *PartialDecryption, lambda *
|
|||||||
|
|
||||||
// Evaluates lambda parameter for each decrypted share. See second figure in the
|
// Evaluates lambda parameter for each decrypted share. See second figure in the
|
||||||
// "Share combining" paragraph in [DJK 10], section 5.2.
|
// "Share combining" paragraph in [DJK 10], section 5.2.
|
||||||
func (tk *ThresholdKey) computeLambda(share *PartialDecryption, shares []*PartialDecryption) *big.Int {
|
func (tk *ThresholdPublicKey) computeLambda(share *PartialDecryption, shares []*PartialDecryption) *big.Int {
|
||||||
lambda := tk.delta()
|
lambda := tk.delta()
|
||||||
for _, share2 := range shares {
|
for _, share2 := range shares {
|
||||||
if share2.Id != share.Id {
|
if share2.Id != share.Id {
|
||||||
@@ -90,14 +90,14 @@ func (tk *ThresholdKey) computeLambda(share *PartialDecryption, shares []*Partia
|
|||||||
// following property of modulo:
|
// following property of modulo:
|
||||||
// (AB) mod C = (A mod C * B mod C) mod C
|
// (AB) mod C = (A mod C * B mod C) mod C
|
||||||
// Note, we need to combine coefficients into single c'.
|
// Note, we need to combine coefficients into single c'.
|
||||||
func (tk *ThresholdKey) updateCprime(cprime, lambda *big.Int, share *PartialDecryption) *big.Int {
|
func (tk *ThresholdPublicKey) updateCprime(cprime, lambda *big.Int, share *PartialDecryption) *big.Int {
|
||||||
twoLambda := new(big.Int).Mul(TWO, lambda)
|
twoLambda := new(big.Int).Mul(TWO, lambda)
|
||||||
ret := tk.exp(share.Decryption, twoLambda, tk.GetNSquare())
|
ret := tk.exp(share.Decryption, twoLambda, tk.GetNSquare())
|
||||||
ret = new(big.Int).Mul(cprime, ret)
|
ret = new(big.Int).Mul(cprime, ret)
|
||||||
return new(big.Int).Mod(ret, tk.GetNSquare())
|
return new(big.Int).Mod(ret, tk.GetNSquare())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tk *ThresholdKey) exp(a, b, c *big.Int) *big.Int {
|
func (tk *ThresholdPublicKey) exp(a, b, c *big.Int) *big.Int {
|
||||||
if b.Cmp(ZERO) == -1 {
|
if b.Cmp(ZERO) == -1 {
|
||||||
ret := new(big.Int).Exp(a, new(big.Int).Neg(b), c)
|
ret := new(big.Int).Exp(a, new(big.Int).Neg(b), c)
|
||||||
return new(big.Int).ModInverse(ret, c)
|
return new(big.Int).ModInverse(ret, c)
|
||||||
@@ -108,7 +108,7 @@ func (tk *ThresholdKey) exp(a, b, c *big.Int) *big.Int {
|
|||||||
// Executes the last step of message decryption. Takes `cprime` value computed
|
// Executes the last step of message decryption. Takes `cprime` value computed
|
||||||
// from valid shares provided by decryption servers and multiplies this value
|
// from valid shares provided by decryption servers and multiplies this value
|
||||||
// by `combineSharesContant` which is specific to the given public `ThresholdKey`.
|
// by `combineSharesContant` which is specific to the given public `ThresholdKey`.
|
||||||
func (tk *ThresholdKey) computeDecryption(cprime *big.Int) *big.Int {
|
func (tk *ThresholdPublicKey) computeDecryption(cprime *big.Int) *big.Int {
|
||||||
l := L(cprime, tk.N)
|
l := L(cprime, tk.N)
|
||||||
return new(big.Int).Mod(new(big.Int).Mul(tk.combineSharesConstant(), l), tk.N)
|
return new(big.Int).Mod(new(big.Int).Mul(tk.combineSharesConstant(), l), tk.N)
|
||||||
}
|
}
|
||||||
@@ -117,7 +117,7 @@ func (tk *ThresholdKey) computeDecryption(cprime *big.Int) *big.Int {
|
|||||||
// decrypted message.
|
// decrypted message.
|
||||||
// This function does not verify zero knowledge proofs. Returned message can be
|
// This function does not verify zero knowledge proofs. Returned message can be
|
||||||
// incorrectly decrypted if an adversary corrupted partial decryption.
|
// incorrectly decrypted if an adversary corrupted partial decryption.
|
||||||
func (tk *ThresholdKey) CombinePartialDecryptions(shares []*PartialDecryption) (*big.Int, error) {
|
func (tk *ThresholdPublicKey) CombinePartialDecryptions(shares []*PartialDecryption) (*big.Int, error) {
|
||||||
if err := tk.makeVerificationBeforeCombiningPartialDecryptions(shares); err != nil {
|
if err := tk.makeVerificationBeforeCombiningPartialDecryptions(shares); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -135,7 +135,7 @@ func (tk *ThresholdKey) CombinePartialDecryptions(shares []*PartialDecryption) (
|
|||||||
// decrypted message.
|
// decrypted message.
|
||||||
// Function verifies zero knowledge proofs and filters out all shares that failed
|
// Function verifies zero knowledge proofs and filters out all shares that failed
|
||||||
// verification.
|
// verification.
|
||||||
func (tk *ThresholdKey) CombinePartialDecryptionsZKP(shares []*PartialDecryptionZKP) (*big.Int, error) {
|
func (tk *ThresholdPublicKey) CombinePartialDecryptionsZKP(shares []*PartialDecryptionZKP) (*big.Int, error) {
|
||||||
ret := make([]*PartialDecryption, 0)
|
ret := make([]*PartialDecryption, 0)
|
||||||
for _, share := range shares {
|
for _, share := range shares {
|
||||||
if share.Verify() {
|
if share.Verify() {
|
||||||
@@ -149,7 +149,7 @@ func (tk *ThresholdKey) CombinePartialDecryptionsZKP(shares []*PartialDecryption
|
|||||||
// It verifies all the zero-knoledge proofs, the value of the encrypted
|
// It verifies all the zero-knoledge proofs, the value of the encrypted
|
||||||
// and decrypted message. The method returns `nil` if everything is fine.
|
// and decrypted message. The method returns `nil` if everything is fine.
|
||||||
// Otherwise, it returns an explicative message.
|
// Otherwise, it returns an explicative message.
|
||||||
func (tk *ThresholdKey) VerifyDecryption(encryptedMessage, decryptedMessage *big.Int, shares []*PartialDecryptionZKP) error {
|
func (tk *ThresholdPublicKey) VerifyDecryption(encryptedMessage, decryptedMessage *big.Int, shares []*PartialDecryptionZKP) error {
|
||||||
for _, share := range shares {
|
for _, share := range shares {
|
||||||
if share.C.Cmp(encryptedMessage) != 0 {
|
if share.C.Cmp(encryptedMessage) != 0 {
|
||||||
return errors.New("The encrypted message is not the same than the one in the shares")
|
return errors.New("The encrypted message is not the same than the one in the shares")
|
||||||
@@ -170,7 +170,7 @@ func (tk *ThresholdKey) VerifyDecryption(encryptedMessage, decryptedMessage *big
|
|||||||
// `Id` is the unique identifier of a decryption server and `Share` is a secret
|
// `Id` is the unique identifier of a decryption server and `Share` is a secret
|
||||||
// share generated from hiding polynomial and is used for a partial share decryption.
|
// share generated from hiding polynomial and is used for a partial share decryption.
|
||||||
type ThresholdPrivateKey struct {
|
type ThresholdPrivateKey struct {
|
||||||
ThresholdKey
|
ThresholdPublicKey
|
||||||
Id int
|
Id int
|
||||||
Share *big.Int
|
Share *big.Int
|
||||||
}
|
}
|
||||||
@@ -193,8 +193,8 @@ func (tpk *ThresholdPrivateKey) copyVi() []*big.Int {
|
|||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tpk *ThresholdPrivateKey) getThresholdKey() *ThresholdKey {
|
func (tpk *ThresholdPrivateKey) getThresholdKey() *ThresholdPublicKey {
|
||||||
ret := new(ThresholdKey)
|
ret := new(ThresholdPublicKey)
|
||||||
ret.Threshold = tpk.Threshold
|
ret.Threshold = tpk.Threshold
|
||||||
ret.TotalNumberOfDecryptionServers = tpk.TotalNumberOfDecryptionServers
|
ret.TotalNumberOfDecryptionServers = tpk.TotalNumberOfDecryptionServers
|
||||||
ret.V = new(big.Int).Add(tpk.V, big.NewInt(0))
|
ret.V = new(big.Int).Add(tpk.V, big.NewInt(0))
|
||||||
@@ -325,7 +325,7 @@ type PartialDecryption struct {
|
|||||||
// - Compare ZKP hash with the one just computed
|
// - Compare ZKP hash with the one just computed
|
||||||
type PartialDecryptionZKP struct {
|
type PartialDecryptionZKP struct {
|
||||||
PartialDecryption
|
PartialDecryption
|
||||||
Key *ThresholdKey // the public key used to encrypt
|
Key *ThresholdPublicKey // the public key used to encrypt
|
||||||
E *big.Int // the challenge
|
E *big.Int // the challenge
|
||||||
Z *big.Int // the value needed to check to verify the decryption
|
Z *big.Int // the value needed to check to verify the decryption
|
||||||
C *big.Int // the input cypher text
|
C *big.Int // the input cypher text
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ func getThresholdPrivateKey() *ThresholdPrivateKey {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestDelta(t *testing.T) {
|
func TestDelta(t *testing.T) {
|
||||||
tk := new(ThresholdKey)
|
tk := new(ThresholdPublicKey)
|
||||||
tk.TotalNumberOfDecryptionServers = 6
|
tk.TotalNumberOfDecryptionServers = 6
|
||||||
if delta := tk.delta(); 720 != n(delta) {
|
if delta := tk.delta(); 720 != n(delta) {
|
||||||
t.Error("Delta is not 720 but", delta)
|
t.Error("Delta is not 720 but", delta)
|
||||||
@@ -25,7 +25,7 @@ func TestDelta(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCombineSharesConstant(t *testing.T) {
|
func TestCombineSharesConstant(t *testing.T) {
|
||||||
tk := new(ThresholdKey)
|
tk := new(ThresholdPublicKey)
|
||||||
tk.N = big.NewInt(101 * 103)
|
tk.N = big.NewInt(101 * 103)
|
||||||
tk.TotalNumberOfDecryptionServers = 6
|
tk.TotalNumberOfDecryptionServers = 6
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ func TestDecryptWithThresholdKey(t *testing.T) {
|
|||||||
|
|
||||||
func TestVerifyPart1(t *testing.T) {
|
func TestVerifyPart1(t *testing.T) {
|
||||||
pd := new(PartialDecryptionZKP)
|
pd := new(PartialDecryptionZKP)
|
||||||
pd.Key = new(ThresholdKey)
|
pd.Key = new(ThresholdPublicKey)
|
||||||
pd.Key.N = b(131)
|
pd.Key.N = b(131)
|
||||||
pd.Decryption = b(101)
|
pd.Decryption = b(101)
|
||||||
pd.C = b(99)
|
pd.C = b(99)
|
||||||
@@ -98,7 +98,7 @@ func TestVerifyPart1(t *testing.T) {
|
|||||||
|
|
||||||
func TestVerifyPart2(t *testing.T) {
|
func TestVerifyPart2(t *testing.T) {
|
||||||
pd := new(PartialDecryptionZKP)
|
pd := new(PartialDecryptionZKP)
|
||||||
pd.Key = new(ThresholdKey)
|
pd.Key = new(ThresholdPublicKey)
|
||||||
pd.Id = 1
|
pd.Id = 1
|
||||||
pd.Key.Vi = []*big.Int{b(77), b(67)} // vi is 67
|
pd.Key.Vi = []*big.Int{b(77), b(67)} // vi is 67
|
||||||
pd.Key.N = b(131)
|
pd.Key.N = b(131)
|
||||||
@@ -127,7 +127,7 @@ func TestDecryptAndProduceZNP(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestMakeVerificationBeforeCombiningPartialDecryptions(t *testing.T) {
|
func TestMakeVerificationBeforeCombiningPartialDecryptions(t *testing.T) {
|
||||||
tk := new(ThresholdKey)
|
tk := new(ThresholdPublicKey)
|
||||||
tk.Threshold = 2
|
tk.Threshold = 2
|
||||||
if tk.makeVerificationBeforeCombiningPartialDecryptions([]*PartialDecryption{}) == nil {
|
if tk.makeVerificationBeforeCombiningPartialDecryptions([]*PartialDecryption{}) == nil {
|
||||||
t.Fail()
|
t.Fail()
|
||||||
@@ -144,7 +144,7 @@ func TestMakeVerificationBeforeCombiningPartialDecryptions(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestUpdateLambda(t *testing.T) {
|
func TestUpdateLambda(t *testing.T) {
|
||||||
tk := new(ThresholdKey)
|
tk := new(ThresholdPublicKey)
|
||||||
lambda := b(11)
|
lambda := b(11)
|
||||||
share1 := &PartialDecryption{3, b(5)}
|
share1 := &PartialDecryption{3, b(5)}
|
||||||
share2 := &PartialDecryption{7, b(3)}
|
share2 := &PartialDecryption{7, b(3)}
|
||||||
@@ -155,7 +155,7 @@ func TestUpdateLambda(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestupdateCprime(t *testing.T) {
|
func TestupdateCprime(t *testing.T) {
|
||||||
tk := new(ThresholdKey)
|
tk := new(ThresholdPublicKey)
|
||||||
tk.N = b(99)
|
tk.N = b(99)
|
||||||
cprime := b(77)
|
cprime := b(77)
|
||||||
lambda := b(52)
|
lambda := b(52)
|
||||||
@@ -238,7 +238,7 @@ func TestDecryption(t *testing.T) {
|
|||||||
// test the correct decryption of '100'.
|
// test the correct decryption of '100'.
|
||||||
share1 := &PartialDecryption{1, b(384111638639)}
|
share1 := &PartialDecryption{1, b(384111638639)}
|
||||||
share2 := &PartialDecryption{2, b(235243761043)}
|
share2 := &PartialDecryption{2, b(235243761043)}
|
||||||
tk := new(ThresholdKey)
|
tk := new(ThresholdPublicKey)
|
||||||
tk.Threshold = 2
|
tk.Threshold = 2
|
||||||
tk.TotalNumberOfDecryptionServers = 2
|
tk.TotalNumberOfDecryptionServers = 2
|
||||||
tk.N = b(637753)
|
tk.N = b(637753)
|
||||||
@@ -325,7 +325,7 @@ func TestVerifyDecryption(t *testing.T) {
|
|||||||
tkh := GetThresholdKeyGenerator(10, 2, 2, rand.Reader)
|
tkh := GetThresholdKeyGenerator(10, 2, 2, rand.Reader)
|
||||||
tpks, err := tkh.Generate()
|
tpks, err := tkh.Generate()
|
||||||
|
|
||||||
pk := &tpks[0].ThresholdKey
|
pk := &tpks[0].ThresholdPublicKey
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user