Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Prover ¶
func (*Prover) GetProofRandomData ¶
type RSA ¶
type RSA struct { N *big.Int // N = P * Q P *big.Int Q *big.Int Order *big.Int // Order = (P-1)/2 * (Q-1)/2 }
RSA presents QR_N - group of quadratic residues modulo N where N is a product of two primes. This group is in general NOT cyclic (it is only when (P-1)/2 and (Q-1)/2 are primes, see RSASpecial). The group QR_N is isomorphic to QR_P x QR_Q.
func NewRSAPublic ¶
func (*RSA) IsElementInGroup ¶
IsElementInGroup returns true if a is in QR_N and false otherwise.
type RSASpecial ¶
RSASpecial presents QR_N - group of quadratic residues modulo N where N is a product of two SAFE primes. This group is cyclic and a generator is easy to find. The group QR_N is isomorphic to QR_P x QR_Q. The order of QR_P and QR_Q are P1 and Q1 respectively. Because gcd(P1, Q1) = 1, QR_P x QR_Q is cyclic as well. The order of RSASpecial is P1 * Q1.
func NewRSASpecial ¶
func NewRSASpecial(safePrimeBitLength int) (*RSASpecial, error)
func NewRSASpecialFromParams ¶
func NewRSASpecialFromParams(specialRSAPrimes *RSASpecialPrimes) (*RSASpecial, error)
func NewRSApecialPublic ¶
func NewRSApecialPublic(N *big.Int) *RSASpecial
func (*RSASpecial) GetPrimes ¶
func (rs *RSASpecial) GetPrimes() *RSASpecialPrimes
func (*RSASpecial) GetRandomElement ¶
func (rs *RSASpecial) GetRandomElement() (*big.Int, error)
GetRandomElement returns a random element from this group. First a random generator is chosen and then it is exponentiated to the random int between 0 and order of QR_N (P1 * Q1).
func (*RSASpecial) GetRandomGenerator ¶
func (rs *RSASpecial) GetRandomGenerator() (*big.Int, error)
GetRandomGenerator returns a random generator of a group of quadratic residues QR_N.
type RSASpecialPrimes ¶
func GetRSASpecialPrimes ¶
func GetRSASpecialPrimes(bits int) (*RSASpecialPrimes, error)
GetRSASpecialPrimes returns primes P, Q, p, q such that P = 2*p + 1 and Q = 2*q + 1.
func NewRSASpecialPrimes ¶
func NewRSASpecialPrimes(P, Q, p, q *big.Int) *RSASpecialPrimes
type RepresentationProof ¶
type RepresentationProof struct { ProofRandomData *big.Int Challenge *big.Int ProofData []*big.Int }
RepresentationProof presents all three messages in sigma protocol - useful when challenge is generated by prover via Fiat-Shamir.
func NewRepresentationProof ¶
func NewRepresentationProof(proofRandomData, challenge *big.Int, proofData []*big.Int) *RepresentationProof
type RepresentationProver ¶
type RepresentationProver struct {
// contains filtered or unexported fields
}
RepresentationProver is like SchnorrProver but in a RSASpecial group (note that here proof data is computed in Z, not modulo as in Schnorr). Also, RepresentationProver with only one base and one secret is very similar to the DFCommitmentOpeningProver (RepresentationProver does not have a committer though).
func NewRepresentationProver ¶
func NewRepresentationProver(qrSpecialRSA *RSASpecial, secParam int, secrets, bases []*big.Int, y *big.Int) *RepresentationProver
func (*RepresentationProver) GetProofData ¶
func (p *RepresentationProver) GetProofData(challenge *big.Int) []*big.Int
func (*RepresentationProver) GetProofRandomData ¶
func (p *RepresentationProver) GetProofRandomData(alsoNeg bool) *big.Int
GetProofRandomData returns t = g_1^r_1 * ... * g_k^r_k where g_i are bases and r_i are random values. If alsoNeg is true values r_i can be negative as well.
func (*RepresentationProver) GetProofRandomDataGivenBoundaries ¶
func (p *RepresentationProver) GetProofRandomDataGivenBoundaries(boundariesBitLength []int, alsoNeg bool) (*big.Int, error)
GetProofRandomDataGivenBoundaries returns t = g_1^r_1 * ... * g_k^r_k where g_i are bases and each r_i is a random value of boundariesBitLength[i] bit length. If alsoNeg is true values r_i can be negative as well.
type RepresentationVerifier ¶
type RepresentationVerifier struct {
// contains filtered or unexported fields
}
func NewRepresentationVerifier ¶
func NewRepresentationVerifier(qrSpecialRSA *RSASpecial, challengeSpaceSize int) *RepresentationVerifier
func (*RepresentationVerifier) GetChallenge ¶
func (v *RepresentationVerifier) GetChallenge() *big.Int
func (*RepresentationVerifier) SetChallenge ¶
func (v *RepresentationVerifier) SetChallenge(challenge *big.Int)
SetChallenge is used when Fiat-Shamir is used - when challenge is generated using hash by the prover.
func (*RepresentationVerifier) SetProofRandomData ¶
func (v *RepresentationVerifier) SetProofRandomData(proofRandomData *big.Int, bases []*big.Int, y *big.Int)
TODO: SetProofRandomData name is not ok - it is not only setting proofRandomData, but also bases and y.