Documentation ¶
Index ¶
- func AESdecrypt(key []byte, cipherText []byte) (message *[]byte, err error)
- func AESencrypt(key []byte, plainText []byte) (c *[]byte, err error)
- func CreateAndPrepareShares(nodes []common.Node, secret big.Int, threshold int, privKey big.Int) ([]*common.SigncryptedOutput, *[]common.Point, error)
- func CreateShares(nodes []common.Node, secret big.Int, threshold int) (*[]common.PrimaryShare, *[]common.Point, error)
- func LagrangeScalar(shares []common.PrimaryShare, target int) *big.Int
- func RandomBigInt() *big.Int
- func Signcrypt(recipientPubKey common.Point, data []byte, privKey big.Int) (*common.Signcryption, error)
- func UnSignCrypt(signcryption common.Signcryption, privKey big.Int, senderPubKey common.Point) (*[]byte, error)
- func UnsigncryptShare(signcryption common.Signcryption, privKey big.Int, ...) (*[]byte, error)
- type CSPaillierEC
- func (csp *CSPaillierEC) Abs(a *big.Int) (*big.Int, error)
- func (csp *CSPaillierEC) Decrypt(u, e, v, label *big.Int) (*big.Int, error)
- func (csp *CSPaillierEC) Encrypt(m, label *big.Int) (*big.Int, *big.Int, *big.Int, error)
- func (csp *CSPaillierEC) GetChallenge() *big.Int
- func (csp *CSPaillierEC) GetOpeningMsg(m *big.Int) (*big.Int, *Point)
- func (csp *CSPaillierEC) GetProofData(c *big.Int) (*big.Int, *big.Int, *big.Int)
- func (csp *CSPaillierEC) GetProofRandomData(u, e, label *big.Int) (*big.Int, *big.Int, *big.Int, *Point, *big.Int, error)
- func (csp *CSPaillierEC) SetProofRandomData(u1, e1, v1 *big.Int, delta1 Point, l1, c *big.Int)
- func (csp *CSPaillierEC) SetVerifierEncData(u, e, v *big.Int, delta Point, label, l *big.Int)
- func (csp *CSPaillierEC) Verify(rTilde, sTilde, mTilde *big.Int) bool
- type CSPaillierECProverEncData
- type CSPaillierECProverRandomData
- type CSPaillierECPubKey
- type CSPaillierECSecKey
- type CSPaillierECSecParams
- type CSPaillierECVerifierEncData
- type CSPaillierECVerifierRandomData
- type DLEQProof
- type Point
- type VerifiableEncGroupEC
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateAndPrepareShares ¶
func CreateAndPrepareShares(nodes []common.Node, secret big.Int, threshold int, privKey big.Int) ([]*common.SigncryptedOutput, *[]common.Point, error)
deprecated: use CreateShares and let client handle signcryption. Client may need to add more information before signcrypting (eg. broadcast id)
func CreateShares ¶
func CreateShares(nodes []common.Node, secret big.Int, threshold int) (*[]common.PrimaryShare, *[]common.Point, error)
use this instead of CreateAndPrepareShares
func LagrangeScalar ¶
func LagrangeScalar(shares []common.PrimaryShare, target int) *big.Int
func RandomBigInt ¶
func UnSignCrypt ¶
func UnsigncryptShare ¶
Types ¶
type CSPaillierEC ¶
type CSPaillierEC struct { SecParams *CSPaillierECSecParams PubKey *CSPaillierECPubKey SecKey *CSPaillierECSecKey // contains filtered or unexported fields }
CSPaillierEC represents Camenisch-Shoup variant of Paillier to make it (Paillier) CCA2 secure. http://eprint.iacr.org/2002/161.pdf
func NewCSPaillierEC ¶
func NewCSPaillierEC(secParams *CSPaillierECSecParams) *CSPaillierEC
func NewCSPaillierECFromPubKey ¶
func NewCSPaillierECFromPubKey(pubKey *CSPaillierECPubKey) *CSPaillierEC
func NewCSPaillierECFromSecKey ¶
func NewCSPaillierECFromSecKey(secKey *CSPaillierECSecKey) (*CSPaillierEC, error)
func (*CSPaillierEC) GetChallenge ¶
func (csp *CSPaillierEC) GetChallenge() *big.Int
func (*CSPaillierEC) GetOpeningMsg ¶
Returns l = g1^m * h1^s where s is a random integer smaller than n/4.
func (*CSPaillierEC) GetProofData ¶
Prover should use this function to compute data for second (last) sigma protocol message.
func (*CSPaillierEC) GetProofRandomData ¶
func (csp *CSPaillierEC) GetProofRandomData(u, e, label *big.Int) (*big.Int, *big.Int, *big.Int, *Point, *big.Int, error)
Prover (encryptor) should use this function to generate values for the first sigma protocol message.
func (*CSPaillierEC) SetProofRandomData ¶
Verifier should call this function when it receives proof random data as the second protocol message.
func (*CSPaillierEC) SetVerifierEncData ¶
Verifier should call this function when it receives l = g1^m * h1^s as the first protocol message.
type CSPaillierECPubKey ¶
type CSPaillierECPubKey struct { N *big.Int G *big.Int Y1 *big.Int Y2 *big.Int Y3 *big.Int // the parameters below are for verifiable encryption Gamma *secp256k1.KoblitzCurve // for discrete logarithm VerifiableEncGroupN *big.Int VerifiableEncGroupG1 *big.Int VerifiableEncGroupH1 *big.Int K int K1 int }
CSPaillierECPubKey currently does not use auxiliary parameters/primes - no additional n, p, q parameters (as specified in a paper, original n, p, q can be used).
type CSPaillierECSecKey ¶
type CSPaillierECSecKey struct { N *big.Int G *big.Int X1 *big.Int X2 *big.Int X3 *big.Int // the parameters below are for verifiable encryption Gamma *secp256k1.KoblitzCurve // for discrete logarithm VerifiableEncGroupN *big.Int VerifiableEncGroupG1 *big.Int VerifiableEncGroupH1 *big.Int K int K1 int }
type CSPaillierECSecParams ¶
type DLEQProof ¶
type DLEQProof struct { C big.Int // challenge R big.Int // response VG common.Point // public commitment with respect to base point secp256k1.G VH common.Point // public commitment with respect to base point secp256k1.H }
func GenerateDLEQProof ¶
type VerifiableEncGroupEC ¶
type VerifiableEncGroupEC struct { *qr.RSASpecial G1 *big.Int H1 *big.Int // contains filtered or unexported fields }
func NewVerifiableEncGroupEC ¶
func NewVerifiableEncGroupEC(primes *qr.RSASpecialPrimes) (*VerifiableEncGroupEC, error)