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 #3029

Closed
wants to merge 3 commits into from

Conversation

@faustbrian
Copy link
Collaborator

commented Oct 6, 2019

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
wip
@codecov

This comment has been minimized.

Copy link

commented Oct 7, 2019

Codecov Report

Merging #3029 into develop will increase coverage by 36.1%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #3029      +/-   ##
===========================================
+ Coverage    29.52%   65.63%   +36.1%     
===========================================
  Files          425      425              
  Lines        11733    11732       -1     
  Branches      1595     1595              
===========================================
+ Hits          3464     7700    +4236     
+ Misses        8237     3995    -4242     
- Partials        32       37       +5
Impacted Files Coverage Δ
packages/core-forger/src/delegate.ts 100% <100%> (+60.65%) ⬆️
packages/core-api/src/plugins/pagination/ext.ts 79.24% <0%> (-1.89%) ⬇️
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%) ⬆️
... and 192 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...c080f5a. Read the comment docs.

@KovacZan KovacZan closed this Oct 7, 2019
@KovacZan KovacZan deleted the fix/iv-length branch Oct 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.