...

Package bccsp

import "github.com/hyperledger/fabric/bccsp"
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. 2016 All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index ▾

Constants
type AES128KeyGenOpts
    func (opts *AES128KeyGenOpts) Algorithm() string
    func (opts *AES128KeyGenOpts) Ephemeral() bool
type AES192KeyGenOpts
    func (opts *AES192KeyGenOpts) Algorithm() string
    func (opts *AES192KeyGenOpts) Ephemeral() bool
type AES256ImportKeyOpts
    func (opts *AES256ImportKeyOpts) Algorithm() string
    func (opts *AES256ImportKeyOpts) Ephemeral() bool
type AES256KeyGenOpts
    func (opts *AES256KeyGenOpts) Algorithm() string
    func (opts *AES256KeyGenOpts) Ephemeral() bool
type AESCBCPKCS7ModeOpts
type AESKeyGenOpts
    func (opts *AESKeyGenOpts) Algorithm() string
    func (opts *AESKeyGenOpts) Ephemeral() bool
type BCCSP
type DecrypterOpts
type ECDSAGoPublicKeyImportOpts
    func (opts *ECDSAGoPublicKeyImportOpts) Algorithm() string
    func (opts *ECDSAGoPublicKeyImportOpts) Ephemeral() bool
type ECDSAKeyGenOpts
    func (opts *ECDSAKeyGenOpts) Algorithm() string
    func (opts *ECDSAKeyGenOpts) Ephemeral() bool
type ECDSAP256KeyGenOpts
    func (opts *ECDSAP256KeyGenOpts) Algorithm() string
    func (opts *ECDSAP256KeyGenOpts) Ephemeral() bool
type ECDSAP384KeyGenOpts
    func (opts *ECDSAP384KeyGenOpts) Algorithm() string
    func (opts *ECDSAP384KeyGenOpts) Ephemeral() bool
type ECDSAPKIXPublicKeyImportOpts
    func (opts *ECDSAPKIXPublicKeyImportOpts) Algorithm() string
    func (opts *ECDSAPKIXPublicKeyImportOpts) Ephemeral() bool
type ECDSAPrivateKeyImportOpts
    func (opts *ECDSAPrivateKeyImportOpts) Algorithm() string
    func (opts *ECDSAPrivateKeyImportOpts) Ephemeral() bool
type ECDSAReRandKeyOpts
    func (opts *ECDSAReRandKeyOpts) Algorithm() string
    func (opts *ECDSAReRandKeyOpts) Ephemeral() bool
    func (opts *ECDSAReRandKeyOpts) ExpansionValue() []byte
type EncrypterOpts
type HMACDeriveKeyOpts
    func (opts *HMACDeriveKeyOpts) Algorithm() string
    func (opts *HMACDeriveKeyOpts) Argument() []byte
    func (opts *HMACDeriveKeyOpts) Ephemeral() bool
type HMACImportKeyOpts
    func (opts *HMACImportKeyOpts) Algorithm() string
    func (opts *HMACImportKeyOpts) Ephemeral() bool
type HMACTruncated256AESDeriveKeyOpts
    func (opts *HMACTruncated256AESDeriveKeyOpts) Algorithm() string
    func (opts *HMACTruncated256AESDeriveKeyOpts) Argument() []byte
    func (opts *HMACTruncated256AESDeriveKeyOpts) Ephemeral() bool
type HashOpts
    func GetHashOpt(hashFunction string) (HashOpts, error)
type IdemixAttribute
type IdemixAttributeType
type IdemixCRISignerOpts
    func (o *IdemixCRISignerOpts) HashFunc() crypto.Hash
type IdemixCredentialRequestSignerOpts
    func (o *IdemixCredentialRequestSignerOpts) HashFunc() crypto.Hash
    func (o *IdemixCredentialRequestSignerOpts) IssuerPublicKey() Key
type IdemixCredentialSignerOpts
    func (o *IdemixCredentialSignerOpts) HashFunc() crypto.Hash
    func (o *IdemixCredentialSignerOpts) IssuerPublicKey() Key
type IdemixIIssuerPublicKeyImporterErrorType
type IdemixIssuerKeyGenOpts
    func (*IdemixIssuerKeyGenOpts) Algorithm() string
    func (o *IdemixIssuerKeyGenOpts) Ephemeral() bool
type IdemixIssuerPublicKeyImportOpts
    func (*IdemixIssuerPublicKeyImportOpts) Algorithm() string
    func (o *IdemixIssuerPublicKeyImportOpts) Ephemeral() bool
type IdemixIssuerPublicKeyImporterError
    func (r *IdemixIssuerPublicKeyImporterError) Error() string
type IdemixNymKeyDerivationOpts
    func (*IdemixNymKeyDerivationOpts) Algorithm() string
    func (o *IdemixNymKeyDerivationOpts) Ephemeral() bool
    func (o *IdemixNymKeyDerivationOpts) IssuerPublicKey() Key
type IdemixNymPublicKeyImportOpts
    func (*IdemixNymPublicKeyImportOpts) Algorithm() string
    func (o *IdemixNymPublicKeyImportOpts) Ephemeral() bool
type IdemixNymSignerOpts
    func (o *IdemixNymSignerOpts) HashFunc() crypto.Hash
type IdemixRevocationKeyGenOpts
    func (*IdemixRevocationKeyGenOpts) Algorithm() string
    func (o *IdemixRevocationKeyGenOpts) Ephemeral() bool
type IdemixRevocationPublicKeyImportOpts
    func (*IdemixRevocationPublicKeyImportOpts) Algorithm() string
    func (o *IdemixRevocationPublicKeyImportOpts) Ephemeral() bool
type IdemixSignerOpts
    func (o *IdemixSignerOpts) HashFunc() crypto.Hash
type IdemixUserSecretKeyGenOpts
    func (*IdemixUserSecretKeyGenOpts) Algorithm() string
    func (o *IdemixUserSecretKeyGenOpts) Ephemeral() bool
type IdemixUserSecretKeyImportOpts
    func (*IdemixUserSecretKeyImportOpts) Algorithm() string
    func (o *IdemixUserSecretKeyImportOpts) Ephemeral() bool
type Key
type KeyDerivOpts
type KeyGenOpts
type KeyImportOpts
type KeyStore
type RSA1024KeyGenOpts
    func (opts *RSA1024KeyGenOpts) Algorithm() string
    func (opts *RSA1024KeyGenOpts) Ephemeral() bool
type RSA2048KeyGenOpts
    func (opts *RSA2048KeyGenOpts) Algorithm() string
    func (opts *RSA2048KeyGenOpts) Ephemeral() bool
type RSA3072KeyGenOpts
    func (opts *RSA3072KeyGenOpts) Algorithm() string
    func (opts *RSA3072KeyGenOpts) Ephemeral() bool
type RSA4096KeyGenOpts
    func (opts *RSA4096KeyGenOpts) Algorithm() string
    func (opts *RSA4096KeyGenOpts) Ephemeral() bool
type RSAGoPublicKeyImportOpts
    func (opts *RSAGoPublicKeyImportOpts) Algorithm() string
    func (opts *RSAGoPublicKeyImportOpts) Ephemeral() bool
type RSAKeyGenOpts
    func (opts *RSAKeyGenOpts) Algorithm() string
    func (opts *RSAKeyGenOpts) Ephemeral() bool
type RevocationAlgorithm
type SHA256Opts
    func (opts *SHA256Opts) Algorithm() string
type SHA384Opts
    func (opts *SHA384Opts) Algorithm() string
type SHA3_256Opts
    func (opts *SHA3_256Opts) Algorithm() string
type SHA3_384Opts
    func (opts *SHA3_384Opts) Algorithm() string
type SHAOpts
    func (opts *SHAOpts) Algorithm() string
type SignerOpts
type X509PublicKeyImportOpts
    func (opts *X509PublicKeyImportOpts) Algorithm() string
    func (opts *X509PublicKeyImportOpts) Ephemeral() bool

Package files

aesopts.go bccsp.go ecdsaopts.go hashopts.go idemixerrs.go idemixopts.go keystore.go opts.go rsaopts.go

Constants

const (
    // ECDSA Elliptic Curve Digital Signature Algorithm (key gen, import, sign, verify),
    // at default security level.
    // Each BCCSP may or may not support default security level. If not supported than
    // an error will be returned.
    ECDSA = "ECDSA"

    // ECDSA Elliptic Curve Digital Signature Algorithm over P-256 curve
    ECDSAP256 = "ECDSAP256"

    // ECDSA Elliptic Curve Digital Signature Algorithm over P-384 curve
    ECDSAP384 = "ECDSAP384"

    // ECDSAReRand ECDSA key re-randomization
    ECDSAReRand = "ECDSA_RERAND"

    // RSA at the default security level.
    // Each BCCSP may or may not support default security level. If not supported than
    // an error will be returned.
    RSA = "RSA"
    // RSA at 1024 bit security level.
    RSA1024 = "RSA1024"
    // RSA at 2048 bit security level.
    RSA2048 = "RSA2048"
    // RSA at 3072 bit security level.
    RSA3072 = "RSA3072"
    // RSA at 4096 bit security level.
    RSA4096 = "RSA4096"

    // AES Advanced Encryption Standard at the default security level.
    // Each BCCSP may or may not support default security level. If not supported than
    // an error will be returned.
    AES = "AES"
    // AES Advanced Encryption Standard at 128 bit security level
    AES128 = "AES128"
    // AES Advanced Encryption Standard at 192 bit security level
    AES192 = "AES192"
    // AES Advanced Encryption Standard at 256 bit security level
    AES256 = "AES256"

    // HMAC keyed-hash message authentication code
    HMAC = "HMAC"
    // HMACTruncated256 HMAC truncated at 256 bits.
    HMACTruncated256 = "HMAC_TRUNCATED_256"

    // SHA Secure Hash Algorithm using default family.
    // Each BCCSP may or may not support default security level. If not supported than
    // an error will be returned.
    SHA = "SHA"

    // SHA2 is an identifier for SHA2 hash family
    SHA2 = "SHA2"
    // SHA3 is an identifier for SHA3 hash family
    SHA3 = "SHA3"

    // SHA256
    SHA256 = "SHA256"
    // SHA384
    SHA384 = "SHA384"
    // SHA3_256
    SHA3_256 = "SHA3_256"
    // SHA3_384
    SHA3_384 = "SHA3_384"

    // X509Certificate Label for X509 certificate related operation
    X509Certificate = "X509Certificate"
)
const (
    // IDEMIX constant to identify Idemix related algorithms
    IDEMIX = "IDEMIX"
)

type AES128KeyGenOpts

AES128KeyGenOpts contains options for AES key generation at 128 security level

type AES128KeyGenOpts struct {
    Temporary bool
}

func (*AES128KeyGenOpts) Algorithm

func (opts *AES128KeyGenOpts) Algorithm() string

Algorithm returns the key generation algorithm identifier (to be used).

func (*AES128KeyGenOpts) Ephemeral

func (opts *AES128KeyGenOpts) Ephemeral() bool

Ephemeral returns true if the key to generate has to be ephemeral, false otherwise.

type AES192KeyGenOpts

AES192KeyGenOpts contains options for AES key generation at 192 security level

type AES192KeyGenOpts struct {
    Temporary bool
}

func (*AES192KeyGenOpts) Algorithm

func (opts *AES192KeyGenOpts) Algorithm() string

Algorithm returns the key generation algorithm identifier (to be used).

func (*AES192KeyGenOpts) Ephemeral

func (opts *AES192KeyGenOpts) Ephemeral() bool

Ephemeral returns true if the key to generate has to be ephemeral, false otherwise.

type AES256ImportKeyOpts

AES256ImportKeyOpts contains options for importing AES 256 keys.

type AES256ImportKeyOpts struct {
    Temporary bool
}

func (*AES256ImportKeyOpts) Algorithm

func (opts *AES256ImportKeyOpts) Algorithm() string

Algorithm returns the key importation algorithm identifier (to be used).

func (*AES256ImportKeyOpts) Ephemeral

func (opts *AES256ImportKeyOpts) Ephemeral() bool

Ephemeral returns true if the key generated has to be ephemeral, false otherwise.

type AES256KeyGenOpts

AES256KeyGenOpts contains options for AES key generation at 256 security level

type AES256KeyGenOpts struct {
    Temporary bool
}

func (*AES256KeyGenOpts) Algorithm

func (opts *AES256KeyGenOpts) Algorithm() string

Algorithm returns the key generation algorithm identifier (to be used).

func (*AES256KeyGenOpts) Ephemeral

func (opts *AES256KeyGenOpts) Ephemeral() bool

Ephemeral returns true if the key to generate has to be ephemeral, false otherwise.

type AESCBCPKCS7ModeOpts

AESCBCPKCS7ModeOpts contains options for AES encryption in CBC mode with PKCS7 padding. Notice that both IV and PRNG can be nil. In that case, the BCCSP implementation is supposed to sample the IV using a cryptographic secure PRNG. Notice also that either IV or PRNG can be different from nil.

type AESCBCPKCS7ModeOpts struct {
    // IV is the initialization vector to be used by the underlying cipher.
    // The length of IV must be the same as the Block's block size.
    // It is used only if different from nil.
    IV []byte
    // PRNG is an instance of a PRNG to be used by the underlying cipher.
    // It is used only if different from nil.
    PRNG io.Reader
}

type AESKeyGenOpts

AESKeyGenOpts contains options for AES key generation at default security level

type AESKeyGenOpts struct {
    Temporary bool
}

func (*AESKeyGenOpts) Algorithm

func (opts *AESKeyGenOpts) Algorithm() string

Algorithm returns the key generation algorithm identifier (to be used).

func (*AESKeyGenOpts) Ephemeral

func (opts *AESKeyGenOpts) Ephemeral() bool

Ephemeral returns true if the key to generate has to be ephemeral, false otherwise.

type BCCSP

BCCSP is the blockchain cryptographic service provider that offers the implementation of cryptographic standards and algorithms.

type BCCSP interface {

    // KeyGen generates a key using opts.
    KeyGen(opts KeyGenOpts) (k Key, err error)

    // KeyDeriv derives a key from k using opts.
    // The opts argument should be appropriate for the primitive used.
    KeyDeriv(k Key, opts KeyDerivOpts) (dk Key, err error)

    // KeyImport imports a key from its raw representation using opts.
    // The opts argument should be appropriate for the primitive used.
    KeyImport(raw interface{}, opts KeyImportOpts) (k Key, err error)

    // GetKey returns the key this CSP associates to
    // the Subject Key Identifier ski.
    GetKey(ski []byte) (k Key, err error)

    // Hash hashes messages msg using options opts.
    // If opts is nil, the default hash function will be used.
    Hash(msg []byte, opts HashOpts) (hash []byte, err error)

    // GetHash returns and instance of hash.Hash using options opts.
    // If opts is nil, the default hash function will be returned.
    GetHash(opts HashOpts) (h hash.Hash, err error)

    // Sign signs digest using key k.
    // The opts argument should be appropriate for the algorithm used.
    //
    // Note that when a signature of a hash of a larger message is needed,
    // the caller is responsible for hashing the larger message and passing
    // the hash (as digest).
    Sign(k Key, digest []byte, opts SignerOpts) (signature []byte, err error)

    // Verify verifies signature against key k and digest
    // The opts argument should be appropriate for the algorithm used.
    Verify(k Key, signature, digest []byte, opts SignerOpts) (valid bool, err error)

    // Encrypt encrypts plaintext using key k.
    // The opts argument should be appropriate for the algorithm used.
    Encrypt(k Key, plaintext []byte, opts EncrypterOpts) (ciphertext []byte, err error)

    // Decrypt decrypts ciphertext using key k.
    // The opts argument should be appropriate for the algorithm used.
    Decrypt(k Key, ciphertext []byte, opts DecrypterOpts) (plaintext []byte, err error)
}

type DecrypterOpts

DecrypterOpts contains options for decrypting with a CSP.

type DecrypterOpts interface{}

type ECDSAGoPublicKeyImportOpts

ECDSAGoPublicKeyImportOpts contains options for ECDSA key importation from ecdsa.PublicKey

type ECDSAGoPublicKeyImportOpts struct {
    Temporary bool
}

func (*ECDSAGoPublicKeyImportOpts) Algorithm

func (opts *ECDSAGoPublicKeyImportOpts) Algorithm() string

Algorithm returns the key importation algorithm identifier (to be used).

func (*ECDSAGoPublicKeyImportOpts) Ephemeral

func (opts *ECDSAGoPublicKeyImportOpts) Ephemeral() bool

Ephemeral returns true if the key to generate has to be ephemeral, false otherwise.

type ECDSAKeyGenOpts

ECDSAKeyGenOpts contains options for ECDSA key generation.

type ECDSAKeyGenOpts struct {
    Temporary bool
}

func (*ECDSAKeyGenOpts) Algorithm

func (opts *ECDSAKeyGenOpts) Algorithm() string

Algorithm returns the key generation algorithm identifier (to be used).

func (*ECDSAKeyGenOpts) Ephemeral

func (opts *ECDSAKeyGenOpts) Ephemeral() bool

Ephemeral returns true if the key to generate has to be ephemeral, false otherwise.

type ECDSAP256KeyGenOpts

ECDSAP256KeyGenOpts contains options for ECDSA key generation with curve P-256.

type ECDSAP256KeyGenOpts struct {
    Temporary bool
}

func (*ECDSAP256KeyGenOpts) Algorithm

func (opts *ECDSAP256KeyGenOpts) Algorithm() string

Algorithm returns the key generation algorithm identifier (to be used).

func (*ECDSAP256KeyGenOpts) Ephemeral

func (opts *ECDSAP256KeyGenOpts) Ephemeral() bool

Ephemeral returns true if the key to generate has to be ephemeral, false otherwise.

type ECDSAP384KeyGenOpts

ECDSAP384KeyGenOpts contains options for ECDSA key generation with curve P-384.

type ECDSAP384KeyGenOpts struct {
    Temporary bool
}

func (*ECDSAP384KeyGenOpts) Algorithm

func (opts *ECDSAP384KeyGenOpts) Algorithm() string

Algorithm returns the key generation algorithm identifier (to be used).

func (*ECDSAP384KeyGenOpts) Ephemeral

func (opts *ECDSAP384KeyGenOpts) Ephemeral() bool

Ephemeral returns true if the key to generate has to be ephemeral, false otherwise.

type ECDSAPKIXPublicKeyImportOpts

ECDSAPKIXPublicKeyImportOpts contains options for ECDSA public key importation in PKIX format

type ECDSAPKIXPublicKeyImportOpts struct {
    Temporary bool
}

func (*ECDSAPKIXPublicKeyImportOpts) Algorithm

func (opts *ECDSAPKIXPublicKeyImportOpts) Algorithm() string

Algorithm returns the key importation algorithm identifier (to be used).

func (*ECDSAPKIXPublicKeyImportOpts) Ephemeral

func (opts *ECDSAPKIXPublicKeyImportOpts) Ephemeral() bool

Ephemeral returns true if the key to generate has to be ephemeral, false otherwise.

type ECDSAPrivateKeyImportOpts

ECDSAPrivateKeyImportOpts contains options for ECDSA secret key importation in DER format or PKCS#8 format.

type ECDSAPrivateKeyImportOpts struct {
    Temporary bool
}

func (*ECDSAPrivateKeyImportOpts) Algorithm

func (opts *ECDSAPrivateKeyImportOpts) Algorithm() string

Algorithm returns the key importation algorithm identifier (to be used).

func (*ECDSAPrivateKeyImportOpts) Ephemeral

func (opts *ECDSAPrivateKeyImportOpts) Ephemeral() bool

Ephemeral returns true if the key to generate has to be ephemeral, false otherwise.

type ECDSAReRandKeyOpts

ECDSAReRandKeyOpts contains options for ECDSA key re-randomization.

type ECDSAReRandKeyOpts struct {
    Temporary bool
    Expansion []byte
}

func (*ECDSAReRandKeyOpts) Algorithm

func (opts *ECDSAReRandKeyOpts) Algorithm() string

Algorithm returns the key derivation algorithm identifier (to be used).

func (*ECDSAReRandKeyOpts) Ephemeral

func (opts *ECDSAReRandKeyOpts) Ephemeral() bool

Ephemeral returns true if the key to generate has to be ephemeral, false otherwise.

func (*ECDSAReRandKeyOpts) ExpansionValue

func (opts *ECDSAReRandKeyOpts) ExpansionValue() []byte

ExpansionValue returns the re-randomization factor

type EncrypterOpts

EncrypterOpts contains options for encrypting with a CSP.

type EncrypterOpts interface{}

type HMACDeriveKeyOpts

HMACDeriveKeyOpts contains options for HMAC key derivation.

type HMACDeriveKeyOpts struct {
    Temporary bool
    Arg       []byte
}

func (*HMACDeriveKeyOpts) Algorithm

func (opts *HMACDeriveKeyOpts) Algorithm() string

Algorithm returns the key derivation algorithm identifier (to be used).

func (*HMACDeriveKeyOpts) Argument

func (opts *HMACDeriveKeyOpts) Argument() []byte

Argument returns the argument to be passed to the HMAC

func (*HMACDeriveKeyOpts) Ephemeral

func (opts *HMACDeriveKeyOpts) Ephemeral() bool

Ephemeral returns true if the key to generate has to be ephemeral, false otherwise.

type HMACImportKeyOpts

HMACImportKeyOpts contains options for importing HMAC keys.

type HMACImportKeyOpts struct {
    Temporary bool
}

func (*HMACImportKeyOpts) Algorithm

func (opts *HMACImportKeyOpts) Algorithm() string

Algorithm returns the key importation algorithm identifier (to be used).

func (*HMACImportKeyOpts) Ephemeral

func (opts *HMACImportKeyOpts) Ephemeral() bool

Ephemeral returns true if the key generated has to be ephemeral, false otherwise.

type HMACTruncated256AESDeriveKeyOpts

HMACTruncated256AESDeriveKeyOpts contains options for HMAC truncated at 256 bits key derivation.

type HMACTruncated256AESDeriveKeyOpts struct {
    Temporary bool
    Arg       []byte
}

func (*HMACTruncated256AESDeriveKeyOpts) Algorithm

func (opts *HMACTruncated256AESDeriveKeyOpts) Algorithm() string

Algorithm returns the key derivation algorithm identifier (to be used).

func (*HMACTruncated256AESDeriveKeyOpts) Argument

func (opts *HMACTruncated256AESDeriveKeyOpts) Argument() []byte

Argument returns the argument to be passed to the HMAC

func (*HMACTruncated256AESDeriveKeyOpts) Ephemeral

func (opts *HMACTruncated256AESDeriveKeyOpts) Ephemeral() bool

Ephemeral returns true if the key to generate has to be ephemeral, false otherwise.

type HashOpts

HashOpts contains options for hashing with a CSP.

type HashOpts interface {

    // Algorithm returns the hash algorithm identifier (to be used).
    Algorithm() string
}

func GetHashOpt

func GetHashOpt(hashFunction string) (HashOpts, error)

GetHashOpt returns the HashOpts corresponding to the passed hash function

type IdemixAttribute

type IdemixAttribute struct {
    // Type is the attribute's type
    Type IdemixAttributeType
    // Value is the attribute's value
    Value interface{}
}

type IdemixAttributeType

IdemixAttributeType represents the type of an idemix attribute

type IdemixAttributeType int
const (
    // IdemixHiddenAttribute represents an hidden attribute
    IdemixHiddenAttribute IdemixAttributeType = iota
    // IdemixStringAttribute represents a sequence of bytes
    IdemixBytesAttribute
    // IdemixIntAttribute represents an int
    IdemixIntAttribute
)

type IdemixCRISignerOpts

IdemixCRISignerOpts contains the options to generate an Idemix CRI. The CRI is supposed to be generated by the Issuing authority and can be verified publicly by using the revocation public key.

type IdemixCRISignerOpts struct {
    Epoch               int
    RevocationAlgorithm RevocationAlgorithm
    UnrevokedHandles    [][]byte
    // H is the hash function to be used
    H crypto.Hash
}

func (*IdemixCRISignerOpts) HashFunc

func (o *IdemixCRISignerOpts) HashFunc() crypto.Hash

type IdemixCredentialRequestSignerOpts

IdemixCredentialRequestSignerOpts contains the option to create a Idemix credential request.

type IdemixCredentialRequestSignerOpts struct {
    // Attributes contains a list of indices of the attributes to be included in the
    // credential. The indices are with the respect to IdemixIssuerKeyGenOpts#AttributeNames.
    Attributes []int
    // IssuerPK is the public-key of the issuer
    IssuerPK Key
    // IssuerNonce is generated by the issuer and used by the client to generate the credential request.
    // Once the issuer gets the credential requests, it checks that the nonce is the same.
    IssuerNonce []byte
    // HashFun is the hash function to be used
    H crypto.Hash
}

func (*IdemixCredentialRequestSignerOpts) HashFunc

func (o *IdemixCredentialRequestSignerOpts) HashFunc() crypto.Hash

func (*IdemixCredentialRequestSignerOpts) IssuerPublicKey

func (o *IdemixCredentialRequestSignerOpts) IssuerPublicKey() Key

IssuerPublicKey returns the issuer public key used to derive a new unlinkable pseudonym from a credential secret key

type IdemixCredentialSignerOpts

IdemixCredentialSignerOpts contains the options to produce a credential starting from a credential request

type IdemixCredentialSignerOpts struct {
    // Attributes to include in the credentials. IdemixHiddenAttribute is not allowed here
    Attributes []IdemixAttribute
    // IssuerPK is the public-key of the issuer
    IssuerPK Key
    // HashFun is the hash function to be used
    H crypto.Hash
}

func (*IdemixCredentialSignerOpts) HashFunc

func (o *IdemixCredentialSignerOpts) HashFunc() crypto.Hash

HashFunc returns an identifier for the hash function used to produce the message passed to Signer.Sign, or else zero to indicate that no hashing was done.

func (*IdemixCredentialSignerOpts) IssuerPublicKey

func (o *IdemixCredentialSignerOpts) IssuerPublicKey() Key

type IdemixIIssuerPublicKeyImporterErrorType

type IdemixIIssuerPublicKeyImporterErrorType int
const (
    IdemixIssuerPublicKeyImporterUnmarshallingError IdemixIIssuerPublicKeyImporterErrorType = iota
    IdemixIssuerPublicKeyImporterHashError
    IdemixIssuerPublicKeyImporterValidationError
    IdemixIssuerPublicKeyImporterNumAttributesError
    IdemixIssuerPublicKeyImporterAttributeNameError
)

type IdemixIssuerKeyGenOpts

IdemixIssuerKeyGenOpts contains the options for the Idemix Issuer key-generation. A list of attribytes may be optionally passed

type IdemixIssuerKeyGenOpts struct {
    // Temporary tells if the key is ephemeral
    Temporary bool
    // AttributeNames is a list of attributes
    AttributeNames []string
}

func (*IdemixIssuerKeyGenOpts) Algorithm

func (*IdemixIssuerKeyGenOpts) Algorithm() string

Algorithm returns the key generation algorithm identifier (to be used).

func (*IdemixIssuerKeyGenOpts) Ephemeral

func (o *IdemixIssuerKeyGenOpts) Ephemeral() bool

Ephemeral returns true if the key to generate has to be ephemeral, false otherwise.

type IdemixIssuerPublicKeyImportOpts

IdemixIssuerPublicKeyImportOpts contains the options for importing of an Idemix issuer public key.

type IdemixIssuerPublicKeyImportOpts struct {
    Temporary bool
    // AttributeNames is a list of attributes to ensure the import public key has
    AttributeNames []string
}

func (*IdemixIssuerPublicKeyImportOpts) Algorithm

func (*IdemixIssuerPublicKeyImportOpts) Algorithm() string

Algorithm returns the key generation algorithm identifier (to be used).

func (*IdemixIssuerPublicKeyImportOpts) Ephemeral

func (o *IdemixIssuerPublicKeyImportOpts) Ephemeral() bool

Ephemeral returns true if the key to generate has to be ephemeral, false otherwise.

type IdemixIssuerPublicKeyImporterError

type IdemixIssuerPublicKeyImporterError struct {
    Type     IdemixIIssuerPublicKeyImporterErrorType
    ErrorMsg string
    Cause    error
}

func (*IdemixIssuerPublicKeyImporterError) Error

func (r *IdemixIssuerPublicKeyImporterError) Error() string

type IdemixNymKeyDerivationOpts

IdemixNymKeyDerivationOpts contains the options to create a new unlinkable pseudonym from a credential secret key with the respect to the specified issuer public key

type IdemixNymKeyDerivationOpts struct {
    // Temporary tells if the key is ephemeral
    Temporary bool
    // IssuerPK is the public-key of the issuer
    IssuerPK Key
}

func (*IdemixNymKeyDerivationOpts) Algorithm

func (*IdemixNymKeyDerivationOpts) Algorithm() string

Algorithm returns the key derivation algorithm identifier (to be used).

func (*IdemixNymKeyDerivationOpts) Ephemeral

func (o *IdemixNymKeyDerivationOpts) Ephemeral() bool

Ephemeral returns true if the key to derive has to be ephemeral, false otherwise.

func (*IdemixNymKeyDerivationOpts) IssuerPublicKey

func (o *IdemixNymKeyDerivationOpts) IssuerPublicKey() Key

IssuerPublicKey returns the issuer public key used to derive a new unlinkable pseudonym from a credential secret key

type IdemixNymPublicKeyImportOpts

IdemixNymPublicKeyImportOpts contains the options to import the public part of a pseudonym

type IdemixNymPublicKeyImportOpts struct {
    // Temporary tells if the key is ephemeral
    Temporary bool
}

func (*IdemixNymPublicKeyImportOpts) Algorithm

func (*IdemixNymPublicKeyImportOpts) Algorithm() string

Algorithm returns the key derivation algorithm identifier (to be used).

func (*IdemixNymPublicKeyImportOpts) Ephemeral

func (o *IdemixNymPublicKeyImportOpts) Ephemeral() bool

Ephemeral returns true if the key to derive has to be ephemeral, false otherwise.

type IdemixNymSignerOpts

IdemixNymSignerOpts contains the options to generate an idemix pseudonym signature.

type IdemixNymSignerOpts struct {
    // Nym is the pseudonym to be used
    Nym Key
    // IssuerPK is the public-key of the issuer
    IssuerPK Key
    // H is the hash function to be used
    H crypto.Hash
}

func (*IdemixNymSignerOpts) HashFunc

func (o *IdemixNymSignerOpts) HashFunc() crypto.Hash

HashFunc returns an identifier for the hash function used to produce the message passed to Signer.Sign, or else zero to indicate that no hashing was done.

type IdemixRevocationKeyGenOpts

IdemixRevocationKeyGenOpts contains the options for the Idemix revocation key-generation.

type IdemixRevocationKeyGenOpts struct {
    // Temporary tells if the key is ephemeral
    Temporary bool
}

func (*IdemixRevocationKeyGenOpts) Algorithm

func (*IdemixRevocationKeyGenOpts) Algorithm() string

Algorithm returns the key generation algorithm identifier (to be used).

func (*IdemixRevocationKeyGenOpts) Ephemeral

func (o *IdemixRevocationKeyGenOpts) Ephemeral() bool

Ephemeral returns true if the key to generate has to be ephemeral, false otherwise.

type IdemixRevocationPublicKeyImportOpts

IdemixRevocationPublicKeyImportOpts contains the options for importing of an Idemix revocation public key.

type IdemixRevocationPublicKeyImportOpts struct {
    Temporary bool
}

func (*IdemixRevocationPublicKeyImportOpts) Algorithm

func (*IdemixRevocationPublicKeyImportOpts) Algorithm() string

Algorithm returns the key generation algorithm identifier (to be used).

func (*IdemixRevocationPublicKeyImportOpts) Ephemeral

func (o *IdemixRevocationPublicKeyImportOpts) Ephemeral() bool

Ephemeral returns true if the key to generate has to be ephemeral, false otherwise.

type IdemixSignerOpts

IdemixSignerOpts contains the options to generate an Idemix signature

type IdemixSignerOpts struct {
    // Nym is the pseudonym to be used
    Nym Key
    // IssuerPK is the public-key of the issuer
    IssuerPK Key
    // Credential is the byte representation of the credential signed by the issuer
    Credential []byte
    // Attributes specifies which attribute should be disclosed and which not.
    // If Attributes[i].Type = IdemixHiddenAttribute
    // then the i-th credential attribute should not be disclosed, otherwise the i-th
    // credential attribute will be disclosed.
    // At verification time, if the i-th attribute is disclosed (Attributes[i].Type != IdemixHiddenAttribute),
    // then Attributes[i].Value must be set accordingly.
    Attributes []IdemixAttribute
    // RhIndex is the index of attribute containing the revocation handler.
    // Notice that this attributed cannot be discloused
    RhIndex int
    // CRI contains the credential revocation information
    CRI []byte
    // Epoch is the revocation epoch the signature should be produced against
    Epoch int
    // RevocationPublicKey is the revocation public key
    RevocationPublicKey Key
    // H is the hash function to be used
    H crypto.Hash
}

func (*IdemixSignerOpts) HashFunc

func (o *IdemixSignerOpts) HashFunc() crypto.Hash

type IdemixUserSecretKeyGenOpts

IdemixUserSecretKeyGenOpts contains the options for the generation of an Idemix credential secret key.

type IdemixUserSecretKeyGenOpts struct {
    Temporary bool
}

func (*IdemixUserSecretKeyGenOpts) Algorithm

func (*IdemixUserSecretKeyGenOpts) Algorithm() string

Algorithm returns the key generation algorithm identifier (to be used).

func (*IdemixUserSecretKeyGenOpts) Ephemeral

func (o *IdemixUserSecretKeyGenOpts) Ephemeral() bool

Ephemeral returns true if the key to generate has to be ephemeral, false otherwise.

type IdemixUserSecretKeyImportOpts

IdemixUserSecretKeyImportOpts contains the options for importing of an Idemix credential secret key.

type IdemixUserSecretKeyImportOpts struct {
    Temporary bool
}

func (*IdemixUserSecretKeyImportOpts) Algorithm

func (*IdemixUserSecretKeyImportOpts) Algorithm() string

Algorithm returns the key generation algorithm identifier (to be used).

func (*IdemixUserSecretKeyImportOpts) Ephemeral

func (o *IdemixUserSecretKeyImportOpts) Ephemeral() bool

Ephemeral returns true if the key to generate has to be ephemeral, false otherwise.

type Key

Key represents a cryptographic key

type Key interface {

    // Bytes converts this key to its byte representation,
    // if this operation is allowed.
    Bytes() ([]byte, error)

    // SKI returns the subject key identifier of this key.
    SKI() []byte

    // Symmetric returns true if this key is a symmetric key,
    // false is this key is asymmetric
    Symmetric() bool

    // Private returns true if this key is a private key,
    // false otherwise.
    Private() bool

    // PublicKey returns the corresponding public key part of an asymmetric public/private key pair.
    // This method returns an error in symmetric key schemes.
    PublicKey() (Key, error)
}

type KeyDerivOpts

KeyDerivOpts contains options for key-derivation with a CSP.

type KeyDerivOpts interface {

    // Algorithm returns the key derivation algorithm identifier (to be used).
    Algorithm() string

    // Ephemeral returns true if the key to derived has to be ephemeral,
    // false otherwise.
    Ephemeral() bool
}

type KeyGenOpts

KeyGenOpts contains options for key-generation with a CSP.

type KeyGenOpts interface {

    // Algorithm returns the key generation algorithm identifier (to be used).
    Algorithm() string

    // Ephemeral returns true if the key to generate has to be ephemeral,
    // false otherwise.
    Ephemeral() bool
}

type KeyImportOpts

KeyImportOpts contains options for importing the raw material of a key with a CSP.

type KeyImportOpts interface {

    // Algorithm returns the key importation algorithm identifier (to be used).
    Algorithm() string

    // Ephemeral returns true if the key generated has to be ephemeral,
    // false otherwise.
    Ephemeral() bool
}

type KeyStore

KeyStore represents a storage system for cryptographic keys. It allows to store and retrieve bccsp.Key objects. The KeyStore can be read only, in that case StoreKey will return an error.

type KeyStore interface {

    // ReadOnly returns true if this KeyStore is read only, false otherwise.
    // If ReadOnly is true then StoreKey will fail.
    ReadOnly() bool

    // GetKey returns a key object whose SKI is the one passed.
    GetKey(ski []byte) (k Key, err error)

    // StoreKey stores the key k in this KeyStore.
    // If this KeyStore is read only then the method will fail.
    StoreKey(k Key) (err error)
}

type RSA1024KeyGenOpts

RSA1024KeyGenOpts contains options for RSA key generation at 1024 security.

type RSA1024KeyGenOpts struct {
    Temporary bool
}

func (*RSA1024KeyGenOpts) Algorithm

func (opts *RSA1024KeyGenOpts) Algorithm() string

Algorithm returns the key generation algorithm identifier (to be used).

func (*RSA1024KeyGenOpts) Ephemeral

func (opts *RSA1024KeyGenOpts) Ephemeral() bool

Ephemeral returns true if the key to generate has to be ephemeral, false otherwise.

type RSA2048KeyGenOpts

RSA2048KeyGenOpts contains options for RSA key generation at 2048 security.

type RSA2048KeyGenOpts struct {
    Temporary bool
}

func (*RSA2048KeyGenOpts) Algorithm

func (opts *RSA2048KeyGenOpts) Algorithm() string

Algorithm returns the key generation algorithm identifier (to be used).

func (*RSA2048KeyGenOpts) Ephemeral

func (opts *RSA2048KeyGenOpts) Ephemeral() bool

Ephemeral returns true if the key to generate has to be ephemeral, false otherwise.

type RSA3072KeyGenOpts

RSA3072KeyGenOpts contains options for RSA key generation at 3072 security.

type RSA3072KeyGenOpts struct {
    Temporary bool
}

func (*RSA3072KeyGenOpts) Algorithm

func (opts *RSA3072KeyGenOpts) Algorithm() string

Algorithm returns the key generation algorithm identifier (to be used).

func (*RSA3072KeyGenOpts) Ephemeral

func (opts *RSA3072KeyGenOpts) Ephemeral() bool

Ephemeral returns true if the key to generate has to be ephemeral, false otherwise.

type RSA4096KeyGenOpts

RSA4096KeyGenOpts contains options for RSA key generation at 4096 security.

type RSA4096KeyGenOpts struct {
    Temporary bool
}

func (*RSA4096KeyGenOpts) Algorithm

func (opts *RSA4096KeyGenOpts) Algorithm() string

Algorithm returns the key generation algorithm identifier (to be used).

func (*RSA4096KeyGenOpts) Ephemeral

func (opts *RSA4096KeyGenOpts) Ephemeral() bool

Ephemeral returns true if the key to generate has to be ephemeral, false otherwise.

type RSAGoPublicKeyImportOpts

ECDSAGoPublicKeyImportOpts contains options for RSA key importation from rsa.PublicKey

type RSAGoPublicKeyImportOpts struct {
    Temporary bool
}

func (*RSAGoPublicKeyImportOpts) Algorithm

func (opts *RSAGoPublicKeyImportOpts) Algorithm() string

Algorithm returns the key importation algorithm identifier (to be used).

func (*RSAGoPublicKeyImportOpts) Ephemeral

func (opts *RSAGoPublicKeyImportOpts) Ephemeral() bool

Ephemeral returns true if the key to generate has to be ephemeral, false otherwise.

type RSAKeyGenOpts

RSAKeyGenOpts contains options for RSA key generation.

type RSAKeyGenOpts struct {
    Temporary bool
}

func (*RSAKeyGenOpts) Algorithm

func (opts *RSAKeyGenOpts) Algorithm() string

Algorithm returns the key generation algorithm identifier (to be used).

func (*RSAKeyGenOpts) Ephemeral

func (opts *RSAKeyGenOpts) Ephemeral() bool

Ephemeral returns true if the key to generate has to be ephemeral, false otherwise.

type RevocationAlgorithm

RevocationAlgorithm identifies the revocation algorithm

type RevocationAlgorithm int32
const (
    // AlgNoRevocation means no revocation support
    AlgNoRevocation RevocationAlgorithm = iota
)

type SHA256Opts

SHA256Opts contains options relating to SHA-256.

type SHA256Opts struct {
}

func (*SHA256Opts) Algorithm

func (opts *SHA256Opts) Algorithm() string

Algorithm returns the hash algorithm identifier (to be used).

type SHA384Opts

SHA384Opts contains options relating to SHA-384.

type SHA384Opts struct {
}

func (*SHA384Opts) Algorithm

func (opts *SHA384Opts) Algorithm() string

Algorithm returns the hash algorithm identifier (to be used).

type SHA3_256Opts

SHA3_256Opts contains options relating to SHA3-256.

type SHA3_256Opts struct {
}

func (*SHA3_256Opts) Algorithm

func (opts *SHA3_256Opts) Algorithm() string

Algorithm returns the hash algorithm identifier (to be used).

type SHA3_384Opts

SHA3_384Opts contains options relating to SHA3-384.

type SHA3_384Opts struct {
}

func (*SHA3_384Opts) Algorithm

func (opts *SHA3_384Opts) Algorithm() string

Algorithm returns the hash algorithm identifier (to be used).

type SHAOpts

SHAOpts contains options for computing SHA.

type SHAOpts struct {
}

func (*SHAOpts) Algorithm

func (opts *SHAOpts) Algorithm() string

Algorithm returns the hash algorithm identifier (to be used).

type SignerOpts

SignerOpts contains options for signing with a CSP.

type SignerOpts interface {
    crypto.SignerOpts
}

type X509PublicKeyImportOpts

X509PublicKeyImportOpts contains options for importing public keys from an x509 certificate

type X509PublicKeyImportOpts struct {
    Temporary bool
}

func (*X509PublicKeyImportOpts) Algorithm

func (opts *X509PublicKeyImportOpts) Algorithm() string

Algorithm returns the key importation algorithm identifier (to be used).

func (*X509PublicKeyImportOpts) Ephemeral

func (opts *X509PublicKeyImportOpts) Ephemeral() bool

Ephemeral returns true if the key to generate has to be ephemeral, false otherwise.

Subdirectories

Name Synopsis
..
factory
idemix
bridge
handlers
mock Code generated by counterfeiter.
mocks
pkcs11
signer
sw
mocks
utils