ecpsys

package
v0.0.0-...-2c216b4 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2019 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CA

type CA struct {
	// contains filtered or unexported fields
}

func NewCA

func NewCA(d *big.Int, caPubKey *psys.PubKey, curve ec.Curve) *CA

func (*CA) GetChallenge

func (ca *CA) GetChallenge(a, b, x *ec.GroupElement) *big.Int

func (*CA) Verify

func (ca *CA) Verify(z *big.Int) (*CACert, error)

type CACert

type CACert struct {
	BlindedA *ec.GroupElement
	BlindedB *ec.GroupElement
	R        *big.Int
	S        *big.Int
}

func NewCACert

func NewCACert(blindedA, blindedB *ec.GroupElement, r, s *big.Int) *CACert

type CAClient

type CAClient struct {
	pb.CA_ECClient
	// contains filtered or unexported fields
}

func NewCAClient

func NewCAClient(curve ec.Curve) *CAClient

func (*CAClient) Connect

func (c *CAClient) Connect(conn *grpc.ClientConn) *CAClient

func (*CAClient) GenerateCertificate

func (c *CAClient) GenerateCertificate(userSecret *big.Int, nym *Nym) (*CACert, error)

GenerateCertificate provides a certificate from trusted CA to the user. Note that CA needs to know the user. The certificate is then used for registering pseudonym (nym). The certificate contains blinded user's master key pair and a signature of it.

func (*CAClient) GenerateMasterNym

func (c *CAClient) GenerateMasterNym(secret *big.Int) *Nym

GenerateMasterNym generates a master pseudonym to be used with GenerateCertificate.

type CAServer

type CAServer struct {
	// contains filtered or unexported fields
}

func NewCAServer

func NewCAServer(secKey *big.Int, pubKey *psys.PubKey, curve ec.Curve) *CAServer

func (*CAServer) GenerateCertificate

func (s *CAServer) GenerateCertificate(stream pb.
	CA_EC_GenerateCertificateServer) error

func (*CAServer) RegisterTo

func (s *CAServer) RegisterTo(grpcSrv *grpc.Server)

type Client

type Client struct {
	pb.Org_ECClient
	// contains filtered or unexported fields
}

func NewClient

func NewClient(conn *grpc.ClientConn, curve ec.Curve) (*Client, error)

func (*Client) GenerateMasterKey

func (c *Client) GenerateMasterKey() *big.Int

TODO make it without connection ? GenerateMasterKey generates a master secret key to be used subsequently by all the protocols in the scheme.

func (*Client) GenerateNym

func (c *Client) GenerateNym(userSecret *big.Int, caCert *CACert,
	regKey string) (*Nym, error)

GenerateNym generates a nym and registers it to the organization. Do not use the same CACert for different organizations - use it only once!

func (*Client) ObtainCredential

func (c *Client) ObtainCredential(userSecret *big.Int,
	nym *Nym, orgPubKeys *PubKey) (
	*Cred, error)

ObtainCredential returns anonymous credential.

func (*Client) TransferCredential

func (c *Client) TransferCredential(orgName string, userSecret *big.Int,
	nym *Nym, cred *Cred) (*string, error)

TransferCredential transfers orgName's credential to organization where the authentication should happen (the organization takes credential issued by another organization).

type Cred

type Cred struct {
	SmallAToGamma *ec.GroupElement
	SmallBToGamma *ec.GroupElement
	AToGamma      *ec.GroupElement
	BToGamma      *ec.GroupElement
	T1            *ecschnorr.BlindedTrans
	T2            *ecschnorr.BlindedTrans
}

func NewCred

func NewCred(aToGamma, bToGamma, AToGamma, BToGamma *ec.GroupElement,
	t1, t2 *ecschnorr.BlindedTrans) *Cred

type CredIssuer

type CredIssuer struct {
	// contains filtered or unexported fields
}

func NewCredIssuer

func NewCredIssuer(secKey *psys.SecKey, curveType ec.Curve) *CredIssuer

func (*CredIssuer) GetChallenge

func (i *CredIssuer) GetChallenge(a, b, x *ec.GroupElement) *big.Int

TODO GetChallenge?

func (*CredIssuer) GetProofData

func (i *CredIssuer) GetProofData(challenge1, challenge2 *big.Int) (*big.Int, *big.Int)

func (*CredIssuer) Verify

Verifies that user knows log_a(b). Sends back proof random data (g1^r, g2^r) for both equality proofs.

type CredVerifier

type CredVerifier struct {
	// contains filtered or unexported fields
}

func NewCredVerifier

func NewCredVerifier(secKey *psys.SecKey, c ec.Curve) *CredVerifier

func (*CredVerifier) GetChallenge

func (v *CredVerifier) GetChallenge(a, b, a1, b1,
	x1, x2 *ec.GroupElement) *big.Int

TODO GetChallenge?

func (*CredVerifier) Verify

func (v *CredVerifier) Verify(z *big.Int,
	credential *Cred, orgPubKeys *PubKey) bool

type Nym

type Nym struct {
	A *ec.GroupElement
	B *ec.GroupElement
}

Nym represents a pseudonym in the pseudonym system scheme.

func NewNym

func NewNym(a, b *ec.GroupElement) *Nym

type NymGenerator

type NymGenerator struct {
	// contains filtered or unexported fields
}

func NewNymGenerator

func NewNymGenerator(pubKey *psys.PubKey, c ec.Curve) *NymGenerator

func (*NymGenerator) GetChallenge

func (g *NymGenerator) GetChallenge(nymA, blindedA, nymB, blindedB,
	x1, x2 *ec.GroupElement, r, s *big.Int) (*big.Int, error)

func (*NymGenerator) Verify

func (g *NymGenerator) Verify(z *big.Int) bool

TODO: store (a, b) into a database if verified

type OrgServer

type OrgServer struct {
	*NymGenerator
	*CredIssuer
	*CredVerifier

	SessMgr anauth.SessManager
	RegMgr  anauth.RegManager
	// contains filtered or unexported fields
}

func NewOrgServer

func NewOrgServer(c ec.Curve, secKey *psys.SecKey, pubKey *PubKey, caPubKey *psys.PubKey) *OrgServer

func (*OrgServer) GenerateNym

func (s *OrgServer) GenerateNym(stream pb.Org_EC_GenerateNymServer) error

func (*OrgServer) ObtainCred

func (s *OrgServer) ObtainCred(stream pb.Org_EC_ObtainCredServer) error

func (*OrgServer) RegisterTo

func (s *OrgServer) RegisterTo(grpcSrv *grpc.Server)

func (*OrgServer) TransferCred

func (s *OrgServer) TransferCred(stream pb.Org_EC_TransferCredServer) error

type PubKey

type PubKey struct {
	H1, H2 *ec.GroupElement
}

func GenerateKeyPair

func GenerateKeyPair(group *ec.Group) (*psys.SecKey, *PubKey)

GenerateKeyPair takes EC group and constructs a public key for pseudonym system scheme in EC arithmetic.

func NewPubKey

func NewPubKey(h1, h2 *ec.GroupElement) *PubKey

Directories

Path Synopsis
Package ecpsyspb is a generated protocol buffer package.
Package ecpsyspb is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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