github.com/paul-lee-attorney/fabric-ca-1.4.7-gm@v0.0.0-20201120102036-c7ad827cf9ac/lib/keyrequest.go (about) 1 // +build pkcs11 2 3 /* 4 Copyright IBM Corp. All Rights Reserved. 5 6 SPDX-License-Identifier: Apache-2.0 7 */ 8 9 package lib 10 11 import "github.com/hyperledger/fabric-ca/api" 12 13 // GetKeyRequest constructs and returns api.BasicKeyRequest object based on the bccsp 14 // configuration options 15 func GetKeyRequest(cfg *CAConfig) *api.BasicKeyRequest { 16 if cfg.CSP.SwOpts != nil { 17 // return &api.BasicKeyRequest{Algo: "ecdsa", Size: cfg.CSP.SwOpts.SecLevel} 18 return &api.BasicKeyRequest{Algo: "sm2", Size: cfg.CSP.SwOpts.SecLevel} 19 20 } else if cfg.CSP.Pkcs11Opts != nil { 21 // return &api.BasicKeyRequest{Algo: "ecdsa", Size: cfg.CSP.Pkcs11Opts.SecLevel} 22 return &api.BasicKeyRequest{Algo: "sm2", Size: cfg.CSP.Pkcs11Opts.SecLevel} 23 } else { 24 return api.NewBasicKeyRequest() 25 } 26 }