Mobile: Fixes #10409: Fix accepting encrypted shared notebooks #10429
+113
−27
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This pull request adds support for decrypting data longer than 256 bytes in RSA.react-native.ts.
Previously, ppkEncryptionHandler was called with data longer than 256 bytes while accepting a share, causing an error.
This pull request does not add support for long-data encryption mobile. Long-data encryption should only be necessary for sharing encrypted notebooks.
Notes
node-rsa
seems to use ECB-mode (breaking the data into chunks, then encrypting/decrypting each individually) for encrypting/decrypting multiple blocks.RSAKeyPair
data structure. This is used to calculate the block size. While it's possible to get the key size from the public key, it seems to be more complicated than providing a copy of the key size toencrypt
/decrypt`.Testing plan
This pull request extends the existing automated tests that run on app startup. It can also be tested manually by:
This has been tested successfully on an iOS 17.4 simulator and an Android 14 emulator.