...

Package handlers

import "github.com/hyperledger/fabric/bccsp/idemix/handlers"
Overview
Index
Subdirectories

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

Copyright IBM Corp. All Rights Reserved.

SPDX-License-Identifier: Apache-2.0

Index ▾

func NewIssuerPublicKey(pk IssuerPublicKey) *issuerPublicKey
func NewIssuerSecretKey(sk IssuerSecretKey, exportable bool) *issuerSecretKey
func NewNymPublicKey(pk Ecp) *nymPublicKey
func NewNymSecretKey(sk Big, pk Ecp, exportable bool) (*nymSecretKey, error)
func NewRevocationPublicKey(pubKey *ecdsa.PublicKey) *revocationPublicKey
func NewRevocationSecretKey(sk *ecdsa.PrivateKey, exportable bool) *revocationSecretKey
func NewUserSecretKey(sk Big, exportable bool) *userSecretKey
type Big
type CredRequest
type Credential
type CredentialRequestSigner
    func (c *CredentialRequestSigner) Sign(k bccsp.Key, digest []byte, opts bccsp.SignerOpts) ([]byte, error)
type CredentialRequestVerifier
    func (c *CredentialRequestVerifier) Verify(k bccsp.Key, signature, digest []byte, opts bccsp.SignerOpts) (bool, error)
type CredentialSigner
    func (s *CredentialSigner) Sign(k bccsp.Key, digest []byte, opts bccsp.SignerOpts) (signature []byte, err error)
type CredentialVerifier
    func (v *CredentialVerifier) Verify(k bccsp.Key, signature, digest []byte, opts bccsp.SignerOpts) (valid bool, err error)
type CriSigner
    func (s *CriSigner) Sign(k bccsp.Key, digest []byte, opts bccsp.SignerOpts) ([]byte, error)
type CriVerifier
    func (v *CriVerifier) Verify(k bccsp.Key, signature, digest []byte, opts bccsp.SignerOpts) (bool, error)
type Ecp
type Issuer
type IssuerKeyGen
    func (g *IssuerKeyGen) KeyGen(opts bccsp.KeyGenOpts) (k bccsp.Key, err error)
type IssuerPublicKey
type IssuerPublicKeyImporter
    func (i *IssuerPublicKeyImporter) KeyImport(raw interface{}, opts bccsp.KeyImportOpts) (k bccsp.Key, err error)
type IssuerSecretKey
type NymKeyDerivation
    func (kd *NymKeyDerivation) KeyDeriv(k bccsp.Key, opts bccsp.KeyDerivOpts) (dk bccsp.Key, err error)
type NymPublicKeyImporter
    func (i *NymPublicKeyImporter) KeyImport(raw interface{}, opts bccsp.KeyImportOpts) (k bccsp.Key, err error)
type NymSignatureScheme
type NymSigner
    func (s *NymSigner) Sign(k bccsp.Key, digest []byte, opts bccsp.SignerOpts) ([]byte, error)
type NymVerifier
    func (v *NymVerifier) Verify(k bccsp.Key, signature, digest []byte, opts bccsp.SignerOpts) (bool, error)
type Revocation
type RevocationKeyGen
    func (g *RevocationKeyGen) KeyGen(opts bccsp.KeyGenOpts) (bccsp.Key, error)
type RevocationPublicKeyImporter
    func (i *RevocationPublicKeyImporter) KeyImport(raw interface{}, opts bccsp.KeyImportOpts) (k bccsp.Key, err error)
type SignatureScheme
type Signer
    func (s *Signer) Sign(k bccsp.Key, digest []byte, opts bccsp.SignerOpts) ([]byte, error)
type User
type UserKeyGen
    func (g *UserKeyGen) KeyGen(opts bccsp.KeyGenOpts) (bccsp.Key, error)
type UserKeyImporter
    func (i *UserKeyImporter) KeyImport(raw interface{}, opts bccsp.KeyImportOpts) (k bccsp.Key, err error)
type Verifier
    func (v *Verifier) Verify(k bccsp.Key, signature, digest []byte, opts bccsp.SignerOpts) (bool, error)

Package files

cred.go idemix.go issuer.go nym.go nymsigner.go revocation.go signer.go user.go

func NewIssuerPublicKey

func NewIssuerPublicKey(pk IssuerPublicKey) *issuerPublicKey

func NewIssuerSecretKey

func NewIssuerSecretKey(sk IssuerSecretKey, exportable bool) *issuerSecretKey

func NewNymPublicKey

func NewNymPublicKey(pk Ecp) *nymPublicKey

func NewNymSecretKey

func NewNymSecretKey(sk Big, pk Ecp, exportable bool) (*nymSecretKey, error)

func NewRevocationPublicKey

func NewRevocationPublicKey(pubKey *ecdsa.PublicKey) *revocationPublicKey

func NewRevocationSecretKey

func NewRevocationSecretKey(sk *ecdsa.PrivateKey, exportable bool) *revocationSecretKey

func NewUserSecretKey

func NewUserSecretKey(sk Big, exportable bool) *userSecretKey

type Big

Big represent a big integer

type Big interface {
    // Bytes returns the byte representation of this key
    Bytes() ([]byte, error)
}

type CredRequest

CredRequest is a local interface to decouple from the idemix implementation of the issuance of credential requests.

type CredRequest interface {
    // Sign creates a new Credential Request, the first message of the interactive credential issuance protocol
    // (from user to issuer)
    Sign(sk Big, ipk IssuerPublicKey, nonce []byte) ([]byte, error)

    // Verify verifies the credential request
    Verify(credRequest []byte, ipk IssuerPublicKey, nonce []byte) error
}

type Credential

CredRequest is a local interface to decouple from the idemix implementation of the issuance of credentials.

type Credential interface {

    // Sign issues a new credential, which is the last step of the interactive issuance protocol
    // All attribute values are added by the issuer at this step and then signed together with a commitment to
    // the user's secret key from a credential request
    Sign(key IssuerSecretKey, credentialRequest []byte, attributes []bccsp.IdemixAttribute) ([]byte, error)

    // Verify cryptographically verifies the credential by verifying the signature
    // on the attribute values and user's secret key
    Verify(sk Big, ipk IssuerPublicKey, credential []byte, attributes []bccsp.IdemixAttribute) error
}

type CredentialRequestSigner

CredentialRequestSigner produces credential requests

type CredentialRequestSigner struct {
    // CredRequest implements the underlying cryptographic algorithms
    CredRequest CredRequest
}

func (*CredentialRequestSigner) Sign

func (c *CredentialRequestSigner) Sign(k bccsp.Key, digest []byte, opts bccsp.SignerOpts) ([]byte, error)

type CredentialRequestVerifier

CredentialRequestVerifier verifies credential requests

type CredentialRequestVerifier struct {
    // CredRequest implements the underlying cryptographic algorithms
    CredRequest CredRequest
}

func (*CredentialRequestVerifier) Verify

func (c *CredentialRequestVerifier) Verify(k bccsp.Key, signature, digest []byte, opts bccsp.SignerOpts) (bool, error)

type CredentialSigner

type CredentialSigner struct {
    Credential Credential
}

func (*CredentialSigner) Sign

func (s *CredentialSigner) Sign(k bccsp.Key, digest []byte, opts bccsp.SignerOpts) (signature []byte, err error)

type CredentialVerifier

type CredentialVerifier struct {
    Credential Credential
}

func (*CredentialVerifier) Verify

func (v *CredentialVerifier) Verify(k bccsp.Key, signature, digest []byte, opts bccsp.SignerOpts) (valid bool, err error)

type CriSigner

type CriSigner struct {
    Revocation Revocation
}

func (*CriSigner) Sign

func (s *CriSigner) Sign(k bccsp.Key, digest []byte, opts bccsp.SignerOpts) ([]byte, error)

type CriVerifier

type CriVerifier struct {
    Revocation Revocation
}

func (*CriVerifier) Verify

func (v *CriVerifier) Verify(k bccsp.Key, signature, digest []byte, opts bccsp.SignerOpts) (bool, error)

type Ecp

Ecp represents an elliptic curve point

type Ecp interface {
    // Bytes returns the byte representation of this key
    Bytes() ([]byte, error)
}

type Issuer

Issuer is a local interface to decouple from the idemix implementation

type Issuer interface {
    // NewKey generates a new idemix issuer key w.r.t the passed attribute names.
    NewKey(AttributeNames []string) (IssuerSecretKey, error)

    // NewPublicKeyFromBytes converts the passed bytes to an Issuer public key
    // It makes sure that the so obtained public key has the passed attributes, if specified
    NewPublicKeyFromBytes(raw []byte, attributes []string) (IssuerPublicKey, error)
}

type IssuerKeyGen

IssuerKeyGen generates issuer secret keys.

type IssuerKeyGen struct {
    // exportable is a flag to allow an issuer secret key to be marked as exportable.
    // If a secret key is marked as exportable, its Bytes method will return the key's byte representation.
    Exportable bool
    // Issuer implements the underlying cryptographic algorithms
    Issuer Issuer
}

func (*IssuerKeyGen) KeyGen

func (g *IssuerKeyGen) KeyGen(opts bccsp.KeyGenOpts) (k bccsp.Key, err error)

type IssuerPublicKey

IssuerPublicKey is the issuer public key

type IssuerPublicKey interface {

    // Bytes returns the byte representation of this key
    Bytes() ([]byte, error)

    // Hash returns the hash representation of this key.
    // The output is supposed to be collision-resistant
    Hash() []byte
}

type IssuerPublicKeyImporter

IssuerPublicKeyImporter imports issuer public keys

type IssuerPublicKeyImporter struct {
    // Issuer implements the underlying cryptographic algorithms
    Issuer Issuer
}

func (*IssuerPublicKeyImporter) KeyImport

func (i *IssuerPublicKeyImporter) KeyImport(raw interface{}, opts bccsp.KeyImportOpts) (k bccsp.Key, err error)

type IssuerSecretKey

IssuerPublicKey is the issuer secret key

type IssuerSecretKey interface {

    // Bytes returns the byte representation of this key
    Bytes() ([]byte, error)

    // Public returns the corresponding public key
    Public() IssuerPublicKey
}

type NymKeyDerivation

NymKeyDerivation derives nyms

type NymKeyDerivation struct {
    // Exportable is a flag to allow an issuer secret key to be marked as Exportable.
    // If a secret key is marked as Exportable, its Bytes method will return the key's byte representation.
    Exportable bool
    // User implements the underlying cryptographic algorithms
    User User
}

func (*NymKeyDerivation) KeyDeriv

func (kd *NymKeyDerivation) KeyDeriv(k bccsp.Key, opts bccsp.KeyDerivOpts) (dk bccsp.Key, err error)

type NymPublicKeyImporter

NymPublicKeyImporter imports nym public keys

type NymPublicKeyImporter struct {
    // User implements the underlying cryptographic algorithms
    User User
}

func (*NymPublicKeyImporter) KeyImport

func (i *NymPublicKeyImporter) KeyImport(raw interface{}, opts bccsp.KeyImportOpts) (k bccsp.Key, err error)

type NymSignatureScheme

NymSignatureScheme is a local interface to decouple from the idemix implementation the nym sign-related operations

type NymSignatureScheme interface {
    // Sign creates a new idemix pseudonym signature
    Sign(sk Big, Nym Ecp, RNym Big, ipk IssuerPublicKey, digest []byte) ([]byte, error)

    // Verify verifies an idemix NymSignature
    Verify(pk IssuerPublicKey, Nym Ecp, signature, digest []byte) error
}

type NymSigner

type NymSigner struct {
    NymSignatureScheme NymSignatureScheme
}

func (*NymSigner) Sign

func (s *NymSigner) Sign(k bccsp.Key, digest []byte, opts bccsp.SignerOpts) ([]byte, error)

type NymVerifier

type NymVerifier struct {
    NymSignatureScheme NymSignatureScheme
}

func (*NymVerifier) Verify

func (v *NymVerifier) Verify(k bccsp.Key, signature, digest []byte, opts bccsp.SignerOpts) (bool, error)

type Revocation

Revocation is a local interface to decouple from the idemix implementation the revocation-related operations

type Revocation interface {

    // NewKey generates a long term signing key that will be used for revocation
    NewKey() (*ecdsa.PrivateKey, error)

    // Sign creates the Credential Revocation Information for a certain time period (epoch).
    // Users can use the CRI to prove that they are not revoked.
    // Note that when not using revocation (i.e., alg = ALG_NO_REVOCATION), the entered unrevokedHandles are not used,
    // and the resulting CRI can be used by any signer.
    Sign(key *ecdsa.PrivateKey, unrevokedHandles [][]byte, epoch int, alg bccsp.RevocationAlgorithm) ([]byte, error)

    // Verify verifies that the revocation PK for a certain epoch is valid,
    // by checking that it was signed with the long term revocation key.
    // Note that even if we use no revocation (i.e., alg = ALG_NO_REVOCATION), we need
    // to verify the signature to make sure the issuer indeed signed that no revocation
    // is used in this epoch.
    Verify(pk *ecdsa.PublicKey, cri []byte, epoch int, alg bccsp.RevocationAlgorithm) error
}

type RevocationKeyGen

RevocationKeyGen generates revocation secret keys.

type RevocationKeyGen struct {
    // exportable is a flag to allow an revocation secret key to be marked as exportable.
    // If a secret key is marked as exportable, its Bytes method will return the key's byte representation.
    Exportable bool
    // Revocation implements the underlying cryptographic algorithms
    Revocation Revocation
}

func (*RevocationKeyGen) KeyGen

func (g *RevocationKeyGen) KeyGen(opts bccsp.KeyGenOpts) (bccsp.Key, error)

type RevocationPublicKeyImporter

RevocationPublicKeyImporter imports revocation public keys

type RevocationPublicKeyImporter struct {
}

func (*RevocationPublicKeyImporter) KeyImport

func (i *RevocationPublicKeyImporter) KeyImport(raw interface{}, opts bccsp.KeyImportOpts) (k bccsp.Key, err error)

type SignatureScheme

SignatureScheme is a local interface to decouple from the idemix implementation the sign-related operations

type SignatureScheme interface {
    // Sign creates a new idemix signature (Schnorr-type signature).
    // The attributes slice steers which attributes are disclosed:
    // If attributes[i].Type == bccsp.IdemixHiddenAttribute then attribute i remains hidden and otherwise it is disclosed.
    // We require the revocation handle to remain undisclosed (i.e., attributes[rhIndex] == bccsp.IdemixHiddenAttribute).
    // Parameters are to be understood as follow:
    // cred: the serialized version of an idemix credential;
    // sk: the user secret key;
    // (Nym, RNym): Nym key-pair;
    // ipk: issuer public key;
    // attributes: as described above;
    // msg: the message to be signed;
    // rhIndex: revocation handle index relative to attributes;
    // cri: the serialized version of the Credential Revocation Information (it contains the epoch this signature
    // is created in reference to).
    Sign(cred []byte, sk Big, Nym Ecp, RNym Big, ipk IssuerPublicKey, attributes []bccsp.IdemixAttribute,
        msg []byte, rhIndex int, cri []byte) ([]byte, error)

    // Verify verifies an idemix signature.
    // The attribute slice steers which attributes it expects to be disclosed
    // If attributes[i].Type == bccsp.IdemixHiddenAttribute then attribute i remains hidden and otherwise
    // attributes[i].Value is expected to contain the disclosed attribute value.
    // In other words, this function will check that if attribute i is disclosed, the i-th attribute equals attributes[i].Value.
    // Parameters are to be understood as follow:
    // ipk: issuer public key;
    // signature: signature to verify;
    // msg: message signed;
    // attributes: as described above;
    // rhIndex: revocation handle index relative to attributes;
    // revocationPublicKey: revocation public key;
    // epoch: revocation epoch.
    Verify(ipk IssuerPublicKey, signature, msg []byte, attributes []bccsp.IdemixAttribute, rhIndex int, revocationPublicKey *ecdsa.PublicKey, epoch int) error
}

type Signer

type Signer struct {
    SignatureScheme SignatureScheme
}

func (*Signer) Sign

func (s *Signer) Sign(k bccsp.Key, digest []byte, opts bccsp.SignerOpts) ([]byte, error)

type User

User is a local interface to decouple from the idemix implementation

type User interface {
    // NewKey generates a new User secret key
    NewKey() (Big, error)

    // NewKeyFromBytes converts the passed bytes to a User secret key
    NewKeyFromBytes(raw []byte) (Big, error)

    // MakeNym creates a new unlinkable pseudonym
    MakeNym(sk Big, key IssuerPublicKey) (Ecp, Big, error)

    // NewPublicNymFromBytes converts the passed bytes to a public nym
    NewPublicNymFromBytes(raw []byte) (Ecp, error)
}

type UserKeyGen

type UserKeyGen struct {
    // Exportable is a flag to allow an issuer secret key to be marked as Exportable.
    // If a secret key is marked as Exportable, its Bytes method will return the key's byte representation.
    Exportable bool
    // User implements the underlying cryptographic algorithms
    User User
}

func (*UserKeyGen) KeyGen

func (g *UserKeyGen) KeyGen(opts bccsp.KeyGenOpts) (bccsp.Key, error)

type UserKeyImporter

UserKeyImporter import user keys

type UserKeyImporter struct {
    // Exportable is a flag to allow a secret key to be marked as Exportable.
    // If a secret key is marked as Exportable, its Bytes method will return the key's byte representation.
    Exportable bool
    // User implements the underlying cryptographic algorithms
    User User
}

func (*UserKeyImporter) KeyImport

func (i *UserKeyImporter) KeyImport(raw interface{}, opts bccsp.KeyImportOpts) (k bccsp.Key, err error)

type Verifier

type Verifier struct {
    SignatureScheme SignatureScheme
}

func (*Verifier) Verify

func (v *Verifier) Verify(k bccsp.Key, signature, digest []byte, opts bccsp.SignerOpts) (bool, error)

Subdirectories

Name Synopsis
..
mock Code generated by counterfeiter.