Documentation ¶
Index ¶
- Variables
- type Paillier
- func (p *Paillier) Decrypt(cBytes []byte) ([]byte, error)
- func (p *Paillier) GetMtaProof(curve elliptic.Curve, _ *big.Int, a *big.Int) ([]byte, error)
- func (p *Paillier) GetPubKey() homo.Pubkey
- func (p *Paillier) NewPubKeyFromBytes(bs []byte) (homo.Pubkey, error)
- func (p *Paillier) VerifyMtaProof(bs []byte, curve elliptic.Curve, _ *big.Int, _ *big.Int) (*pt.ECPoint, error)
- type PubKeyMessage
- func (*PubKeyMessage) Descriptor() ([]byte, []int)
- func (m *PubKeyMessage) GetG() []byte
- func (m *PubKeyMessage) GetProof() *zkproof.IntegerFactorizationProofMessage
- func (*PubKeyMessage) ProtoMessage()
- func (m *PubKeyMessage) Reset()
- func (m *PubKeyMessage) String() string
- func (msg *PubKeyMessage) ToPubkey() (*PublicKey, error)
- func (m *PubKeyMessage) XXX_DiscardUnknown()
- func (m *PubKeyMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *PubKeyMessage) XXX_Merge(src proto.Message)
- func (m *PubKeyMessage) XXX_Size() int
- func (m *PubKeyMessage) XXX_Unmarshal(b []byte) error
- type PublicKey
- func (pub *PublicKey) Add(c1Bytes []byte, c2Bytes []byte) ([]byte, error)
- func (pub *PublicKey) Encrypt(mBytes []byte) ([]byte, error)
- func (pub *PublicKey) GetG() *big.Int
- func (pub *PublicKey) GetMessageRange(fieldOrder *big.Int) *big.Int
- func (pub *PublicKey) GetNSquare() *big.Int
- func (pub *PublicKey) MulConst(cBytes []byte, scalar *big.Int) ([]byte, error)
- func (pub *PublicKey) ToPubKeyBytes() []byte
- func (pub *PublicKey) VerifyEnc([]byte) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( //ErrExceedMaxRetry is returned if we retried over times ErrExceedMaxRetry = errors.New("exceed max retries") //ErrInvalidInput is returned if the input is invalid ErrInvalidInput = errors.New("invalid input") //ErrInvalidMessage is returned if the message is invalid ErrInvalidMessage = errors.New("invalid message") )
Functions ¶
This section is empty.
Types ¶
type Paillier ¶
type Paillier struct { *PublicKey // contains filtered or unexported fields }
func NewPaillier ¶
func (*Paillier) GetMtaProof ¶
func (*Paillier) NewPubKeyFromBytes ¶
type PubKeyMessage ¶
type PubKeyMessage struct { Proof *zkproof.IntegerFactorizationProofMessage `protobuf:"bytes,1,opt,name=proof,proto3" json:"proof,omitempty"` G []byte `protobuf:"bytes,2,opt,name=g,proto3" json:"g,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*PubKeyMessage) Descriptor ¶
func (*PubKeyMessage) Descriptor() ([]byte, []int)
func (*PubKeyMessage) GetG ¶
func (m *PubKeyMessage) GetG() []byte
func (*PubKeyMessage) GetProof ¶
func (m *PubKeyMessage) GetProof() *zkproof.IntegerFactorizationProofMessage
func (*PubKeyMessage) ProtoMessage ¶
func (*PubKeyMessage) ProtoMessage()
func (*PubKeyMessage) Reset ¶
func (m *PubKeyMessage) Reset()
func (*PubKeyMessage) String ¶
func (m *PubKeyMessage) String() string
func (*PubKeyMessage) ToPubkey ¶
func (msg *PubKeyMessage) ToPubkey() (*PublicKey, error)
func (*PubKeyMessage) XXX_DiscardUnknown ¶
func (m *PubKeyMessage) XXX_DiscardUnknown()
func (*PubKeyMessage) XXX_Marshal ¶
func (m *PubKeyMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*PubKeyMessage) XXX_Merge ¶
func (m *PubKeyMessage) XXX_Merge(src proto.Message)
func (*PubKeyMessage) XXX_Size ¶
func (m *PubKeyMessage) XXX_Size() int
func (*PubKeyMessage) XXX_Unmarshal ¶
func (m *PubKeyMessage) XXX_Unmarshal(b []byte) error
type PublicKey ¶
type PublicKey struct {
// contains filtered or unexported fields
}
PublicKey is (n, g)
func (*PublicKey) Add ¶
1. Check that c1, c2 is correct. 2. Choose (r, N)=1 with r in [1, N-1] randomly. 3. Compute c1*c2*r^N mod N^2.
func (*PublicKey) GetMessageRange ¶
func (*PublicKey) GetNSquare ¶
func (*PublicKey) MulConst ¶
1. Check that c is correct. 2. Compute scalar mod N. 3. Choose (r, N)=1 with r in [1, N-1] randomly. 4. Compute c^scalar*r^N mod N^2.
func (*PublicKey) ToPubKeyBytes ¶
Click to show internal directories.
Click to hide internal directories.