Pass a public key bit length when creating a threshold key generator #11

Merged
pdyraga merged 16 commits from master into master 2018-08-10 06:50:47 -04:00
Showing only changes of commit e726ad489b - Show all commits
+3 -3
View File
@@ -20,7 +20,7 @@ import (
// 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 ThresholdKeyGenerator struct { type ThresholdKeyGenerator struct {
publicKeyBitLength int PublicKeyBitLength int
TotalNumberOfDecryptionServers int TotalNumberOfDecryptionServers int
Threshold int Threshold int
Random io.Reader Random io.Reader
@@ -70,7 +70,7 @@ func GetThresholdKeyGenerator(
} }
return &ThresholdKeyGenerator{ return &ThresholdKeyGenerator{
publicKeyBitLength: publicKeyBitLength, PublicKeyBitLength: publicKeyBitLength,
TotalNumberOfDecryptionServers: totalNumberOfDecryptionServers, TotalNumberOfDecryptionServers: totalNumberOfDecryptionServers,
Threshold: threshold, Threshold: threshold,
Random: random, Random: random,
@@ -80,7 +80,7 @@ func GetThresholdKeyGenerator(
func (tkg *ThresholdKeyGenerator) generateSafePrimes() (*big.Int, *big.Int, error) { func (tkg *ThresholdKeyGenerator) generateSafePrimes() (*big.Int, *big.Int, error) {
concurrencyLevel := 4 concurrencyLevel := 4
timeout := 120 * time.Second timeout := 120 * time.Second
safePrimeBitLength := tkg.publicKeyBitLength / 2 safePrimeBitLength := tkg.PublicKeyBitLength / 2
return GenerateSafePrime(safePrimeBitLength, concurrencyLevel, timeout, tkg.Random) return GenerateSafePrime(safePrimeBitLength, concurrencyLevel, timeout, tkg.Random)
} }