Skip to content
This repository was archived by the owner on Apr 22, 2025. It is now read-only.

Commit 130173b

Browse files
author
“5sWind”
committed
[FABN-1359] Move HSM docs into separated page
Will move and prettify HSM detailed contents in README.md into fabric-sdk-node.github.io tutorials, since the special tests for HSM is not necessary thing for every builder/developer. Let's move it out of README. Signed-off-by: “5sWind” <fiveswind@gmail.com> Change-Id: Ia97289b27c5f6efae4ca2e03ea7a1cf6ee56010a
1 parent be841fe commit 130173b

File tree

3 files changed

+56
-21
lines changed

3 files changed

+56
-21
lines changed

README.md

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -49,27 +49,8 @@ We have functional and scenario based tests that may be run via the following co
4949
* `node test/integration/e2e/query.js`
5050

5151
### Special Tests for Hardware Security Module support via PKCS#11 interface
52-
The SDK has support for PKCS#11 interface in order to allow applications to make use of HSM devices for key management. To turn these tests off, set environment variable "PKCS11_TESTS" to "false". In order to run the tests:
53-
54-
* Install a software emulator of the PKCS#11 interface. The unit tests have been tried with SoftHSM2:
55-
* install using the package manager for your host system:
56-
* Ubuntu: apt-get install softhsm2
57-
* macOS: brew install softhsm
58-
* or install from source:
59-
* install openssl 1.0.0+ or botan 1.10.0+
60-
* download the source code from https://dist.opendnssec.org/source/softhsm-2.2.0.tar.gz
61-
* `tar -xvf softhsm-2.2.0.tar.gz`
62-
* `cd softhsm-2.2.0`
63-
* `./configure --disable-gost` (would require additional libraries, turn it off unless you need gost algorithm support for the Russian market)
64-
* `make`
65-
* `sudo make install`
66-
* set environment variable "SOFTHSM2_CONF" to "./test/fixtures/hsm/softhsm2.conf"
67-
* create a token to store keys inside slot 0: `softhsm2-util --init-token --slot 0 --label "My token 1"`, you will be prompted two PINs: SO (Security Officer) PIN that can be used to re-initialize the token, and user PIN to be used by applications to access the token for generating and retrieving keys
68-
69-
The unit test assumes slot '0' and user PIN `98765432`. If your configuration is different, use these environment variables to pass in the values:
70-
* PKCS11_LIB - path to the SoftHSM2 library, if not specified, the test case searches through a list of popular install locaions
71-
* PKCS11_PIN
72-
* PKCS11_SLOT
52+
53+
The SDK has support for Hardware Security Module via PKCS#11 interface. See [Testing for Hardware Security Module via PKCS#11 interface](https://fabric-sdk-node.github.io/release-1.4/tutorial-hsm-pkcs11.html) for configuration and tests.
7354

7455
### Hyperledger Fabric Client objects and reference documentation
7556
The SDK has support for Java based Chaincode. To turn these tests off, set the environment variable "JAVA_TESTS" to false.

docs/tutorials/hsm-pkcs11.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
This tutorial illustrates the different ways of installing, configuring and testing the Hardware Security Module SoftHSM via PKCS#11 interface with a Hyperledger Fabric SDK for Node.js as of 1.4.
2+
3+
For more information please refer to [SoftHSM](https://www.opendnssec.org/softhsm/).
4+
5+
## Overview
6+
7+
The SDK has support for PKCS#11 interface in order to allow applications to make use of HSM devices for key management.
8+
9+
## Installation
10+
11+
In order to run the tests, install a software emulator of the PKCS#11 interface.
12+
13+
### Install using the package manager for your host system
14+
15+
* Ubuntu: apt-get install softhsm2
16+
* macOS: brew install softhsm
17+
* Windows: **unsupported**.
18+
19+
### Or install from source
20+
21+
1. install openssl 1.0.0+ or botan 1.10.0+
22+
2. download the source code from <https://dist.opendnssec.org/source/softhsm-2.2.0.tar.gz>
23+
3. `tar -xvf softhsm-2.2.0.tar.gz`
24+
4. `cd softhsm-2.2.0`
25+
5. `./configure --disable-gost` (would require additional libraries, turn it off unless you need gost algorithm support for the Russian market)
26+
6. `make`
27+
7. `sudo make install`
28+
29+
### Set environment variable "SOFTHSM2_CONF" to "./test/fixtures/softhsm2.conf"
30+
31+
```bash
32+
export SOFTHSM2_CONF="./test/fixtures/softhsm2.conf"
33+
```
34+
35+
### Create a token to store keys inside slot 0
36+
37+
```bash
38+
softhsm2-util --init-token --slot 0 --label "My token 1"
39+
```
40+
41+
Then you will be prompted two PINs: SO (Security Officer) PIN that can be used to re-initialize the token, and user PIN to be used by applications to access the token for generating and retrieving keys.
42+
43+
## Test
44+
45+
The unit tests have been tried with SoftHSM2 and assumes slot '0' and user PIN `98765432`. If your configuration is different, use these environment variables to pass in the values:
46+
47+
* PKCS11_LIB - path to the SoftHSM2 library, if not specified, the test case searches through a list of popular install locaions
48+
* PKCS11_PIN
49+
* PKCS11_SLOT
50+
51+
To turn these tests off, set environment variable "PKCS11_TESTS" to "false".

docs/tutorials/tutorials.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,8 @@
5555
},
5656
"fabtoken": {
5757
"title": "fabric-client: How to perform token operations"
58+
},
59+
"hsm-pkcs11": {
60+
"title": "Testing for Hardware Security Module via PKCS#11 interface"
5861
}
5962
}

0 commit comments

Comments
 (0)