jjm

package
v0.0.0-...-cc363e2 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2015 License: BSD-3-Clause Imports: 6 Imported by: 12

Documentation

Overview

Package jjm implements the JJM blind signature scheme over ECC

Index

Constants

View Source
const SchemeName = "JJM"

SchemeName is the name of this blinding scheme

Variables

This section is empty.

Functions

This section is empty.

Types

type BlindMessage

type BlindMessage struct {
	SchemeName string
	DataType   genericblinding.DataType
	PubKey     eccutil.Point
	M1, M2     *big.Int
}

BlindMessage contains the client-produced blinding factors

func NewBlindMessage

func NewBlindMessage(PubKey *eccutil.Point) BlindMessage

NewBlindMessage returns a new BlindingParamClient

func (BlindMessage) Marshal

func (blindMessage BlindMessage) Marshal() ([]byte, error)

Marshal a BlindingParamClient

func (BlindMessage) SchemeData

func (blindMessage BlindMessage) SchemeData() (string, genericblinding.DataType, *eccutil.Point)

SchemeData returns general data for the scheme and BlindingData type

func (BlindMessage) UniqueID

func (blindMessage BlindMessage) UniqueID() []byte

UniqueID returns a unique ID for this element. Constant in this case (zeros)

func (BlindMessage) Unmarshal

func (blindMessage BlindMessage) Unmarshal(b []byte) (genericblinding.BlindingData, error)

Unmarshal []byte into BlindingParamClient

type BlindMessageInt

type BlindMessageInt struct {
	M1, M2 *big.Int
	// contains filtered or unexported fields
}

BlindMessageInt contains a blinded message to be signed

type BlindSignature

type BlindSignature struct {
	SchemeName         string
	DataType           genericblinding.DataType
	PubKey             eccutil.Point
	ScalarS1, ScalarS2 *big.Int
}

BlindSignature contains the client-produced blinding factors

func NewBlindSignature

func NewBlindSignature(PubKey *eccutil.Point) BlindSignature

NewBlindSignature returns a new BlindingParamClient

func (BlindSignature) Marshal

func (blindSignature BlindSignature) Marshal() ([]byte, error)

Marshal a BlindingParamClient

func (BlindSignature) SchemeData

func (blindSignature BlindSignature) SchemeData() (string, genericblinding.DataType, *eccutil.Point)

SchemeData returns general data for the scheme and BlindingData type

func (BlindSignature) UniqueID

func (blindSignature BlindSignature) UniqueID() []byte

UniqueID returns a unique ID for this element. Constant in this case (zeros)

func (BlindSignature) Unmarshal

func (blindSignature BlindSignature) Unmarshal(b []byte) (genericblinding.BlindingData, error)

Unmarshal []byte into BlindingParamClient

type BlindSignatureInt

type BlindSignatureInt struct {
	ScalarS1, ScalarS2 *big.Int
}

BlindSignatureInt is a blind signature

type BlindingClient

type BlindingClient struct {
	PubKey *eccutil.Point
	// contains filtered or unexported fields
}

BlindingClient a blinding client

func NewBlindingClient

func NewBlindingClient(curve *eccutil.Curve, pubKey *eccutil.Point) *BlindingClient

NewBlindingClient returns a new BlindingClient

func (BlindingClient) Blind

func (client BlindingClient) Blind(msg []byte, SignerParams *SignRequestPublicInt, BlindingParams *BlindingParamsPrivateInt) (blindmessage *BlindMessageInt, err error)

Blind blinds a message msg for blinding using params. Returns blinded message or error

func (BlindingClient) CalculateBlindingParams

func (client BlindingClient) CalculateBlindingParams(params *SignRequestPublicInt) (privateParams *BlindingParamsPrivateInt, err error)

CalculateBlindingParams generates the w,z,e,d,a,b privateParams blinding parameters and calculates r1,r2 (included in privateParams)

func (BlindingClient) Unblind

func (client BlindingClient) Unblind(blindSignature *BlindSignatureInt, BlindingParams *BlindingParamsPrivateInt) (signature *SignatureInt, err error)

Unblind a signature

func (BlindingClient) Verify

func (client BlindingClient) Verify(msg []byte, signature *SignatureInt) bool

Verify verifies that a signature does actually verify for a given message and signer public key

type BlindingFactors

type BlindingFactors struct {
	SchemeName string
	DataType   genericblinding.DataType
	PubKey     eccutil.Point

	ScalarW, ScalarZ *big.Int // w,z random. GCD(w,z) == 1
	ScalarE, ScalarD *big.Int // e,d -> ew + dz == 1
	ScalarA, ScalarB *big.Int // random

	PointR1, PointR2     eccutil.Point // R1=w * a * l1 x RS1, R2=w*a*l2 x RS2
	ScalarR1, ScalarR2   *big.Int      // R1.x, R2.x  mod P !=0 . Precalculated
	ScalarRs1, ScalarRs2 *big.Int      // Simplification
	IsUsed               bool
}

BlindingFactors contains the client-produced blinding factors

func NewBlindingFactors

func NewBlindingFactors(PubKey *eccutil.Point) BlindingFactors

NewBlindingFactors returns a new BlindingParamClient

func (BlindingFactors) Marshal

func (blindingFactors BlindingFactors) Marshal() ([]byte, error)

Marshal a BlindingParamClient

func (BlindingFactors) SchemeData

func (blindingFactors BlindingFactors) SchemeData() (string, genericblinding.DataType, *eccutil.Point)

SchemeData returns general data for the scheme and BlindingData type

func (BlindingFactors) UniqueID

func (blindingFactors BlindingFactors) UniqueID() []byte

UniqueID returns a unique ID for this element. Constant in this case (zeros)

func (BlindingFactors) Unmarshal

func (blindingFactors BlindingFactors) Unmarshal(b []byte) (genericblinding.BlindingData, error)

Unmarshal []byte into BlindingParamClient

type BlindingParamClient

type BlindingParamClient struct {
	SchemeName           string
	DataType             genericblinding.DataType
	PubKey               eccutil.Point
	PointRs1, PointRs2   eccutil.Point // R points
	ScalarLs1, ScalarLs2 *big.Int      // l parameters
}

BlindingParamClient is not needed in JJM

func NewBlindingParamClient

func NewBlindingParamClient(PubKey *eccutil.Point) BlindingParamClient

NewBlindingParamClient returns a new BlindingParamClient

func (BlindingParamClient) Marshal

func (blindingParamClient BlindingParamClient) Marshal() ([]byte, error)

Marshal a BlindingParamClient

func (BlindingParamClient) SchemeData

func (blindingParamClient BlindingParamClient) SchemeData() (string, genericblinding.DataType, *eccutil.Point)

SchemeData returns general data for the scheme and BlindingData type

func (BlindingParamClient) UniqueID

func (blindingParamClient BlindingParamClient) UniqueID() []byte

UniqueID returns a unique ID for this element. Constant in this case (zeros)

func (BlindingParamClient) Unmarshal

func (blindingParamClient BlindingParamClient) Unmarshal(b []byte) (genericblinding.BlindingData, error)

Unmarshal []byte into BlindingParamClient

type BlindingParamServer

type BlindingParamServer struct {
	SchemeName           string
	DataType             genericblinding.DataType
	PubKey               eccutil.Point
	ScalarKs1, ScalarKs2 *big.Int      // k parameters. Private.  kn x curve.G == Rn
	PointRs1, PointRs2   eccutil.Point // R points. Public data, but kept for reverence
	ScalarLs1, ScalarLs2 *big.Int      // l parameters. Public data, but kept for reverence
	ScalarRs1, ScalarRs2 *big.Int      // x coordinates of PointRs1, PointRs2. Public. Pre-calculated.
	IsUsed               bool
}

BlindingParamServer is not needed in JJM

func NewBlindingParamServer

func NewBlindingParamServer(PubKey *eccutil.Point) BlindingParamServer

NewBlindingParamServer returns a new BlindingParamServer

func (BlindingParamServer) Marshal

func (blindingParamServer BlindingParamServer) Marshal() ([]byte, error)

Marshal a BlindingParamServer

func (BlindingParamServer) SchemeData

func (blindingParamServer BlindingParamServer) SchemeData() (string, genericblinding.DataType, *eccutil.Point)

SchemeData returns general data for the scheme and BlindingData type

func (BlindingParamServer) UniqueID

func (blindingParamServer BlindingParamServer) UniqueID() []byte

UniqueID returns a unique ID for this element. Constant in this case (zeros)

func (BlindingParamServer) Unmarshal

func (blindingParamServer BlindingParamServer) Unmarshal(b []byte) (genericblinding.BlindingData, error)

Unmarshal []byte into BlindingParamServer

type BlindingParamsPrivateInt

type BlindingParamsPrivateInt struct {
	ScalarW, ScalarZ *big.Int // w,z random. GCD(w,z) == 1
	ScalarE, ScalarD *big.Int // e,d -> ew + dz == 1
	ScalarA, ScalarB *big.Int // random

	PointR1, PointR2     *eccutil.Point // R1=w * a * l1 x RS1, R2=w*a*l2 x RS2
	ScalarR1, ScalarR2   *big.Int       // R1.x, R2.x  mod P !=0 . Precalculated
	ScalarRs1, ScalarRs2 *big.Int       // Simplification
	IsUsed               bool
}

BlindingParamsPrivateInt holds the blinding parameters private to the requestor. To be used exactly once.

type ClearMessage

type ClearMessage struct {
	SchemeName string
	DataType   genericblinding.DataType
	Message    []byte
}

ClearMessage contains a message

func NewClearMessage

func NewClearMessage(msg []byte) ClearMessage

NewClearMessage returns a new BlindingParamClient

func (ClearMessage) Marshal

func (clearMessage ClearMessage) Marshal() ([]byte, error)

Marshal a BlindingParamClient

func (ClearMessage) SchemeData

func (clearMessage ClearMessage) SchemeData() (string, genericblinding.DataType, *eccutil.Point)

SchemeData returns general data for the scheme and BlindingData type

func (ClearMessage) UniqueID

func (clearMessage ClearMessage) UniqueID() []byte

UniqueID returns a unique ID for this element. Constant in this case (zeros)

func (ClearMessage) Unmarshal

func (clearMessage ClearMessage) Unmarshal(b []byte) (genericblinding.BlindingData, error)

Unmarshal []byte into BlindingParamClient

type ClearSignature

type ClearSignature struct {
	SchemeName string
	DataType   genericblinding.DataType
	PubKey     eccutil.Point
	PointR     eccutil.Point
	ScalarS    *big.Int
	ScalarR    *big.Int
}

ClearSignature contains the client-produced blinding factors

func NewClearSignature

func NewClearSignature(PubKey *eccutil.Point) ClearSignature

NewClearSignature returns a new BlindingParamClient

func (ClearSignature) Marshal

func (clearSignature ClearSignature) Marshal() ([]byte, error)

Marshal a BlindingParamClient

func (ClearSignature) SchemeData

func (clearSignature ClearSignature) SchemeData() (string, genericblinding.DataType, *eccutil.Point)

SchemeData returns general data for the scheme and BlindingData type

func (ClearSignature) UniqueID

func (clearSignature ClearSignature) UniqueID() []byte

UniqueID returns a unique ID for this element. Constant in this case (zeros)

func (ClearSignature) Unmarshal

func (clearSignature ClearSignature) Unmarshal(b []byte) (genericblinding.BlindingData, error)

Unmarshal []byte into BlindingParamClient

type GenericBlindingClient

type GenericBlindingClient struct {
	BlindingClient
}

GenericBlindingClient a blinding client

func NewGenericBlindingClient

func NewGenericBlindingClient(pubkey *eccutil.Point, curve *eccutil.Curve) *GenericBlindingClient

NewGenericBlindingClient returns a client for generic blinding interface

func (*GenericBlindingClient) Verify

Verify a signature

type GenericBlindingServer

type GenericBlindingServer struct {
	Signer
}

GenericBlindingServer implements JJM blinding over generic interface

func NewGenericBlindingServer

func NewGenericBlindingServer(privkey []byte, pubkey *eccutil.Point, curve *eccutil.Curve) *GenericBlindingServer

NewGenericBlindingServer returns blinding server over generic interface (GenericBlindingServer)

func (*GenericBlindingServer) GetParams

GetParams returns per-signature blinding parameters

func (*GenericBlindingServer) Sign

Sign a blind message

type SignRequestPrivateInt

type SignRequestPrivateInt struct {
	ScalarKs1, ScalarKs2 *big.Int       // k parameters. Private.  kn x curve.G == Rn
	PointRs1, PointRs2   *eccutil.Point // R points. Public data, but kept for reverence
	ScalarLs1, ScalarLs2 *big.Int       // l parameters. Public data, but kept for reverence
	ScalarRs1, ScalarRs2 *big.Int       // x coordinates of PointRs1, PointRs2. Public. Pre-calculated.
	IsUsed               bool
}

SignRequestPrivateInt are the _private_ parameters for the operation, never to be released

type SignRequestPublicInt

type SignRequestPublicInt struct {
	PointRs1, PointRs2   *eccutil.Point // R points
	ScalarLs1, ScalarLs2 *big.Int       // l parameters
}

SignRequestPublicInt are the public parameters given to a signature requestor

type SignatureInt

type SignatureInt struct {
	PointR  *eccutil.Point
	ScalarS *big.Int
	ScalarR *big.Int
}

SignatureInt is the unblinded signature

type Signer

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

Signer is a single signer

func NewSigner

func NewSigner(privkey []byte, pubkey *eccutil.Point, curve *eccutil.Curve) *Signer

NewSigner returns a new Signer instance

func (*Signer) NewSignRequest

func (signer *Signer) NewSignRequest() (Public *SignRequestPublicInt, Private *SignRequestPrivateInt, err error)

NewSignRequest creates a new signature request parameter set. Public is given to requestor, Private is kept for later signature

func (*Signer) Sign

func (signer *Signer) Sign(blindmessage *BlindMessageInt, privateParams *SignRequestPrivateInt) (signature *BlindSignatureInt, err error)

Sign signs a blinded message

Jump to

Keyboard shortcuts

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