Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core-forger): use correct IV length for encryption #3036

Merged
merged 4 commits into from Oct 8, 2019

Conversation

faustbrian
Copy link
Contributor

Summary

Commit digitalbazaar/forge@9979169 in node-forge introduced a new error that is thrown when the IV length isn't matching what would be expected digitalbazaar/forge@9979169#diff-e118e6ad049019e947a73be26a7d966cR972-R976

Previously this just worked even though the IV length was invalid but now node-forge throws an exception like below. Relies on #3025 to pass tests.

Error: Invalid IV length; got 6 bytes and expected 16 bytes.
    at transformIV (/Users/dev/Code/core/node_modules/node-forge/lib/cipherModes.js:973:11)
    at Object.<anonymous>.modes.cbc.start (/Users/dev/Code/core/node_modules/node-forge/lib/cipherModes.js:122:16)
    at Object.<anonymous>.forge.cipher.BlockCipher.Object.<anonymous>.BlockCipher.start (/Users/dev/Code/core/node_modules/node-forge/lib/cipher.js:158:13)
    at Delegate.encryptDataWithOtp (/Users/dev/Code/core/packages/core-forger/src/delegate.ts:137:16)
    at Delegate.encryptKeysWithOtp (/Users/dev/Code/core/packages/core-forger/src/delegate.ts:68:35)
    at new Delegate (/Users/dev/Code/core/packages/core-forger/src/delegate.ts:49:22)
    at Object.<anonymous> (/Users/dev/Code/core/__tests__/unit/core-forger/delegate.test.ts:28:34)
    at Object.asyncJestTest (/Users/dev/Code/core/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:102:37)
    at /Users/dev/Code/core/node_modules/jest-jasmine2/build/queueRunner.js:43:12
    at new Promise (<anonymous>)

Checklist

  • Documentation (if necessary)
  • Tests (if necessary)
  • Ready to be merged

@codecov
Copy link

codecov bot commented Oct 7, 2019

Codecov Report

Merging #3036 into develop will increase coverage by 36.11%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##           develop    #3036       +/-   ##
============================================
+ Coverage    29.52%   65.64%   +36.11%     
============================================
  Files          425      425               
  Lines        11733    11732        -1     
  Branches      1595     1595               
============================================
+ Hits          3464     7701     +4237     
+ Misses        8237     3995     -4242     
- Partials        32       36        +4
Impacted Files Coverage Δ
packages/core-forger/src/delegate.ts 100% <100%> (+60.65%) ⬆️
packages/crypto/src/utils/base58.ts 100% <0%> (+7.14%) ⬆️
...ckages/core-transaction-pool/src/wallet-manager.ts 100% <0%> (+7.14%) ⬆️
...ckages/core-transactions/src/transaction-reader.ts 8.33% <0%> (+8.33%) ⬆️
packages/crypto/src/transactions/types/factory.ts 100% <0%> (+8.33%) ⬆️
packages/core-container/src/config/file-loader.ts 10.86% <0%> (+10.86%) ⬆️
packages/core-transaction-pool/src/manager.ts 100% <0%> (+11.11%) ⬆️
...ckages/core-p2p/src/socket-server/versions/peer.ts 60% <0%> (+12.72%) ⬆️
packages/core-utils/src/httpie.ts 12.9% <0%> (+12.9%) ⬆️
packages/core-p2p/src/utils/is-valid-version.ts 100% <0%> (+14.28%) ⬆️
... and 191 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 516a586...6211a63. Read the comment docs.

@faustbrian faustbrian merged commit 2aad9ef into develop Oct 8, 2019
@faustbrian faustbrian deleted the fix/iv-length branch October 8, 2019 02:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants