G parameter removed from ThresholdKey

G _MUST_ be always n+1 to make the threshold encryption algorithm safe. We assume G=n+1 both for standard and threshold version.
This commit is contained in:
Piotr Dyraga committed 2018-05-30 14:48:15 +02:00
1 parent e10b02e420
commit e25bc358e8
5 files changed
+4 -5

No files matched your search

+3
View File
@@ -37,6 +37,9 @@ func (pub *PublicKey) Encrypt(m *big.Int, random io.Reader) (*Cypher, error) {
}
nSquare := pub.GetNSquare()
// g is _always_ equal n+1
// Threshold encryption is safe only for g=n+1 choice.
// See [DJN 10], section 5.1
g := new(big.Int).Add(pub.N, big.NewInt(1))
gm := new(big.Int).Exp(g, m, nSquare)
rn := new(big.Int).Exp(r, pub.N, nSquare)
-2
View File
@@ -14,7 +14,6 @@ type ThresholdKey struct {
Threshold int
V *big.Int
Vi []*big.Int
G *big.Int // usually G is set to N+1
}
// returns the value of (4*delta**2)** -1 mod n
@@ -165,7 +164,6 @@ func (this *ThresholdPrivateKey) GetThresholdKey() *ThresholdKey {
ret.V = new(big.Int).Add(this.V, big.NewInt(0))
ret.Vi = this.copyVi()
ret.N = new(big.Int).Add(this.N, big.NewInt(0))
ret.G = new(big.Int).Add(this.N, big.NewInt(1))
return ret
}
-1
View File
@@ -219,7 +219,6 @@ func (this *ThresholdKeyGenerator) createViArray(shares []*big.Int) (viArray []*
func (this *ThresholdKeyGenerator) createPrivateKey(i int, share *big.Int, viArray []*big.Int) *ThresholdPrivateKey {
ret := new(ThresholdPrivateKey)
ret.N = this.n
ret.G = new(big.Int).Add(ret.N, ONE)
ret.V = this.v
ret.TotalNumberOfDecryptionServers = this.TotalNumberOfDecryptionServers
+1 -1
View File
@@ -207,7 +207,7 @@ func TestGenerate(t *testing.T) {
if len(tpk.Vi) != 10 {
t.Fail()
}
if tpk.G == nil || tpk.N == nil {
if tpk.N == nil {
t.Fail()
}
if tpk.Threshold != 6 || tpk.TotalNumberOfDecryptionServers != 10 {
-1
View File
@@ -224,7 +224,6 @@ func TestDecryption(t *testing.T) {
tk.Threshold = 2
tk.TotalNumberOfDecryptionServers = 2
tk.N = b(637753)
tk.G = b(637754)
tk.V = b(70661107826)
if msg, err := tk.CombinePartialDecryptions([]*PartialDecryption{share1, share2}); err != nil {
t.Error(err)