peer node start throwing Could not find default pkcs11 BCCSP error












1














I am trying to run Hyperledger fabric peer with SoftHSM enabled. Fabric-ca-server is already running with SoftHSM enabled and all the certificates are generated with HSM enabled.



Initially, when I was trying to run fabric-ca-server it was throwing the same error Could not find defaultPKCS11BCCSP.



Then I found some people suggesting to make build from source code and it fixed that error.



Now I am facing the same error when I run peer node start command to bootstrap peer.



The BCCSP content on core.yaml is below:



# BCCSP (Blockchain crypto provider): Select which crypto implementation or
# library to use
BCCSP:
Default: PKCS11
# Settings for the SW crypto provider (i.e. when DEFAULT: SW)
SW:
# TODO: The default Hash and Security level needs refactoring to be
# fully configurable. Changing these defaults requires coordination
# SHA2 is hardcoded in several places, not only BCCSP
Hash: SHA2
Security: 256
# Location of Key Store
FileKeyStore:
# If "", defaults to 'mspConfigPath'/keystore
KeyStore:
# Settings for the PKCS#11 crypto provider (i.e. when DEFAULT: PKCS11)
PKCS11:
# Location of the PKCS11 module library
Library: /usr/local/lib/softhsm/libsofthsm2.so
# Token Label
Label: ForFabric
# User PIN
Pin: 98765432
Hash: SHA2
Security: 256
FileKeyStore:
KeyStore: /home/akshay/dev/fabric-ca/fabric-ca-client/peerOrg/msp/keystore


The error when I run peer node start:



$ peer node start
2018-12-28 14:48:50.508 IST [main] InitCmd -> ERRO 001 Cannot run peer because error when setting up MSP of type bccsp from directory /home/akshay/dev/fabric-ca/fabric-ca-client/peerOrg/msp: could not initialize BCCSP Factories: Failed initializing BCCSP.: Could not initialize BCCSP SW [Failed to initialize software key store: An invalid KeyStore path provided. Path cannot be an empty string.]
Could not find default `PKCS11` BCCSP


I am using the following peer version:



$ peer version
peer:
Version: 1.4.0
Commit SHA: 9cd9fce
Go version: go1.11.2
OS/Arch: linux/amd64
Chaincode:
Base Image Version: 0.4.14
Base Docker Namespace: hyperledger
Base Docker Label: org.hyperledger.fabric
Docker Namespace: hyperledger









share|improve this question
























  • Did you build the peer binary yourself?
    – Gari Singh
    Dec 28 '18 at 12:42










  • You should also remove the SW: section from core.yaml as well
    – Gari Singh
    Dec 28 '18 at 12:55










  • yes remove the SW: (silly code), and also check that an environment variable is not being set to override your default BCCSP
    – gbolo
    Dec 28 '18 at 16:24










  • @GariSingh I first tried the binaries that comes with fabric-samples.. then I build the peer binary which result is same error.. then I removed SW: same error
    – Akshay Sood
    Dec 28 '18 at 16:39










  • You also need to set the pkcs11 build tag: GO_TAGS=pkcs11 make peer
    – Gari Singh
    Dec 29 '18 at 13:06
















1














I am trying to run Hyperledger fabric peer with SoftHSM enabled. Fabric-ca-server is already running with SoftHSM enabled and all the certificates are generated with HSM enabled.



Initially, when I was trying to run fabric-ca-server it was throwing the same error Could not find defaultPKCS11BCCSP.



Then I found some people suggesting to make build from source code and it fixed that error.



Now I am facing the same error when I run peer node start command to bootstrap peer.



The BCCSP content on core.yaml is below:



# BCCSP (Blockchain crypto provider): Select which crypto implementation or
# library to use
BCCSP:
Default: PKCS11
# Settings for the SW crypto provider (i.e. when DEFAULT: SW)
SW:
# TODO: The default Hash and Security level needs refactoring to be
# fully configurable. Changing these defaults requires coordination
# SHA2 is hardcoded in several places, not only BCCSP
Hash: SHA2
Security: 256
# Location of Key Store
FileKeyStore:
# If "", defaults to 'mspConfigPath'/keystore
KeyStore:
# Settings for the PKCS#11 crypto provider (i.e. when DEFAULT: PKCS11)
PKCS11:
# Location of the PKCS11 module library
Library: /usr/local/lib/softhsm/libsofthsm2.so
# Token Label
Label: ForFabric
# User PIN
Pin: 98765432
Hash: SHA2
Security: 256
FileKeyStore:
KeyStore: /home/akshay/dev/fabric-ca/fabric-ca-client/peerOrg/msp/keystore


The error when I run peer node start:



$ peer node start
2018-12-28 14:48:50.508 IST [main] InitCmd -> ERRO 001 Cannot run peer because error when setting up MSP of type bccsp from directory /home/akshay/dev/fabric-ca/fabric-ca-client/peerOrg/msp: could not initialize BCCSP Factories: Failed initializing BCCSP.: Could not initialize BCCSP SW [Failed to initialize software key store: An invalid KeyStore path provided. Path cannot be an empty string.]
Could not find default `PKCS11` BCCSP


I am using the following peer version:



$ peer version
peer:
Version: 1.4.0
Commit SHA: 9cd9fce
Go version: go1.11.2
OS/Arch: linux/amd64
Chaincode:
Base Image Version: 0.4.14
Base Docker Namespace: hyperledger
Base Docker Label: org.hyperledger.fabric
Docker Namespace: hyperledger









share|improve this question
























  • Did you build the peer binary yourself?
    – Gari Singh
    Dec 28 '18 at 12:42










  • You should also remove the SW: section from core.yaml as well
    – Gari Singh
    Dec 28 '18 at 12:55










  • yes remove the SW: (silly code), and also check that an environment variable is not being set to override your default BCCSP
    – gbolo
    Dec 28 '18 at 16:24










  • @GariSingh I first tried the binaries that comes with fabric-samples.. then I build the peer binary which result is same error.. then I removed SW: same error
    – Akshay Sood
    Dec 28 '18 at 16:39










  • You also need to set the pkcs11 build tag: GO_TAGS=pkcs11 make peer
    – Gari Singh
    Dec 29 '18 at 13:06














1












1








1







I am trying to run Hyperledger fabric peer with SoftHSM enabled. Fabric-ca-server is already running with SoftHSM enabled and all the certificates are generated with HSM enabled.



Initially, when I was trying to run fabric-ca-server it was throwing the same error Could not find defaultPKCS11BCCSP.



Then I found some people suggesting to make build from source code and it fixed that error.



Now I am facing the same error when I run peer node start command to bootstrap peer.



The BCCSP content on core.yaml is below:



# BCCSP (Blockchain crypto provider): Select which crypto implementation or
# library to use
BCCSP:
Default: PKCS11
# Settings for the SW crypto provider (i.e. when DEFAULT: SW)
SW:
# TODO: The default Hash and Security level needs refactoring to be
# fully configurable. Changing these defaults requires coordination
# SHA2 is hardcoded in several places, not only BCCSP
Hash: SHA2
Security: 256
# Location of Key Store
FileKeyStore:
# If "", defaults to 'mspConfigPath'/keystore
KeyStore:
# Settings for the PKCS#11 crypto provider (i.e. when DEFAULT: PKCS11)
PKCS11:
# Location of the PKCS11 module library
Library: /usr/local/lib/softhsm/libsofthsm2.so
# Token Label
Label: ForFabric
# User PIN
Pin: 98765432
Hash: SHA2
Security: 256
FileKeyStore:
KeyStore: /home/akshay/dev/fabric-ca/fabric-ca-client/peerOrg/msp/keystore


The error when I run peer node start:



$ peer node start
2018-12-28 14:48:50.508 IST [main] InitCmd -> ERRO 001 Cannot run peer because error when setting up MSP of type bccsp from directory /home/akshay/dev/fabric-ca/fabric-ca-client/peerOrg/msp: could not initialize BCCSP Factories: Failed initializing BCCSP.: Could not initialize BCCSP SW [Failed to initialize software key store: An invalid KeyStore path provided. Path cannot be an empty string.]
Could not find default `PKCS11` BCCSP


I am using the following peer version:



$ peer version
peer:
Version: 1.4.0
Commit SHA: 9cd9fce
Go version: go1.11.2
OS/Arch: linux/amd64
Chaincode:
Base Image Version: 0.4.14
Base Docker Namespace: hyperledger
Base Docker Label: org.hyperledger.fabric
Docker Namespace: hyperledger









share|improve this question















I am trying to run Hyperledger fabric peer with SoftHSM enabled. Fabric-ca-server is already running with SoftHSM enabled and all the certificates are generated with HSM enabled.



Initially, when I was trying to run fabric-ca-server it was throwing the same error Could not find defaultPKCS11BCCSP.



Then I found some people suggesting to make build from source code and it fixed that error.



Now I am facing the same error when I run peer node start command to bootstrap peer.



The BCCSP content on core.yaml is below:



# BCCSP (Blockchain crypto provider): Select which crypto implementation or
# library to use
BCCSP:
Default: PKCS11
# Settings for the SW crypto provider (i.e. when DEFAULT: SW)
SW:
# TODO: The default Hash and Security level needs refactoring to be
# fully configurable. Changing these defaults requires coordination
# SHA2 is hardcoded in several places, not only BCCSP
Hash: SHA2
Security: 256
# Location of Key Store
FileKeyStore:
# If "", defaults to 'mspConfigPath'/keystore
KeyStore:
# Settings for the PKCS#11 crypto provider (i.e. when DEFAULT: PKCS11)
PKCS11:
# Location of the PKCS11 module library
Library: /usr/local/lib/softhsm/libsofthsm2.so
# Token Label
Label: ForFabric
# User PIN
Pin: 98765432
Hash: SHA2
Security: 256
FileKeyStore:
KeyStore: /home/akshay/dev/fabric-ca/fabric-ca-client/peerOrg/msp/keystore


The error when I run peer node start:



$ peer node start
2018-12-28 14:48:50.508 IST [main] InitCmd -> ERRO 001 Cannot run peer because error when setting up MSP of type bccsp from directory /home/akshay/dev/fabric-ca/fabric-ca-client/peerOrg/msp: could not initialize BCCSP Factories: Failed initializing BCCSP.: Could not initialize BCCSP SW [Failed to initialize software key store: An invalid KeyStore path provided. Path cannot be an empty string.]
Could not find default `PKCS11` BCCSP


I am using the following peer version:



$ peer version
peer:
Version: 1.4.0
Commit SHA: 9cd9fce
Go version: go1.11.2
OS/Arch: linux/amd64
Chaincode:
Base Image Version: 0.4.14
Base Docker Namespace: hyperledger
Base Docker Label: org.hyperledger.fabric
Docker Namespace: hyperledger






hyperledger-fabric hyperledger hsm softhsm






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 28 '18 at 9:37







Akshay Sood

















asked Dec 28 '18 at 9:29









Akshay SoodAkshay Sood

79511026




79511026












  • Did you build the peer binary yourself?
    – Gari Singh
    Dec 28 '18 at 12:42










  • You should also remove the SW: section from core.yaml as well
    – Gari Singh
    Dec 28 '18 at 12:55










  • yes remove the SW: (silly code), and also check that an environment variable is not being set to override your default BCCSP
    – gbolo
    Dec 28 '18 at 16:24










  • @GariSingh I first tried the binaries that comes with fabric-samples.. then I build the peer binary which result is same error.. then I removed SW: same error
    – Akshay Sood
    Dec 28 '18 at 16:39










  • You also need to set the pkcs11 build tag: GO_TAGS=pkcs11 make peer
    – Gari Singh
    Dec 29 '18 at 13:06


















  • Did you build the peer binary yourself?
    – Gari Singh
    Dec 28 '18 at 12:42










  • You should also remove the SW: section from core.yaml as well
    – Gari Singh
    Dec 28 '18 at 12:55










  • yes remove the SW: (silly code), and also check that an environment variable is not being set to override your default BCCSP
    – gbolo
    Dec 28 '18 at 16:24










  • @GariSingh I first tried the binaries that comes with fabric-samples.. then I build the peer binary which result is same error.. then I removed SW: same error
    – Akshay Sood
    Dec 28 '18 at 16:39










  • You also need to set the pkcs11 build tag: GO_TAGS=pkcs11 make peer
    – Gari Singh
    Dec 29 '18 at 13:06
















Did you build the peer binary yourself?
– Gari Singh
Dec 28 '18 at 12:42




Did you build the peer binary yourself?
– Gari Singh
Dec 28 '18 at 12:42












You should also remove the SW: section from core.yaml as well
– Gari Singh
Dec 28 '18 at 12:55




You should also remove the SW: section from core.yaml as well
– Gari Singh
Dec 28 '18 at 12:55












yes remove the SW: (silly code), and also check that an environment variable is not being set to override your default BCCSP
– gbolo
Dec 28 '18 at 16:24




yes remove the SW: (silly code), and also check that an environment variable is not being set to override your default BCCSP
– gbolo
Dec 28 '18 at 16:24












@GariSingh I first tried the binaries that comes with fabric-samples.. then I build the peer binary which result is same error.. then I removed SW: same error
– Akshay Sood
Dec 28 '18 at 16:39




@GariSingh I first tried the binaries that comes with fabric-samples.. then I build the peer binary which result is same error.. then I removed SW: same error
– Akshay Sood
Dec 28 '18 at 16:39












You also need to set the pkcs11 build tag: GO_TAGS=pkcs11 make peer
– Gari Singh
Dec 29 '18 at 13:06




You also need to set the pkcs11 build tag: GO_TAGS=pkcs11 make peer
– Gari Singh
Dec 29 '18 at 13:06












1 Answer
1






active

oldest

votes


















1














There were two issues:



1) Make sure to delete the SW: section under BCCSP in core.yaml
2) By default, the peer binary and Docker image are both built without support for PCKS11. You can build the peer binary yourself using GO_TAGS=pkcs11 make peer






share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53956298%2fpeer-node-start-throwing-could-not-find-default-pkcs11-bccsp-error%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    There were two issues:



    1) Make sure to delete the SW: section under BCCSP in core.yaml
    2) By default, the peer binary and Docker image are both built without support for PCKS11. You can build the peer binary yourself using GO_TAGS=pkcs11 make peer






    share|improve this answer


























      1














      There were two issues:



      1) Make sure to delete the SW: section under BCCSP in core.yaml
      2) By default, the peer binary and Docker image are both built without support for PCKS11. You can build the peer binary yourself using GO_TAGS=pkcs11 make peer






      share|improve this answer
























        1












        1








        1






        There were two issues:



        1) Make sure to delete the SW: section under BCCSP in core.yaml
        2) By default, the peer binary and Docker image are both built without support for PCKS11. You can build the peer binary yourself using GO_TAGS=pkcs11 make peer






        share|improve this answer












        There were two issues:



        1) Make sure to delete the SW: section under BCCSP in core.yaml
        2) By default, the peer binary and Docker image are both built without support for PCKS11. You can build the peer binary yourself using GO_TAGS=pkcs11 make peer







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 2 at 10:53









        Gari SinghGari Singh

        4,0902518




        4,0902518






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53956298%2fpeer-node-start-throwing-could-not-find-default-pkcs11-bccsp-error%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Monofisismo

            Angular Downloading a file using contenturl with Basic Authentication

            Olmecas