Skip to content

Commit 9e150eb

Browse files
authored
Use one shot pbkdf2 (#31200)
* Use one shot pbkdf2 * Update NetCorePbkdf2Provider.cs * CR feedback * CR feedback * Fix * Just use GetBytes for now * Update NetCorePbkdf2Provider.cs
1 parent 63553a5 commit 9e150eb

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/DataProtection/Cryptography.KeyDerivation/src/PBKDF2/NetCorePbkdf2Provider.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,7 @@ private static byte[] DeriveKeyImpl(string password, byte[] salt, KeyDerivationP
5454
throw new ArgumentOutOfRangeException();
5555
}
5656

57-
var passwordBytes = Encoding.UTF8.GetBytes(password);
58-
using (var rfc = new Rfc2898DeriveBytes(passwordBytes, salt, iterationCount, algorithmName))
59-
{
60-
return rfc.GetBytes(numBytesRequested);
61-
}
57+
return Rfc2898DeriveBytes.Pbkdf2(Encoding.UTF8.GetBytes(password), salt, iterationCount, algorithmName, numBytesRequested);
6258
}
6359
}
6460
}

0 commit comments

Comments
 (0)