Page MenuHomePhabricator

[native][AES] Implement decrypt function on Android
ClosedPublic

Authored by bartek on Mar 8 2023, 10:15 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Nov 16, 3:23 AM
Unknown Object (File)
Sun, Nov 10, 5:54 PM
Unknown Object (File)
Thu, Nov 7, 12:12 PM
Unknown Object (File)
Thu, Nov 7, 10:26 AM
Unknown Object (File)
Sat, Nov 2, 12:28 AM
Unknown Object (File)
Sat, Nov 2, 12:28 AM
Unknown Object (File)
Sat, Nov 2, 12:28 AM
Unknown Object (File)
Sat, Nov 2, 12:28 AM
Subscribers

Details

Summary
Test Plan

The same as in D7006:

import * as AES from './utils/aes-crypto-module.js';

const key = AES.generateKey();
console.log('Key', key);
const plaintextBytes = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
const ciphertext = AES.encrypt(key, plaintextBytes);
console.log('Ciphertext', ciphertext);
const decrypted = AES.decrypt(key, ciphertext);
console.log('Decrypted', decrypted); // should be equal to plaintextBytes

should display sth like:

LOG  Key [82, 226, 211, 141, 62, 105, 93, 161, 238, 193, 163, 46, 151, 205, 133, 163, 175, 15, 110, 16, 139, 86, 150, 10, 26, 30, 179, 245, 221, 215, 19, 13]
LOG  Ciphertext [74, 52, 31, 132, 80, 213, 246, 255, 188, 231, 18, 27, 222, 224, 91, 53, 204, 198, 109, 53, 40, 194, 198, 149, 181, 34, 131, 102, 228, 246, 171, 190, 89, 232, 36, 74, 173, 211]
LOG  Decrypted [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

bartek held this revision as a draft.
bartek published this revision for review.Mar 8 2023, 10:43 AM
atul added inline comments.
native/expo-modules/aes-crypto/android/src/main/java/app/comm/android/aescrypto/AESCryptoModule.kt
94–97 ↗(On Diff #23543)

Same feedback on these checks as for other diffs.

This revision is now accepted and ready to land.Mar 10 2023, 3:06 PM

Address code review feedback