key-value-store: some CryptoSuite implementation requires a key store to persist private keys. A CryptoKeyStore is provided for this purpose, which can be used on top of any implementation of the KeyValueStore interface, such as a file-based store or a database-based one. The specific implementation is determined by the value of this configuration setting.
Fabric Node SDK 提供了 FabricCAService
npm i fabric-ca-client --save
Sample code:
let CAClient = require('fabric-ca-client');
// No TLS
let tlsOptions = {
trustedRoots: [],
verify: false
};
let crypto = CAClient.newCryptoSuite({
software: true,
keysize: 384
});
// file-based store
let keyValStorePath = path.join(os.tmpDir(), 'kvsTemp');
let cks = CAClient.newCryptoKeyStore({path:keyValStorePath});
crypto.setCryptoKeyStore(cks);
var client = new CAClient('http://localhost:7054', tlsOptions, 'peerOrg1', crypto);
client.setCryptoSuite(crypto);
网友评论