Documentation
¶
Index ¶
- Constants
- Variables
- func GenerateKeyPair(ctx context.Context, rand io.Reader, modulusBitLen int, ...) (privateKey *PrivateKey, publicKey *PublicKey, err error)
- func GenerateXs(m int, k, N *big.Int, ecdsaPub *crypto2.ECPoint) []*big.Int
- func L(u, N *big.Int) *big.Int
- type PrivateKey
- type Proof
- type PublicKey
- func (publicKey *PublicKey) AsInts() []*big.Int
- func (publicKey *PublicKey) Encrypt(rand io.Reader, m *big.Int) (c *big.Int, err error)
- func (publicKey *PublicKey) EncryptAndReturnRandomness(rand io.Reader, m *big.Int) (c *big.Int, x *big.Int, err error)
- func (publicKey *PublicKey) Gamma() *big.Int
- func (publicKey *PublicKey) HomoAdd(c1, c2 *big.Int) (*big.Int, error)
- func (publicKey *PublicKey) HomoMult(m, c1 *big.Int) (*big.Int, error)
- func (publicKey *PublicKey) NSquare() *big.Int
Constants ¶
View Source
const (
// ProofIters is the number of iterations used in the Paillier key correctness proof.
ProofIters = 13
)
Variables ¶
View Source
var ( // ErrMessageTooLong is returned when the plaintext is negative or exceeds the modulus. ErrMessageTooLong = fmt.Errorf("the message is too large or < 0") // ErrMessageMalFormed is returned when the ciphertext is not coprime with N^2. ErrMessageMalFormed = fmt.Errorf("the message is mal-formed") )
Functions ¶
func GenerateKeyPair ¶
func GenerateKeyPair(ctx context.Context, rand io.Reader, modulusBitLen int, optionalConcurrency ...int) (privateKey *PrivateKey, publicKey *PublicKey, err error)
len is the length of the modulus (each prime = len / 2)
func GenerateXs ¶
GenerateXs generates the challenges used in Paillier key Proof
Types ¶
type PrivateKey ¶
PrivateKey represents a Paillier private key containing the public key and the secret prime factors.
type PublicKey ¶
PublicKey represents a Paillier public key containing the modulus N.
func (*PublicKey) AsInts ¶
AsInts returns the PublicKey serialised to a slice of *big.Int for hashing
func (*PublicKey) Encrypt ¶
Encrypt encrypts the plaintext m under the Paillier public key and returns the ciphertext.
func (*PublicKey) EncryptAndReturnRandomness ¶
func (publicKey *PublicKey) EncryptAndReturnRandomness(rand io.Reader, m *big.Int) (c *big.Int, x *big.Int, err error)
EncryptAndReturnRandomness encrypts the plaintext m and also returns the randomness used for the encryption.
func (*PublicKey) HomoAdd ¶
HomoAdd homomorphically adds two ciphertexts, producing a ciphertext of the sum of the two plaintexts.
Click to show internal directories.
Click to hide internal directories.