From 44e4b0799985d3799c207992782bd559c981fbaa Mon Sep 17 00:00:00 2001 From: Sorunome Date: Sat, 30 May 2020 13:19:39 +0200 Subject: [PATCH] remove obsolete comments --- lib/src/key_manager.dart | 1 - lib/src/ssss.dart | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/src/key_manager.dart b/lib/src/key_manager.dart index 6e9d710..5ac075d 100644 --- a/lib/src/key_manager.dart +++ b/lib/src/key_manager.dart @@ -63,7 +63,6 @@ class KeyManager { return; } - // TODO: check if pubkey is valid for (final roomEntries in payload['rooms'].entries) { final roomId = roomEntries.key; if (!(roomEntries.value is Map) || !(roomEntries.value['sessions'] is Map)) { diff --git a/lib/src/ssss.dart b/lib/src/ssss.dart index b639af9..5eca4a4 100644 --- a/lib/src/ssss.dart +++ b/lib/src/ssss.dart @@ -70,16 +70,15 @@ class SSSS { static String decryptAes(_Encrypted data, Uint8List key, String name) { final keys = deriveKeys(key, name); + final cipher = base64.decode(data.ciphertext); final hmac = base64 .encode(Hmac(sha256, keys.hmacKey) - .convert(base64.decode(data.ciphertext)) + .convert(cipher) .bytes) .replaceAll(RegExp(r'=+$'), ''); if (hmac != data.mac.replaceAll(RegExp(r'=+$'), '')) { throw 'Bad MAC'; } - // workaround for https://github.com/leocavalcante/encrypt/issues/136 - final cipher = base64.decode(data.ciphertext); final decipher = AES(Key(keys.aesKey), mode: AESMode.ctr, padding: null) .decrypt(Encrypted(cipher), iv: IV(base64.decode(data.iv))); return String.fromCharCodes(decipher);