From 596bf97f74ea18c652ad026e99d76ababb032222 Mon Sep 17 00:00:00 2001 From: Bogdan Gavril Date: Mon, 15 Mar 2021 09:15:17 +0000 Subject: [PATCH] .NET classic - use absctract cprypto builders instead of concrete impl --- .../Platforms/netdesktop/NetDesktopCryptographyManager.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/client/Microsoft.Identity.Client/Platforms/netdesktop/NetDesktopCryptographyManager.cs b/src/client/Microsoft.Identity.Client/Platforms/netdesktop/NetDesktopCryptographyManager.cs index 45cbdb3e62..89d852ee6b 100644 --- a/src/client/Microsoft.Identity.Client/Platforms/netdesktop/NetDesktopCryptographyManager.cs +++ b/src/client/Microsoft.Identity.Client/Platforms/netdesktop/NetDesktopCryptographyManager.cs @@ -31,7 +31,7 @@ public string CreateBase64UrlEncodedSha256Hash(string input) public string GenerateCodeVerifier() { byte[] buffer = new byte[Constants.CodeVerifierByteSize]; - using (RNGCryptoServiceProvider randomSource = new RNGCryptoServiceProvider()) + using (var randomSource = RandomNumberGenerator.Create()) { randomSource.GetBytes(buffer); } @@ -45,8 +45,8 @@ public string CreateSha256Hash(string input) } public byte[] CreateSha256HashBytes(string input) - { - using (var sha = new SHA256Cng()) + { + using (var sha = SHA256.Create()) { return sha.ComputeHash(Encoding.UTF8.GetBytes(input)); }