diff --git a/lib/src/crypto/aes.dart b/lib/src/crypto/aes.dart index 2089c16..7b565ef 100644 --- a/lib/src/crypto/aes.dart +++ b/lib/src/crypto/aes.dart @@ -176,7 +176,7 @@ class AESChiperSelector{ return AESCipher128(); case KEY_LENGTH.s192: _log.finer("AES chiper with 192-bit key size selected."); - return AESCipher128(); + return AESCipher192(); case KEY_LENGTH.s256: _log.finer("AES chiper with 256-bit key size selected."); return AESCipher256(); diff --git a/lib/src/proto/pace.dart b/lib/src/proto/pace.dart index 5ab60be..4778be9 100644 --- a/lib/src/proto/pace.dart +++ b/lib/src/proto/pace.dart @@ -580,8 +580,8 @@ class PACE { if (cipherAlgo == CipherAlgorithm.AES){ _log.debug("PACE.decryptNonce; Cipher algorithm: AES"); - AESCipher aesCipher128 = AESChiperSelector.getChiper(size: KEY_LENGTH.s128); - Uint8List decryptedNonce = aesCipher128.decrypt(data: nonce, key: k_pi); + AESCipher aesCipher = AESChiperSelector.getChiper(size: keyLength); + Uint8List decryptedNonce = aesCipher.decrypt(data: nonce, key: k_pi); _log.sdVerbose("PACE.decryptNonce; Decrypted nonce: ${decryptedNonce.hex()}"); return decryptedNonce; }