pailliersdk

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: May 15, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

README

paillier

A Paillier SDK by Golang as a wrapper of libpaillier(http://hms.isi.jhu.edu/acsc/libpaillier/)

Usage

  1. run the unit test
go test -v .

or your program.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckCommitment added in v0.0.3

func CheckCommitment(cipher, user, commitment string) bool

authorization check

func Commit added in v0.0.3

func Commit(prvkey *ecdsa.PrivateKey, cipher, user string) string

func KeyGen

func KeyGen(secbitinput int) (prv string, pub string)

paillier encryption method

void paillier_keygen(int modulusbits,

paillier_pubkey_t** pub,
paillier_prvkey_t** prv,
paillier_get_rand_t get_rand )

func KeyGenToMap

func KeyGenToMap(caller FuncCaller) (string, error)

wrap method outputs to map TODO: verify signature and commitment

func PaillierDec

func PaillierDec(cipher, pubkey, prvkey string) uint64

paillier_plaintext_t* paillier_dec(paillier_plaintext_t* res,

		 paillier_pubkey_t* pub,
 		 paillier_prvkey_t* prv,
 		 paillier_ciphertext_t* ct );

func PaillierDecToMap

func PaillierDecToMap(caller FuncCaller) (string, error)

func PaillierEnc

func PaillierEnc(msg uint32, pubkey string) string

paillier_ciphertext_t* paillier_enc(paillier_ciphertext_t* res,

paillier_pubkey_t* pub,
paillier_plaintext_t* pt,
paillier_get_rand_t get_rand )

func PaillierEncToMap

func PaillierEncToMap(caller FuncCaller) (string, error)

func PaillierExp

func PaillierExp(pubkey, cipher string, plain uint32) string

void paillier_exp(paillier_pubkey_t* pub,

paillier_ciphertext_t* res,
paillier_ciphertext_t* ct,
paillier_plaintext_t* pt )

func PaillierExpToMap

func PaillierExpToMap(caller FuncCaller) (string, error)

func PaillierMul

func PaillierMul(pubkey, cipher1, cipher2 string) string

void paillier_mul(paillier_pubkey_t* pub,

paillier_ciphertext_t* res,
paillier_ciphertext_t* ct0,
paillier_ciphertext_t* ct1 );

func PaillierMulToMap

func PaillierMulToMap(caller FuncCaller) (string, error)

Types

type ECDSASignature added in v0.0.3

type ECDSASignature struct {
	R, S *big.Int
}

ECDSASignature is the structure for marshall signature

type FuncCaller

type FuncCaller struct {
	Method    string `json:"method"`
	Args      string `json:"args"`
	Address   string `json:"address"`
	PublicKey string `json:"public_key"`
	Signature string `json:"signature"`
}

type PaillierClient

type PaillierClient struct{}

func NewPaillierClient

func NewPaillierClient() *PaillierClient

func (*PaillierClient) Submit

func (s *PaillierClient) Submit(method string, inputs string) (string, error)

type PaillierConfig

type PaillierConfig struct {
	Enable bool `yaml:"enable"`
}

Directories

Path Synopsis
xchain_plugin
pb

Jump to

Keyboard shortcuts

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