From e4c17e2e27aa4d68b28ee2df6f849caa9608a4f3 Mon Sep 17 00:00:00 2001 From: Philipp Crocoll Date: Mon, 5 Sep 2016 11:17:53 +0200 Subject: [PATCH] fix error with using native libary on Android, now allowing AesKdf again --- .../Cryptography/KeyDerivation/AesKdf.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/KeePassLib2Android/Cryptography/KeyDerivation/AesKdf.cs b/src/KeePassLib2Android/Cryptography/KeyDerivation/AesKdf.cs index 0b82f94e..194b43d5 100644 --- a/src/KeePassLib2Android/Cryptography/KeyDerivation/AesKdf.cs +++ b/src/KeePassLib2Android/Cryptography/KeyDerivation/AesKdf.cs @@ -120,9 +120,15 @@ namespace KeePassLib.Cryptography.KeyDerivation try { // Try to use the native library first - if(NativeLib.TransformKey256(pbNewKey, pbKeySeed32, uNumRounds)) - return CryptoUtil.HashSha256(pbNewKey); + if (NativeLib.TransformKey256(pbNewKey, pbKeySeed32, uNumRounds)) + { + byte[] pbKey = new byte[32]; + Array.Copy(pbNewKey, pbKey, pbNewKey.Length); + + return pbKey; + } + if(TransformKeyManaged(pbNewKey, pbKeySeed32, uNumRounds)) return CryptoUtil.HashSha256(pbNewKey); }