// GetThresholdKeyGenerator is a preferable way to construct the
// ThresholdKeyGenerator.
// Due to the various properties that must be met for the threshold key to be
// considered valid, the minimum public key `N` bit length is 18 bits and the
// public key bit length should be an even number.
// The plaintext space for the key will be `Z_N`.
GetThresholdKeyGenerator is a preferable way to construct the
ThresholdKeyGenerator.
Due to the various properties that must be met for the threshold key to be
considered valid, the minimum public key `N` bit length is 18 bits and the
public key bit length should be an even number.
The plaintext space for the key will be `Z_N`.
// GetThresholdKeyGenerator is a preferable way to construct the // ThresholdKeyGenerator . // Due to the various properties that must be met for the threshold key to be // considered valid the minimum public key ` N ` bit length is 18 bits and the // public key bit length should be an even number . // The plaintext space for the key will be ` Z_N ` .
func GetThresholdKeyGenerator(
	publicKeyBitLength int,
	totalNumberOfDecryptionServers int,
	threshold int,
	random io.Reader,
) (*ThresholdKeyGenerator, error) {
	if publicKeyBitLength%2 == 1 {
		return nil, errors.New("Public key bit length must be an even number")
	}
	if publicKeyBitLength < 18 {
		return nil, errors.New("Public key bit length must be at least 18 bits")
	}
	return &ThresholdKeyGenerator{
		PublicKeyBitLength:             publicKeyBitLength,
		TotalNumberOfDecryptionServers: totalNumberOfDecryptionServers,
		Threshold:                      threshold,
		random:                         random,
	}, nil
}
func GetThresholdKeyGenerator ( publicKeyBitLength int , totalNumberOfDecryptionServers int , threshold int , random io . Reader , ) ( * ThresholdKeyGenerator , error ) { if publicKeyBitLength % 2 == 1 { return nil , errors . New ( " " ) } if publicKeyBitLength < 18 { return nil , errors . New ( " " ) } return & ThresholdKeyGenerator { PublicKeyBitLength : publicKeyBitLength , TotalNumberOfDecryptionServers : totalNumberOfDecryptionServers , Threshold : threshold , random : random , } , nil }
GetThresholdKeyGenerator is a preferable way to construct the
ThresholdKeyGenerator.
GetThresholdKeyGenerator is a preferable way to construct the ThresholdKeyGenerator .
// For an odd n-bit number, we can't find two n/2-bit numbers with two // the most significant bits set on which multiplied gives an n-bit // number. // We need to find two n/2-bit safe primes, P and Q which are not equal. // This is not possible for n<18.