Skip to content

Commit

Permalink
Merge "[FAB-15900] Add pkcs11 section to orderer.yaml"
Browse files Browse the repository at this point in the history
  • Loading branch information
denyeart authored and Gerrit Code Review committed Nov 21, 2019
2 parents 75e51fb + ecec58b commit 07b2f14
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
17 changes: 17 additions & 0 deletions common/viperutil/config_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (

"github.com/Shopify/sarama"
version "github.com/hashicorp/go-version"
"github.com/hyperledger/fabric/bccsp/factory"
"github.com/hyperledger/fabric/common/flogging"
"github.com/mitchellh/mapstructure"
"github.com/pkg/errors"
Expand Down Expand Up @@ -305,6 +306,21 @@ func kafkaVersionDecodeHook() mapstructure.DecodeHookFunc {
}
}

func bccspHook(f reflect.Type, t reflect.Type, data interface{}) (interface{}, error) {
if t != reflect.TypeOf(&factory.FactoryOpts{}) {
return data, nil
}

config := factory.GetDefaultOpts()

err := mapstructure.Decode(data, config)
if err != nil {
return nil, errors.Wrap(err, "could not decode bcssp type")
}

return config, nil
}

// EnhancedExactUnmarshal is intended to unmarshal a config file into a structure
// producing error when extraneous variables are introduced and supporting
// the time.Duration type
Expand All @@ -330,6 +346,7 @@ func EnhancedExactUnmarshal(v *viper.Viper, output interface{}) error {
Result: output,
WeaklyTypedInput: true,
DecodeHook: mapstructure.ComposeDecodeHookFunc(
bccspHook,
customDecodeHook(),
byteSizeDecodeHook(),
stringFromFileDecodeHook(),
Expand Down
14 changes: 14 additions & 0 deletions sampleconfig/orderer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,27 @@ General:
FileKeyStore:
KeyStore:

# Settings for the PKCS#11 crypto provider (i.e. when DEFAULT: PKCS11)
PKCS11:
# Location of the PKCS11 module library
Library:
# Token Label
Label:
# User PIN
Pin:
Hash:
Security:
FileKeyStore:
KeyStore:

# Authentication contains configuration parameters related to authenticating
# client messages
Authentication:
# the acceptable difference between the current server time and the
# client's time as specified in a client request message
TimeWindow: 15m


################################################################################
#
# SECTION: File Ledger
Expand Down

0 comments on commit 07b2f14

Please sign in to comment.