Cleared up Paillier scheme API
The code for generating private key is based on approach described in [KL 08], construction 11.32 which is compatible with the one described in [DJN 10], section 3.2 except that instead of generating Lamda private key compontent from LCM of `p` and `q` we use Euler's totient function as suggested in [KL 08]. I cleared up naming as well as removed G and Mu parameters from Paillier key. For the modification of Paillier scheme we use, where g = n + 1, N is the only one parameter needed for a public key. Also, Mu is needed only for Decrypting and can be computed there from Lambda and N so there is no need to keep it in the private key.
I added documentation to <Key, Enc, Dec> functions with an important note that `p` and `q` supplied to `CreatePrivateKey` must be either of equal length or `gcd(pq, (p-1)(q-1)) = 1` which is assured if both primes are of equal length. This requirement is mentioned both in [KL 08] and [DJN 10].
[KL 08]: Jonathan Katz, Yehuda Lindell, (2008)
Introduction to Modern Cryptography: Principles and Protocols,
Chapman & Hall/CRC
[DJN 10]: Ivan Damgard, Mads Jurik, Jesper Buus Nielsen, (2010)
A Generalization of Paillier’s Public-Key System
with Applications to Electronic Voting
Aarhus University, Dept. of Computer Science, BRICS
This commit is contained in:
3 files changed
+71
-72
No files matched your search
+2
-15
@@ -117,18 +117,13 @@ type dbPrivateKey struct {
|
||||
|
||||
func (this *PrivateKey) GetBSON() (interface{}, error) {
|
||||
m := make(map[string]string)
|
||||
if this.G != nil {
|
||||
m["g"] = fmt.Sprintf("%x", this.G)
|
||||
}
|
||||
|
||||
if this.N != nil {
|
||||
m["n"] = fmt.Sprintf("%x", this.N)
|
||||
}
|
||||
if this.Lambda != nil {
|
||||
m["lambda"] = fmt.Sprintf("%x", this.Lambda)
|
||||
}
|
||||
if this.Mu != nil {
|
||||
m["mu"] = fmt.Sprintf("%x", this.Mu)
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
@@ -143,21 +138,13 @@ func (this *PrivateKey) SetBSON(raw bson.Raw) error {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if c.G != "" {
|
||||
this.G, err = fromHex(c.G)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if c.Lambda != "" {
|
||||
this.Lambda, err = fromHex(c.Lambda)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if c.Mu != "" {
|
||||
this.Mu, err = fromHex(c.Mu)
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user