psys

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: 13 Imported by: 0

Documentation

Index

Constants

View Source
const CA_CURVE = ec.P256

Variables

This section is empty.

Functions

func GenerateKeyPair

func GenerateKeyPair(group *schnorr.Group) (*SecKey, *PubKey)

GenerateKeyPair takes a schnorr group and constructs a pair of secret and public key for pseudonym system scheme.

Types

type CA

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

func NewCA

func NewCA(group *schnorr.Group, d *big.Int, caPubKey *PubKey) *CA

func (*CA) GetChallenge

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

func (*CA) Verify

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

type CACert

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

func NewCACert

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

type CAClient

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

func NewCAClient

func NewCAClient(g *schnorr.Group) *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(group *schnorr.Group, secKey *big.Int, pubKey *PubKey) *CAServer

func (*CAServer) GenerateCertificate

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

func (*CAServer) RegisterTo

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

type Client

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

func NewClient

func NewClient(conn *grpc.ClientConn, group *schnorr.Group) (*Client, error)

func (*Client) GenerateMasterKey

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

GenerateMasterKey generates a master secret key, representing a random integer betweeen 0 and order of the group. This key will 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)

FIXME get rid of orgname? 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 *big.Int
	SmallBToGamma *big.Int
	AToGamma      *big.Int
	BToGamma      *big.Int
	T1            *schnorr.BlindedTrans
	T2            *schnorr.BlindedTrans
}

func NewCred

func NewCred(aToGamma, bToGamma, AToGamma, BToGamma *big.Int,
	t1, t2 *schnorr.BlindedTrans) *Cred

type CredIssuer

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

func NewCredIssuer

func NewCredIssuer(group *schnorr.Group, secKey *SecKey) *CredIssuer

func (*CredIssuer) GetChallenge

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

func (*CredIssuer) GetProofData

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

func (*CredIssuer) Verify

func (i *CredIssuer) Verify(z *big.Int) (
	*big.Int, *big.Int, *big.Int, *big.Int, *big.Int, *big.Int, error)

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(group *schnorr.Group, secKey *SecKey) *CredVerifier

func (*CredVerifier) GetChallenge

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

func (*CredVerifier) Verify

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

type Nym

type Nym struct {
	A *big.Int
	B *big.Int
}

Nym represents a pseudonym in the pseudonym system scheme.

func NewNym

func NewNym(a, b *big.Int) *Nym

type NymGenerator

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

func NewNymGenerator

func NewNymGenerator(group *schnorr.Group, caPubKey *PubKey) *NymGenerator

func (*NymGenerator) GetChallenge

func (g *NymGenerator) GetChallenge(nymA, blindedA, nymB, blindedB, x1, x2,
	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(group *schnorr.Group, secKey *SecKey, pubKey, caPubKey *PubKey) *OrgServer

func (*OrgServer) GenerateNym

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

func (*OrgServer) ObtainCred

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

func (*OrgServer) RegisterTo

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

func (*OrgServer) TransferCred

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

type PubKey

type PubKey struct {
	H1, H2 *big.Int
}

func GenerateCAKeyPair

func GenerateCAKeyPair(c ec.Curve) (*big.Int, *PubKey, error)

func NewPubKey

func NewPubKey(h1, h2 *big.Int) *PubKey

type SecKey

type SecKey struct {
	S1, S2 *big.Int
}

func NewSecKey

func NewSecKey(s1, s2 *big.Int) *SecKey

Directories

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

Jump to

Keyboard shortcuts

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