crypto

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExtraPathElement = "msp"

	ProtobufProtocolVersionV1 uint64 = 1
)
View Source
const (
	ConfigDirUser    = "user"
	ConfigFileSigner = "SignerConfig"
)
View Source
const (
	EIDIndex         = 2
	RHIndex          = 3
	SignerConfigFull = "SignerConfigFull"
)

Variables

This section is empty.

Functions

func GetCurveAndTranslator

func GetCurveAndTranslator(curveID math.CurveID) (*math.Curve, idemix3.Translator, bool, error)

func NewBCCSP

func NewBCCSP(keyStore bccsp.KeyStore, curveID math.CurveID) (bccsp.BCCSP, error)

NewBCCSP returns an instance of the idemix BCCSP for the given curve and kvsStore

func NewBCCSPWithDummyKeyStore

func NewBCCSPWithDummyKeyStore(curveID math.CurveID) (bccsp.BCCSP, error)

NewBCCSPWithDummyKeyStore returns an instance of the idemix BCCSP for the given curve

func NewKeyStore

func NewKeyStore(curveID math.CurveID, backend keystore.KVS) (bccsp.KeyStore, error)

func ReadFile

func ReadFile(file string) ([]byte, error)

Types

type AuditInfo

type AuditInfo struct {
	EidNymAuditData *csp.AttrNymAuditData
	RhNymAuditData  *csp.AttrNymAuditData
	Attributes      [][]byte

	Csp             csp.BCCSP     `json:"-"`
	IssuerPublicKey csp.Key       `json:"-"`
	SchemaManager   SchemaManager `json:"-"`
	Schema          string
}

func DeserializeAuditInfo

func DeserializeAuditInfo(raw []byte) (*AuditInfo, error)

func (*AuditInfo) Bytes

func (a *AuditInfo) Bytes() ([]byte, error)

func (*AuditInfo) EnrollmentID

func (a *AuditInfo) EnrollmentID() string

func (*AuditInfo) FromBytes

func (a *AuditInfo) FromBytes(raw []byte) error

func (*AuditInfo) Match

func (a *AuditInfo) Match(_ context.Context, id []byte) error

func (*AuditInfo) RevocationHandle

func (a *AuditInfo) RevocationHandle() string

type Config

type Config = config.IdemixConfig

func NewConfig

func NewConfig(dir string) (*Config, error)

func NewConfigFromRaw

func NewConfigFromRaw(issuerPublicKey []byte, configRaw []byte) (*Config, error)

func NewConfigWithIPK

func NewConfigWithIPK(issuerPublicKey []byte, dir string, ignoreVerifyOnlyWallet bool) (*Config, error)

func NewFabricCAIdemixConfig

func NewFabricCAIdemixConfig(issuerPublicKey []byte, dir string) (*Config, error)

NewFabricCAIdemixConfig returns the configuration for Idemix generated by Fabric-CA

func NewIdemixConfig

func NewIdemixConfig(issuerPublicKey []byte, dir string, ignoreVerifyOnlyWallet bool) (*Config, error)

NewIdemixConfig returns the configuration for Idemix

type DeserializedIdentity

type DeserializedIdentity struct {
	Identity     *Identity
	NymPublicKey bccsp.Key
}

type Deserializer

type Deserializer struct {
	Name            string
	Ipk             []byte
	Csp             bccsp.BCCSP
	IssuerPublicKey bccsp.Key
	RevocationPK    bccsp.Key
	Epoch           int
	VerType         bccsp.VerificationType
	NymEID          []byte
	RhNym           []byte
	SchemaManager   SchemaManager
	Schema          string
}

func (*Deserializer) Deserialize

func (d *Deserializer) Deserialize(_ context.Context, raw []byte) (*DeserializedIdentity, error)

func (*Deserializer) DeserializeAgainstNymEID

func (d *Deserializer) DeserializeAgainstNymEID(identity []byte, nymEID []byte) (*DeserializedIdentity, error)

func (*Deserializer) DeserializeAuditInfo

func (d *Deserializer) DeserializeAuditInfo(_ context.Context, raw []byte) (*AuditInfo, error)

type Identity

type Identity struct {
	NymPublicKey bccsp.Key
	Idemix       *Deserializer
	// AssociationProof contains cryptographic proof that this identity is valid.
	AssociationProof []byte
	VerificationType bccsp.VerificationType

	// Schema related fields
	SchemaManager SchemaManager
	Schema        Schema
}

func NewIdentity

func NewIdentity(idemix *Deserializer, nymPublicKey bccsp.Key, proof []byte, verificationType bccsp.VerificationType, schemaManager SchemaManager, schema Schema) (*Identity, error)

func (*Identity) Serialize

func (id *Identity) Serialize() ([]byte, error)

func (*Identity) Validate

func (id *Identity) Validate() error

func (*Identity) Verify

func (id *Identity) Verify(msg []byte, sig []byte) error

type NymSignatureVerifier

type NymSignatureVerifier struct {
	CSP           bccsp.BCCSP
	IPK           bccsp.Key
	NymPK         bccsp.Key
	SchemaManager SchemaManager
	Schema        Schema
}

func (*NymSignatureVerifier) Verify

func (v *NymSignatureVerifier) Verify(message, sigma []byte) error

type Schema added in v0.7.0

type Schema = string

type SchemaManager added in v0.7.0

type SchemaManager interface {
	// EidNymAuditOpts returns the options that `sid` must use to audit an EIDNym
	EidNymAuditOpts(schema string, attrs [][]byte) (*csp.EidNymAuditOpts, error)
	// RhNymAuditOpts returns the options that `sid` must use to audit an RhNym
	RhNymAuditOpts(schema string, attrs [][]byte) (*csp.RhNymAuditOpts, error)
}

SchemaManager handles the various credential schemas. A credential schema contains information about the number of attributes, which attributes must be disclosed when creating proofs, the format of the attributes etc.

type SerializedIdemixIdentity

type SerializedIdemixIdentity = config.SerializedIdemixIdentity

type SignerConfig

type SignerConfig struct {
	// Cred represents the serialized idemix credential of the default signer
	Cred []byte `protobuf:"bytes,1,opt,name=Cred,proto3" json:"Cred,omitempty"`
	// Sk is the secret key of the default signer, corresponding to credential Cred
	Sk []byte `protobuf:"bytes,2,opt,name=Sk,proto3" json:"Sk,omitempty"`
	// OrganizationalUnitIdentifier defines the organizational unit the default signer is in
	OrganizationalUnitIdentifier string `` /* 140-byte string literal not displayed */
	// Role defines whether the default signer is admin, member, peer, or client
	Role int `protobuf:"varint,4,opt,name=role,json=role" json:"role,omitempty"`
	// EnrollmentID contains the enrollment id of this signer
	EnrollmentID string `protobuf:"bytes,5,opt,name=enrollment_id,json=enrollmentId" json:"enrollment_id,omitempty"`
	// CRI contains a serialized CredentialRevocationInformation
	CredentialRevocationInformation []byte `` /* 156-byte string literal not displayed */
	// RevocationHandle is the handle used to single out this credential and determine its revocation status
	RevocationHandle string `protobuf:"bytes,7,opt,name=revocation_handle,json=revocationHandle,proto3" json:"revocation_handle,omitempty"`
	// CurveID specifies the name of the Idemix curve to use, defaults to 'amcl.Fp256bn'
	CurveID string `protobuf:"bytes,8,opt,name=curve_id,json=curveID" json:"curveID,omitempty"`
	// Schema contains the version of the schema used by this credential
	Schema string `protobuf:"bytes,9,opt,name=schema,json=schema" json:"schema,omitempty"`
}

SignerConfig contains the crypto material to set up an idemix signing identity

type SigningIdentity

type SigningIdentity struct {
	*Identity `json:"-"`
	CSP       bccsp.BCCSP `json:"-"`

	EnrollmentId string
	NymKeySKI    []byte
	UserKeySKI   []byte
}

func (*SigningIdentity) Sign

func (id *SigningIdentity) Sign(msg []byte) ([]byte, error)

Directories

Path Synopsis
protos-go

Jump to

Keyboard shortcuts

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