Skip to content

Commit

Permalink
BCCSP config back to SHA2
Browse files Browse the repository at this point in the history
Corresponding to https://gerrit.hyperledger.org/r/#/c/6571/

Change-Id: I239866643acddfd0de0cf4ce176d6c67ee0990d4
Signed-off-by: Jim Zhang <jzhang@us.ibm.com>
  • Loading branch information
jimthematrix committed Feb 27, 2017
1 parent 2579307 commit d3fcbe2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion fabric-client/config/default.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"request-timeout" : 3000,
"tcert-batch-size" : 10,
"crypto-hash-algo": "SHA3",
"crypto-hash-algo": "SHA2",
"crypto-keysize": 256,
"crypto-hsm": false,
"crypto-suite-software": {
Expand Down
15 changes: 7 additions & 8 deletions test/unit/cryptosuite-ecdsa-aes.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,15 +269,14 @@ test('\n\n ** CryptoSuite_ECDSA_AES - function tests **\n\n', function (t) {
t.equal(true, (typeof cryptoUtils._ecdsaCurve !== 'undefined' && typeof cryptoUtils._ecdsa !== 'undefined'),
'CryptoSuite_ECDSA_AES function tests: default instance has "_ecdsaCurve" and "_ecdsa" properties');

// test default curve 256 with SHA3_256
t.equal(cryptoUtils.hash(TEST_MSG), HASH_MSG_SHA3_256,
// test default curve 256 with SHA256
t.equal(cryptoUtils.hash(TEST_MSG), HASH_MSG_SHA256,
'CryptoSuite_ECDSA_AES function tests: using "SHA2" hashing algorithm with default key size which should be 256');

t.equal(cryptoUtils.hash(TEST_LONG_MSG), HASH_LONG_MSG_SHA3_256,
t.equal(cryptoUtils.hash(TEST_LONG_MSG), HASH_LONG_MSG_SHA256,
'CryptoSuite_ECDSA_AES function tests: using "SHA2" hashing algorithm with default key size which should be 256');

// test SHA384 hash
utils.setConfigSetting('crypto-hash-algo', 'sha2');
utils.setConfigSetting('crypto-keysize', 384);
cryptoUtils = utils.getCryptoSuite();
t.equal(cryptoUtils.hash(TEST_MSG), HASH_MSG_SHA384,
Expand All @@ -292,8 +291,8 @@ test('\n\n ** CryptoSuite_ECDSA_AES - function tests **\n\n', function (t) {
t.equal('secp256r1', key.getPublicKey()._key.curveName,
'CryptoSuite_ECDSA_AES function tests: cryptoUtils generated public key curveName == secp256r1');

// test curve 256 with SHA2_256
utils.setConfigSetting('crypto-hash-algo', 'SHA2');
// test curve 256 with SHA3_256
utils.setConfigSetting('crypto-hash-algo', 'SHA3');
utils.setConfigSetting('crypto-keysize', 256);
cryptoUtils = utils.getCryptoSuite();
return cryptoUtils.generateKey();
Expand All @@ -302,10 +301,10 @@ test('\n\n ** CryptoSuite_ECDSA_AES - function tests **\n\n', function (t) {
t.equal('secp256r1', key.getPublicKey()._key.curveName,
'CryptoSuite_ECDSA_AES function tests: ccryptoUtils generated public key curveName == secp256r1');

t.equal(cryptoUtils.hash(TEST_MSG), HASH_MSG_SHA256,
t.equal(cryptoUtils.hash(TEST_MSG), HASH_MSG_SHA3_256,
'CryptoSuite_ECDSA_AES function tests: using "SHA3" hashing algorithm with key size 256');

t.equal(cryptoUtils.hash(TEST_LONG_MSG), HASH_LONG_MSG_SHA256,
t.equal(cryptoUtils.hash(TEST_LONG_MSG), HASH_LONG_MSG_SHA3_256,
'CryptoSuite_ECDSA_AES function tests: using "SHA3" hashing algorithm with key size 256');

// test SHA3_384
Expand Down

0 comments on commit d3fcbe2

Please sign in to comment.