paillier

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 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")
	ErrMessageMalFormed = fmt.Errorf("the message is mal-formed")
)

Functions

func GenerateKeyPair

func GenerateKeyPair(ctx context.Context, modulusBitLen int, 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)
}

func (*PrivateKey) Decrypt

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

func (*PrivateKey) Proof

func (privateKey *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 (publicKey *PublicKey) AsInts() []*big.Int

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

func (*PublicKey) Encrypt

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

func (*PublicKey) EncryptAndReturnRandomness

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

func (*PublicKey) Gamma

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

Gamma returns N+1

func (*PublicKey) HomoAdd

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

func (*PublicKey) HomoMult

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

func (*PublicKey) NSquare

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

Jump to

Keyboard shortcuts

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