paillier

package
v0.1.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProofIters = 13
)

Variables

View Source
var (
	ErrMessageTooLong = fmt.Errorf("the message is too large or < 0")
)

Functions

func GenerateKeyPair

func GenerateKeyPair(modulusBitLen int, timeout time.Duration, optionalConcurrency ...int) (privateKey *PrivateKey, publicKey *PublicKey, err error)

len is the length of the modulus (each prime = len / 2)

func GenerateXs

func GenerateXs(m int, k, N *big.Int, ecdsaPub *crypto2.ECPoint) []*big.Int

GenerateXs generates the challenges used in Paillier key Proof

func L

func L(u, N *big.Int) *big.Int

Types

type PrivateKey

type PrivateKey struct {
	PublicKey
	LambdaN,
	PhiN *big.Int // (p-1) * (q-1)
	P, Q *big.Int
}

func (*PrivateKey) Decrypt

func (sk *PrivateKey) Decrypt(c *big.Int) (m *big.Int, err error)

func (*PrivateKey) DecryptAndRecoverRandomness

func (sk *PrivateKey) DecryptAndRecoverRandomness(c *big.Int) (m, x *big.Int, err error)

func (*PrivateKey) Proof

func (sk *PrivateKey) Proof(k *big.Int, ecdsaPub *crypto2.ECPoint) Proof

type Proof

type Proof [ProofIters]*big.Int

Proof uses the new GenerateXs method in GG18Spec (6)

func (Proof) Verify

func (pf Proof) Verify(pkN, k *big.Int, ecdsaPub *crypto2.ECPoint) (bool, error)

type PublicKey

type PublicKey struct {
	N *big.Int
}

func (*PublicKey) AsInts

func (pk *PublicKey) AsInts() []*big.Int

AsInts returns the PublicKey serialised to a slice of *big.Int for hashing

func (*PublicKey) Encrypt

func (pk *PublicKey) Encrypt(m *big.Int) (c *big.Int, err error)

func (*PublicKey) EncryptAndReturnRandomness

func (pk *PublicKey) EncryptAndReturnRandomness(m *big.Int) (c *big.Int, x *big.Int, err error)

func (*PublicKey) EncryptWithChosenRandomness

func (pk *PublicKey) EncryptWithChosenRandomness(m, x *big.Int) (c *big.Int, err error)

func (*PublicKey) Gamma

func (pk *PublicKey) Gamma() *big.Int

Gamma returns N+1

func (*PublicKey) HomoAdd

func (pk *PublicKey) HomoAdd(c1, c2 *big.Int) (*big.Int, error)

func (*PublicKey) HomoMult

func (pk *PublicKey) HomoMult(m, c1 *big.Int) (*big.Int, error)

func (*PublicKey) NSquare

func (pk *PublicKey) NSquare() *big.Int

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL