Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewKeyPair ¶
func NewKeyPair(keyLength, threshold int) (*PublicKey, *PrivateKey, error)
NewKeyPair generates a new public and private key. The key length must be large enough to encrypt the message. The threshold should be greater than the maximum integer that will be encrypted.
Types ¶
type Int ¶
Int represents and encrypted integer using the Paillier cryptosystem. The public key used to encrypt the integer is also included. A notable feature of the Paillier cryptosystem is its homomorphic properties along with its non-deterministic encryption.
func (*Int) Add ¶
Add sets z to the encrypted sum x+y and returns z. If x.PublicKey != y.PublicKey, a pubic-keys-not-equal run-time panic occurs.
func (*Int) AddPlaintext ¶
AddPlaintext sets z to the encrypted sum x+y and returns z.
func (*Int) Decrypt ¶
func (z *Int) Decrypt(privateKey *PrivateKey) *big.Int
Decrypt returns the decrypted value of z using the given private key. If z.PublicKey != privateKey.PublicKey, a pubic-keys-not-equal run-time panic occurs.
func (*Int) DivPlaintext ¶
DivPlaintext sets z to the encrypted quotient x/y and returns z. If y == 0, a division-by-zero run-time panic occurs. DivPlaintext will return an invalid result in cases where y does not divide x.
func (*Int) MulPlaintext ¶
MulPlaintext sets z to the encrypted product x*y and returns z.
type PrivateKey ¶
PrivateKey must be kept secret