bridge

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Copyright IBM Corp. All Rights Reserved.

SPDX-License-Identifier: Apache-2.0

Copyright IBM Corp. All Rights Reserved.

SPDX-License-Identifier: Apache-2.0

Copyright IBM Corp. All Rights Reserved.

SPDX-License-Identifier: Apache-2.0

Copyright IBM Corp. All Rights Reserved.

SPDX-License-Identifier: Apache-2.0

Copyright IBM Corp. All Rights Reserved.

SPDX-License-Identifier: Apache-2.0

Copyright IBM Corp. All Rights Reserved.

SPDX-License-Identifier: Apache-2.0

Copyright IBM Corp. All Rights Reserved.

SPDX-License-Identifier: Apache-2.0

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CredRequest

type CredRequest struct {
	Translator idemix.Translator
	Idemix     *idemix.Idemix
}

CredRequest encapsulates the idemix algorithms to produce (sign) a credential request and verify it. Recall that a credential request is produced by a user, and it is verified by the issuer at credential creation time.

func (*CredRequest) Sign

func (cr *CredRequest) Sign(sk *math.Zr, ipk types.IssuerPublicKey, nonce []byte) (res []byte, err error)

Sign produces an idemix credential request. It takes in input a user secret key and an issuer public key.

func (*CredRequest) Verify

func (cr *CredRequest) Verify(credentialRequest []byte, ipk types.IssuerPublicKey, nonce []byte) (err error)

Verify checks that the passed credential request is valid with the respect to the passed issuer public key.

type Credential

type Credential struct {
	Translator idemix.Translator
	Idemix     *idemix.Idemix
}

Credential encapsulates the idemix algorithms to produce (sign) a credential and verify it. Recall that a credential is produced by the Issuer upon a credential request, and it is verified by the requester.

func (*Credential) Sign

func (c *Credential) Sign(key types.IssuerSecretKey, credentialRequest []byte, attributes []types.IdemixAttribute) (res []byte, err error)

Sign produces an idemix credential. It takes in input the issuer secret key, a serialised credential request, and a list of attribute values. Notice that attributes should not contain attributes whose type is IdemixHiddenAttribute cause the credential needs to carry all the attribute values.

func (*Credential) Verify

func (c *Credential) Verify(sk *math.Zr, ipk types.IssuerPublicKey, credential []byte, attributes []types.IdemixAttribute) (err error)

Verify checks that an idemix credential is cryptographically correct. It takes in input the user secret key (sk), the issuer public key (ipk), the serialised credential (credential), and a list of attributes. The list of attributes is optional, in case it is specified, Verify checks that the credential carries the specified attributes.

type Issuer

type Issuer struct {
	Translator idemix.Translator
	Idemix     *idemix.Idemix
}

Issuer encapsulates the idemix algorithms to generate issuer key-pairs

func (*Issuer) NewKey

func (i *Issuer) NewKey(attributeNames []string) (res types.IssuerSecretKey, err error)

NewKey generates a new issuer key-pair

func (*Issuer) NewKeyFromBytes

func (i *Issuer) NewKeyFromBytes(raw []byte, attributes []string) (res types.IssuerSecretKey, err error)

func (*Issuer) NewPublicKeyFromBytes

func (i *Issuer) NewPublicKeyFromBytes(raw []byte, attributes []string) (res types.IssuerPublicKey, err error)

type IssuerPublicKey

type IssuerPublicKey struct {
	PK *idemix.IssuerPublicKey
}

IssuerPublicKey encapsulate an idemix issuer public key.

func (*IssuerPublicKey) Bytes

func (o *IssuerPublicKey) Bytes() ([]byte, error)

func (*IssuerPublicKey) Hash

func (o *IssuerPublicKey) Hash() []byte

type IssuerSecretKey

type IssuerSecretKey struct {
	SK *idemix.IssuerKey
}

IssuerPublicKey encapsulate an idemix issuer secret key.

func (*IssuerSecretKey) Bytes

func (o *IssuerSecretKey) Bytes() ([]byte, error)

func (*IssuerSecretKey) Public

type NymSignatureScheme

type NymSignatureScheme struct {
	Translator idemix.Translator
	Idemix     *idemix.Idemix
}

NymSignatureScheme encapsulates the idemix algorithms to sign and verify using an idemix pseudonym.

func (*NymSignatureScheme) Sign

func (n *NymSignatureScheme) Sign(sk *math.Zr, Nym *math.G1, RNym *math.Zr, ipk types.IssuerPublicKey, digest []byte) (res []byte, err error)

Sign produces a signature over the passed digest. It takes in input, the user secret key (sk), the pseudonym public key (Nym) and secret key (RNym), and the issuer public key (ipk).

func (*NymSignatureScheme) Verify

func (n *NymSignatureScheme) Verify(ipk types.IssuerPublicKey, Nym *math.G1, signature, digest []byte) (err error)

Verify checks that the passed signatures is valid with the respect to the passed digest, issuer public key, and pseudonym public key.

type Revocation

type Revocation struct {
	Translator idemix.Translator
	Idemix     *idemix.Idemix
}

Revocation encapsulates the idemix algorithms for revocation

func (*Revocation) NewKey

func (r *Revocation) NewKey() (*ecdsa.PrivateKey, error)

NewKey generate a new revocation key-pair.

func (*Revocation) NewKeyFromBytes

func (r *Revocation) NewKeyFromBytes(raw []byte) (*ecdsa.PrivateKey, error)

func (*Revocation) Sign

func (r *Revocation) Sign(key *ecdsa.PrivateKey, unrevokedHandles [][]byte, epoch int, alg bccsp.RevocationAlgorithm) (res []byte, err error)

Sign generates a new CRI with the respect to the passed unrevoked handles, epoch, and revocation algorithm.

func (*Revocation) Verify

func (r *Revocation) Verify(pk *ecdsa.PublicKey, criRaw []byte, epoch int, alg bccsp.RevocationAlgorithm) (err error)

Verify checks that the passed serialised CRI (criRaw) is valid with the respect to the passed revocation public key, epoch, and revocation algorithm.

type SignatureScheme

type SignatureScheme struct {
	Translator idemix.Translator
	Idemix     *idemix.Idemix
}

SignatureScheme encapsulates the idemix algorithms to sign and verify using an idemix credential.

func (*SignatureScheme) AuditNymEid

func (s *SignatureScheme) AuditNymEid(
	ipk types.IssuerPublicKey,
	eidIndex int,
	signature []byte,
	enrollmentID string,
	RNymEid *math.Zr,
	verType bccsp.AuditVerificationType,
) (err error)

AuditNymEid Audits the pseudonymous enrollment id of a signature

func (*SignatureScheme) AuditNymRh

func (s *SignatureScheme) AuditNymRh(
	ipk types.IssuerPublicKey,
	rhIndex int,
	signature []byte,
	revocationHandle string,
	RNymRh *math.Zr,
	verType bccsp.AuditVerificationType,
) (err error)

AuditNymRh Audits the pseudonymous revocation handle of a signature

func (*SignatureScheme) Sign

func (s *SignatureScheme) Sign(cred []byte, sk *math.Zr, Nym *math.G1, RNym *math.Zr, ipk types.IssuerPublicKey, attributes []bccsp.IdemixAttribute,
	msg []byte, rhIndex, eidIndex int, criRaw []byte, sigType bccsp.SignatureType, metadata *bccsp.IdemixSignerMetadata) (res []byte, meta *bccsp.IdemixSignerMetadata, err error)

Sign produces an idemix-signature with the respect to the passed serialised credential (cred), user secret key (sk), pseudonym public key (Nym) and secret key (RNym), issuer public key (ipk), and attributes to be disclosed.

func (*SignatureScheme) Verify

func (s *SignatureScheme) Verify(
	ipk types.IssuerPublicKey,
	signature, digest []byte,
	attributes []bccsp.IdemixAttribute,
	rhIndex, eidIndex int,
	revocationPublicKey *ecdsa.PublicKey,
	epoch int,
	verType bccsp.VerificationType,
	meta *bccsp.IdemixSignerMetadata,
) (err error)

Verify checks that an idemix signature is valid with the respect to the passed issuer public key, digest, attributes, revocation index (rhIndex), revocation public key, and epoch.

type User

type User struct {
	Translator idemix.Translator
	Idemix     *idemix.Idemix
}

User encapsulates the idemix algorithms to generate user secret keys and pseudonym.

func (*User) MakeNym

func (u *User) MakeNym(sk *math.Zr, ipk types.IssuerPublicKey) (r1 *math.G1, r2 *math.Zr, err error)

MakeNym generates a new pseudonym key-pair derived from the passed user secret key (sk) and issuer public key (ipk)

func (*User) NewKey

func (u *User) NewKey() (res *math.Zr, err error)

NewKey generates an idemix user secret key

func (*User) NewKeyFromBytes

func (u *User) NewKeyFromBytes(raw []byte) (res *math.Zr, err error)

func (*User) NewNymFromBytes

func (u *User) NewNymFromBytes(raw []byte) (r1 *math.G1, r2 *math.Zr, err error)

MakeNym generates a new pseudonym key-pair derived from the passed user secret key (sk) and issuer public key (ipk)

func (*User) NewPublicNymFromBytes

func (u *User) NewPublicNymFromBytes(raw []byte) (res *math.G1, err error)

Jump to

Keyboard shortcuts

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