core

package
v0.0.0-...-6904822 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SizeG1 = 64
	SizeG2 = 129
	SizeGT = 384
	SizeSK = 32
)
View Source
var (
	ErrCiphertext = errors.New("invalid ciphertext")
	ErrTrapdoor   = errors.New("invalid trapdoor")
	ErrRandom     = errors.New("invalid source of randomness")
)
View Source
var RandomSource = rand.Reader

Functions

func KeyGen

func KeyGen() (sk *SKey, pk *PKey, err error)

func KeyGenServer

func KeyGenServer() (sk *SKey, pk *PKeyServer, err error)

func PEKS

func PEKS(word []byte, server *PKeyServer, receiver *PKey, sender *SKey) ([]byte, error)

func Test

func Test(ciphertext, trapdoor []byte, server *SKey) (ok bool, err error)

func Trapdoor

func Trapdoor(word []byte, server *PKeyServer, sender *PKey, receiver *SKey) ([]byte, error)

Types

type EllipticKey

type EllipticKey interface {
	Bytes() []byte
	FromBytes(m []byte) error
	FromSKey(sk *SKey) error
}

type PKey

type PKey struct {
	Key *bn256.G2
}

func SharedKey

func SharedKey(pk *PKey, sk *SKey) *PKey

func (*PKey) Bytes

func (pk *PKey) Bytes() []byte

func (*PKey) FromBytes

func (pk *PKey) FromBytes(m []byte) error

func (*PKey) FromSKey

func (pk *PKey) FromSKey(sk *SKey) error

type PKeyServer

type PKeyServer struct {
	Key *bn256.GT
}

func (*PKeyServer) Bytes

func (pk *PKeyServer) Bytes() []byte

func (*PKeyServer) FromBytes

func (pk *PKeyServer) FromBytes(m []byte) error

func (*PKeyServer) FromSKey

func (pk *PKeyServer) FromSKey(sk *SKey) error

type SKey

type SKey struct {
	Key *big.Int
}

func (*SKey) Bytes

func (sk *SKey) Bytes() []byte

func (*SKey) FromBytes

func (sk *SKey) FromBytes(m []byte) error

func (*SKey) FromSKey

func (sk *SKey) FromSKey(skey *SKey) error

Jump to

Keyboard shortcuts

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