Skip to content

Commit

Permalink
FAB-1053 remove generateNounce() from CryptoSuite API
Browse files Browse the repository at this point in the history
this is not part of the BCCSP API design and is internal to the
encryption algorithm

Change-Id: I3511ab55efdc3b4fb1afbe1d47b2aa4097e0d46c
Signed-off-by: Jim Zhang <jzhang@us.ibm.com>
  • Loading branch information
jimthematrix committed Nov 9, 2016
1 parent 74aaa9a commit 013c1a2
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 25 deletions.
2 changes: 0 additions & 2 deletions lib/Member.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,6 @@ var Member = class {
function(enrollment) {

self._enrollment = enrollment;
// Generate queryStateKey
self._enrollment.queryStateKey = self._chain.cryptoPrimitives.generateNonce();

// Save state
return self.saveState()
Expand Down
8 changes: 0 additions & 8 deletions lib/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,6 @@ module.exports.CryptoSuite = class {
*/
setHashAlgorithm(hashAlgorithm) {}

/**
* Generate a nonce to use as one-time state key. Size of the nonce
* is determined by the crypto suite implementation
*
* @returns {byte[]} the random number
*/
generateNonce() {}

/**
* Generate asymmetric key pair
*
Expand Down
4 changes: 0 additions & 4 deletions lib/impl/CryptoSuite_ECDSA_SHA.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,6 @@ var CryptoSuite_ECDSA_SHA = class extends api.CryptoSuite {
this._initialize();
}

generateNonce() {
return crypto.randomBytes(NonceSize);
}

generateKeyPair() {
return KEYUTIL.generateKeypair('EC', this._curveName);
}
Expand Down
11 changes: 0 additions & 11 deletions test/unit/headless-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -924,17 +924,6 @@ test('\n\n ** CryptoSuite_ECDSA_SHA - function tests', function(t) {
'CryptoSuite_ECDSA_SHA function tests: setHashAlgorithm("SHA5") should throw Illegal Hash function family'
);

var nonce1 = cryptoUtils.generateNonce();
if (t.equal(24, nonce1.length,
'CryptoSuite_ECDSA_SHA function tests: generateNonce length'));

var nonce2 = cryptoUtils.generateNonce();
var nonce3 = cryptoUtils.generateNonce();
if (nonce1 != nonce2 && nonce2 != nonce3)
t.pass('CryptoSuite_ECDSA_SHA function tests: verify generateNonce buffers are different');
else
t.fail('CryptoSuite_ECDSA_SHA function tests: verify generateNonce buffers are different');

t.throws(
function() {
cryptoUtils.setHashAlgorithm('SHA3');
Expand Down

0 comments on commit 013c1a2

Please sign in to comment.