How to use the fabric-ca-client.newCryptoSuite function in fabric-ca-client

To help you get started, we’ve selected a few fabric-ca-client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hyperledger / fabric-sdk-node / test / unit / fabric-ca-client.js View on Github external
test('FabricCAServices:  Test newCryptoSuite() function', (t) => {
	const tlsOptions = {
		trustedRoots: [],
		verify: false
	};
	const CAClient = require('fabric-ca-client');
	let crypto = CAClient.newCryptoSuite({ software: true, keysize: 384 });
	const client = new CAClient('http://localhost:7054', tlsOptions, 'peerOrg1', crypto);

	client.setCryptoSuite(crypto);

	crypto = client.getCryptoSuite();

	if (crypto) {
		t.pass('Successfully called getCryptoSuite()');
	}
	else {
		t.fail('getCryptoSuite() did not return an object');
	}
	t.end();
});
github hyperledger / fabric-sdk-node / test / unit / fabric-ca-client.js View on Github external
test('FabricCAServices:  Test newCryptoKeyStore() function', (t) => {
	const tlsOptions = {
		trustedRoots: [],
		verify: false
	};
	const CAClient = require('fabric-ca-client');

	let crypto = CAClient.newCryptoSuite({ software: true, keysize: 384 });
	const keyValStorePath = path.join(testutil.getTempDir(), 'kvsTemp');

	if (!crypto._cryptoKeyStore) {
		t.pass('cryptoKeyStore is not set on a new cryptoSuite');
	} else {
		t.fail('cryptoKeyStore should not be set on a new cryptoSuite');
	}

	const cks = CAClient.newCryptoKeyStore({ path: keyValStorePath });
	crypto.setCryptoKeyStore(cks);

	const client = new CAClient('http://localhost:7054', tlsOptions, 'peerOrg1', crypto);
	client.setCryptoSuite(crypto);

	crypto = client.getCryptoSuite();