Documentation ¶
Index ¶
- Variables
- type CL
- func (c *CL) Decrypt(data []byte) ([]byte, error)
- func (c *CL) GetMtaProof(curve elliptic.Curve, beta *big.Int, b *big.Int) ([]byte, error)
- func (c *CL) GetPubKey() homo.Pubkey
- func (c *CL) NewPubKeyFromBytes(bs []byte) (homo.Pubkey, error)
- func (c *CL) VerifyMtaProof(bs []byte, curve elliptic.Curve, alpha *big.Int, k *big.Int) (*pt.ECPoint, error)
- type EncryptedMessage
- func (*EncryptedMessage) Descriptor() ([]byte, []int)deprecated
- func (x *EncryptedMessage) GetM1() *binaryquadraticform.BQForm
- func (x *EncryptedMessage) GetM2() *binaryquadraticform.BQForm
- func (x *EncryptedMessage) GetProof() *ProofMessage
- func (*EncryptedMessage) ProtoMessage()
- func (x *EncryptedMessage) ProtoReflect() protoreflect.Message
- func (x *EncryptedMessage) Reset()
- func (x *EncryptedMessage) String() string
- type Hash
- func (*Hash) Descriptor() ([]byte, []int)deprecated
- func (x *Hash) GetA() []byte
- func (x *Hash) GetC() []byte
- func (x *Hash) GetF() *binaryquadraticform.BQForm
- func (x *Hash) GetG() *binaryquadraticform.BQForm
- func (x *Hash) GetH() *binaryquadraticform.BQForm
- func (x *Hash) GetP() []byte
- func (x *Hash) GetQ() []byte
- func (x *Hash) GetT1() *binaryquadraticform.BQForm
- func (x *Hash) GetT2() *binaryquadraticform.BQForm
- func (*Hash) ProtoMessage()
- func (x *Hash) ProtoReflect() protoreflect.Message
- func (x *Hash) Reset()
- func (x *Hash) String() string
- type ProofMessage
- func (*ProofMessage) Descriptor() ([]byte, []int)deprecated
- func (x *ProofMessage) GetSalt() []byte
- func (x *ProofMessage) GetT1() *binaryquadraticform.BQForm
- func (x *ProofMessage) GetT2() *binaryquadraticform.BQForm
- func (x *ProofMessage) GetU1() []byte
- func (x *ProofMessage) GetU2() []byte
- func (*ProofMessage) ProtoMessage()
- func (x *ProofMessage) ProtoReflect() protoreflect.Message
- func (x *ProofMessage) Reset()
- func (x *ProofMessage) String() string
- type PubKeyMessage
- func (*PubKeyMessage) Descriptor() ([]byte, []int)deprecated
- func (x *PubKeyMessage) GetA() []byte
- func (x *PubKeyMessage) GetC() []byte
- func (x *PubKeyMessage) GetD() uint32
- func (x *PubKeyMessage) GetF() *binaryquadraticform.BQForm
- func (x *PubKeyMessage) GetG() *binaryquadraticform.BQForm
- func (x *PubKeyMessage) GetH() *binaryquadraticform.BQForm
- func (x *PubKeyMessage) GetP() []byte
- func (x *PubKeyMessage) GetProof() *ProofMessage
- func (x *PubKeyMessage) GetQ() []byte
- func (*PubKeyMessage) ProtoMessage()
- func (x *PubKeyMessage) ProtoReflect() protoreflect.Message
- func (x *PubKeyMessage) Reset()
- func (x *PubKeyMessage) String() string
- func (m *PubKeyMessage) ToPubkey() (*PublicKey, error)
- type PublicKey
- func (publicKey *PublicKey) Add(m1 []byte, m2 []byte) ([]byte, error)
- func (publicKey *PublicKey) Encrypt(data []byte) ([]byte, error)
- func (publicKey *PublicKey) GetMessageRange(fieldOrder *big.Int) *big.Int
- func (pubKey *PublicKey) GetPubKeyProof() *ProofMessage
- func (publicKey *PublicKey) MulConst(m1 []byte, constant *big.Int) ([]byte, error)
- func (publicKey *PublicKey) ToPubKeyBytes() []byte
- func (publicKey *PublicKey) ToPubKeyMessage() *PubKeyMessage
- func (pubKey *PublicKey) Verify() error
- func (pubKey *PublicKey) VerifyEnc(bs []byte) error
- type VerifyMtaMessage
- func (*VerifyMtaMessage) Descriptor() ([]byte, []int)deprecated
- func (x *VerifyMtaMessage) GetProofB() *zkproof.SchnorrProofMessage
- func (x *VerifyMtaMessage) GetProofBeta() *zkproof.SchnorrProofMessage
- func (*VerifyMtaMessage) ProtoMessage()
- func (x *VerifyMtaMessage) ProtoReflect() protoreflect.Message
- func (x *VerifyMtaMessage) Reset()
- func (x *VerifyMtaMessage) String() string
Constants ¶
This section is empty.
Variables ¶
var ( //ErrSmallSafeParameter is returned if SafeParameter /2 < the big-length of messagespace + 2 ErrSmallSafeParameter = errors.New("small safe parameter") //ErrNoSplittingPrime is returned if we can not find any split prime in the list. //We can find any split prime in primeList, the possibility is 1 / 2^(len(primeList)). ErrNoSplittingPrime = errors.New("no splittable primes") //ErrFailedVerify is returned if we verify failed ErrFailedVerify = errors.New("failed verify") //ErrFailedGenerateG is returned if g is the identity element ErrFailedGenerateG = errors.New("failed generate non-identity g") //ErrNotBigPrime is returned if p is not a big prime ErrNotBigPrime = errors.New("not a big prime") )
var ( // ErrDifferentBQForms is returned if the two quadratic forms are different ErrDifferentBQForms = errors.New("different binary quadratic Forms") )
var ( //ErrInvalidMessage is returned if the message is invalid ErrInvalidMessage = errors.New("invalid message") )
var File_github_com_getamis_alice_crypto_homo_cl_message_proto protoreflect.FileDescriptor
Functions ¶
This section is empty.
Types ¶
type CL ¶
type CL struct { *PublicKey // contains filtered or unexported fields }
func NewCL ¶
func NewCL(c *big.Int, d uint32, p *big.Int, safeParameter int, distributionDistance uint) (*CL, error)
NewCL news the cl crypto. Please refer the following paper Fig. 2 for the key generation flow. https://pdfs.semanticscholar.org/fba2/b7806ea103b41e411792a87a18972c2777d2.pdf?_ga=2.188920107.1077232223.1562737567-609154886.1559798768
func (*CL) GetMtaProof ¶
type EncryptedMessage ¶
type EncryptedMessage struct { M1 *binaryquadraticform.BQForm `protobuf:"bytes,1,opt,name=m1,proto3" json:"m1,omitempty"` M2 *binaryquadraticform.BQForm `protobuf:"bytes,2,opt,name=m2,proto3" json:"m2,omitempty"` Proof *ProofMessage `protobuf:"bytes,3,opt,name=proof,proto3" json:"proof,omitempty"` // contains filtered or unexported fields }
func (*EncryptedMessage) Descriptor
deprecated
func (*EncryptedMessage) Descriptor() ([]byte, []int)
Deprecated: Use EncryptedMessage.ProtoReflect.Descriptor instead.
func (*EncryptedMessage) GetM1 ¶
func (x *EncryptedMessage) GetM1() *binaryquadraticform.BQForm
func (*EncryptedMessage) GetM2 ¶
func (x *EncryptedMessage) GetM2() *binaryquadraticform.BQForm
func (*EncryptedMessage) GetProof ¶
func (x *EncryptedMessage) GetProof() *ProofMessage
func (*EncryptedMessage) ProtoMessage ¶
func (*EncryptedMessage) ProtoMessage()
func (*EncryptedMessage) ProtoReflect ¶ added in v1.0.2
func (x *EncryptedMessage) ProtoReflect() protoreflect.Message
func (*EncryptedMessage) Reset ¶
func (x *EncryptedMessage) Reset()
func (*EncryptedMessage) String ¶
func (x *EncryptedMessage) String() string
type Hash ¶
type Hash struct { T1 *binaryquadraticform.BQForm `protobuf:"bytes,1,opt,name=t1,proto3" json:"t1,omitempty"` T2 *binaryquadraticform.BQForm `protobuf:"bytes,2,opt,name=t2,proto3" json:"t2,omitempty"` G *binaryquadraticform.BQForm `protobuf:"bytes,3,opt,name=g,proto3" json:"g,omitempty"` F *binaryquadraticform.BQForm `protobuf:"bytes,4,opt,name=f,proto3" json:"f,omitempty"` H *binaryquadraticform.BQForm `protobuf:"bytes,5,opt,name=h,proto3" json:"h,omitempty"` P []byte `protobuf:"bytes,6,opt,name=p,proto3" json:"p,omitempty"` Q []byte `protobuf:"bytes,7,opt,name=q,proto3" json:"q,omitempty"` A []byte `protobuf:"bytes,8,opt,name=a,proto3" json:"a,omitempty"` C []byte `protobuf:"bytes,9,opt,name=c,proto3" json:"c,omitempty"` // contains filtered or unexported fields }
func (*Hash) Descriptor
deprecated
func (*Hash) GetF ¶
func (x *Hash) GetF() *binaryquadraticform.BQForm
func (*Hash) GetG ¶
func (x *Hash) GetG() *binaryquadraticform.BQForm
func (*Hash) GetH ¶
func (x *Hash) GetH() *binaryquadraticform.BQForm
func (*Hash) GetT1 ¶
func (x *Hash) GetT1() *binaryquadraticform.BQForm
func (*Hash) GetT2 ¶
func (x *Hash) GetT2() *binaryquadraticform.BQForm
func (*Hash) ProtoMessage ¶
func (*Hash) ProtoMessage()
func (*Hash) ProtoReflect ¶ added in v1.0.2
func (x *Hash) ProtoReflect() protoreflect.Message
type ProofMessage ¶
type ProofMessage struct { Salt []byte `protobuf:"bytes,1,opt,name=salt,proto3" json:"salt,omitempty"` U1 []byte `protobuf:"bytes,2,opt,name=u1,proto3" json:"u1,omitempty"` U2 []byte `protobuf:"bytes,3,opt,name=u2,proto3" json:"u2,omitempty"` T1 *binaryquadraticform.BQForm `protobuf:"bytes,4,opt,name=t1,proto3" json:"t1,omitempty"` T2 *binaryquadraticform.BQForm `protobuf:"bytes,5,opt,name=t2,proto3" json:"t2,omitempty"` // contains filtered or unexported fields }
func (*ProofMessage) Descriptor
deprecated
func (*ProofMessage) Descriptor() ([]byte, []int)
Deprecated: Use ProofMessage.ProtoReflect.Descriptor instead.
func (*ProofMessage) GetSalt ¶ added in v1.0.2
func (x *ProofMessage) GetSalt() []byte
func (*ProofMessage) GetT1 ¶
func (x *ProofMessage) GetT1() *binaryquadraticform.BQForm
func (*ProofMessage) GetT2 ¶
func (x *ProofMessage) GetT2() *binaryquadraticform.BQForm
func (*ProofMessage) GetU1 ¶
func (x *ProofMessage) GetU1() []byte
func (*ProofMessage) GetU2 ¶
func (x *ProofMessage) GetU2() []byte
func (*ProofMessage) ProtoMessage ¶
func (*ProofMessage) ProtoMessage()
func (*ProofMessage) ProtoReflect ¶ added in v1.0.2
func (x *ProofMessage) ProtoReflect() protoreflect.Message
func (*ProofMessage) Reset ¶
func (x *ProofMessage) Reset()
func (*ProofMessage) String ¶
func (x *ProofMessage) String() string
type PubKeyMessage ¶
type PubKeyMessage struct { P []byte `protobuf:"bytes,1,opt,name=p,proto3" json:"p,omitempty"` A []byte `protobuf:"bytes,2,opt,name=a,proto3" json:"a,omitempty"` Q []byte `protobuf:"bytes,3,opt,name=q,proto3" json:"q,omitempty"` G *binaryquadraticform.BQForm `protobuf:"bytes,4,opt,name=g,proto3" json:"g,omitempty"` F *binaryquadraticform.BQForm `protobuf:"bytes,5,opt,name=f,proto3" json:"f,omitempty"` H *binaryquadraticform.BQForm `protobuf:"bytes,6,opt,name=h,proto3" json:"h,omitempty"` C []byte `protobuf:"bytes,7,opt,name=c,proto3" json:"c,omitempty"` D uint32 `protobuf:"varint,8,opt,name=d,proto3" json:"d,omitempty"` Proof *ProofMessage `protobuf:"bytes,9,opt,name=proof,proto3" json:"proof,omitempty"` // contains filtered or unexported fields }
func (*PubKeyMessage) Descriptor
deprecated
func (*PubKeyMessage) Descriptor() ([]byte, []int)
Deprecated: Use PubKeyMessage.ProtoReflect.Descriptor instead.
func (*PubKeyMessage) GetA ¶
func (x *PubKeyMessage) GetA() []byte
func (*PubKeyMessage) GetC ¶
func (x *PubKeyMessage) GetC() []byte
func (*PubKeyMessage) GetD ¶
func (x *PubKeyMessage) GetD() uint32
func (*PubKeyMessage) GetF ¶
func (x *PubKeyMessage) GetF() *binaryquadraticform.BQForm
func (*PubKeyMessage) GetG ¶
func (x *PubKeyMessage) GetG() *binaryquadraticform.BQForm
func (*PubKeyMessage) GetH ¶
func (x *PubKeyMessage) GetH() *binaryquadraticform.BQForm
func (*PubKeyMessage) GetP ¶
func (x *PubKeyMessage) GetP() []byte
func (*PubKeyMessage) GetProof ¶ added in v1.0.2
func (x *PubKeyMessage) GetProof() *ProofMessage
func (*PubKeyMessage) GetQ ¶
func (x *PubKeyMessage) GetQ() []byte
func (*PubKeyMessage) ProtoMessage ¶
func (*PubKeyMessage) ProtoMessage()
func (*PubKeyMessage) ProtoReflect ¶ added in v1.0.2
func (x *PubKeyMessage) ProtoReflect() protoreflect.Message
func (*PubKeyMessage) Reset ¶
func (x *PubKeyMessage) Reset()
func (*PubKeyMessage) String ¶
func (x *PubKeyMessage) String() string
func (*PubKeyMessage) ToPubkey ¶
func (m *PubKeyMessage) ToPubkey() (*PublicKey, error)
type PublicKey ¶
type PublicKey struct {
// contains filtered or unexported fields
}
* Paper: Linearly Homomorphic Encryption from DDH & Bandwidth-efficient threshold EC-DSA * s : an upper bound of 1/π(ln|ΔK|)|ΔK|^(1/2) i.e. In this implementation, we set it to be Ceil(1/π(ln|ΔK|))*([|ΔK|^(1/2)]+1). * p : message space (μ bits prime) * a : s*2^(distributionDistance) * o : an element in ideal class group of quadratic order * f : a generator of the subgroup of order p of ideal class group of quadratic order * g : o^b for some random b in [1,2^(distributionDistance)*s) * h : g^x, where x is the chosen private key, h is the public key Note: a = s*2^(40), d = 40, C = 1024.
func (*PublicKey) GetMessageRange ¶
func (*PublicKey) GetPubKeyProof ¶ added in v1.0.2
func (pubKey *PublicKey) GetPubKeyProof() *ProofMessage
func (*PublicKey) ToPubKeyBytes ¶
func (*PublicKey) ToPubKeyMessage ¶
func (publicKey *PublicKey) ToPubKeyMessage() *PubKeyMessage
type VerifyMtaMessage ¶
type VerifyMtaMessage struct { ProofBeta *zkproof.SchnorrProofMessage `protobuf:"bytes,1,opt,name=proofBeta,proto3" json:"proofBeta,omitempty"` ProofB *zkproof.SchnorrProofMessage `protobuf:"bytes,2,opt,name=proofB,proto3" json:"proofB,omitempty"` // contains filtered or unexported fields }
func (*VerifyMtaMessage) Descriptor
deprecated
func (*VerifyMtaMessage) Descriptor() ([]byte, []int)
Deprecated: Use VerifyMtaMessage.ProtoReflect.Descriptor instead.
func (*VerifyMtaMessage) GetProofB ¶ added in v1.0.2
func (x *VerifyMtaMessage) GetProofB() *zkproof.SchnorrProofMessage
func (*VerifyMtaMessage) GetProofBeta ¶ added in v1.0.2
func (x *VerifyMtaMessage) GetProofBeta() *zkproof.SchnorrProofMessage
func (*VerifyMtaMessage) ProtoMessage ¶
func (*VerifyMtaMessage) ProtoMessage()
func (*VerifyMtaMessage) ProtoReflect ¶ added in v1.0.2
func (x *VerifyMtaMessage) ProtoReflect() protoreflect.Message
func (*VerifyMtaMessage) Reset ¶
func (x *VerifyMtaMessage) Reset()
func (*VerifyMtaMessage) String ¶
func (x *VerifyMtaMessage) String() string