From 887f164ab0f9f255de706222cad7c5aabcca171a Mon Sep 17 00:00:00 2001 From: Eirik Tsarpalis Date: Fri, 14 Feb 2020 15:32:29 +0000 Subject: [PATCH] address feedback --- .../src/Internal/Cryptography/BasicSymmetricCipherNCrypt.cs | 4 ++-- .../src/System/Security/Cryptography/CngKey.Export.cs | 2 +- .../System/Security/Cryptography/ECDiffieHellmanCng.Key.cs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/libraries/System.Security.Cryptography.Cng/src/Internal/Cryptography/BasicSymmetricCipherNCrypt.cs b/src/libraries/System.Security.Cryptography.Cng/src/Internal/Cryptography/BasicSymmetricCipherNCrypt.cs index ddcde47d73428..635db77f5f88f 100644 --- a/src/libraries/System.Security.Cryptography.Cng/src/Internal/Cryptography/BasicSymmetricCipherNCrypt.cs +++ b/src/libraries/System.Security.Cryptography.Cng/src/Internal/Cryptography/BasicSymmetricCipherNCrypt.cs @@ -104,7 +104,7 @@ protected sealed override void Dispose(bool disposing) if (_cngKey != null) { _cngKey.Dispose(); - _cngKey = null; + _cngKey = null!; } } @@ -120,7 +120,7 @@ private void Reset() } } - private CngKey? _cngKey; + private CngKey _cngKey; private readonly bool _encrypting; private static readonly CngProperty s_ECBMode = diff --git a/src/libraries/System.Security.Cryptography.Cng/src/System/Security/Cryptography/CngKey.Export.cs b/src/libraries/System.Security.Cryptography.Cng/src/System/Security/Cryptography/CngKey.Export.cs index 26627f4335bbe..4f2a30f8c6a49 100644 --- a/src/libraries/System.Security.Cryptography.Cng/src/System/Security/Cryptography/CngKey.Export.cs +++ b/src/libraries/System.Security.Cryptography.Cng/src/System/Security/Cryptography/CngKey.Export.cs @@ -100,7 +100,7 @@ internal byte[] ExportPkcs8KeyBlob( out byte[]? allocated); Debug.Assert(ret); - Debug.Assert(allocated != null); // on account of allocate parameter being true + Debug.Assert(allocated != null); // since `allocate: true` return allocated; } diff --git a/src/libraries/System.Security.Cryptography.Cng/src/System/Security/Cryptography/ECDiffieHellmanCng.Key.cs b/src/libraries/System.Security.Cryptography.Cng/src/System/Security/Cryptography/ECDiffieHellmanCng.Key.cs index 233e132b494b2..c54c5d9806ffe 100644 --- a/src/libraries/System.Security.Cryptography.Cng/src/System/Security/Cryptography/ECDiffieHellmanCng.Key.cs +++ b/src/libraries/System.Security.Cryptography.Cng/src/System/Security/Cryptography/ECDiffieHellmanCng.Key.cs @@ -99,7 +99,7 @@ public override void GenerateKey(ECCurve curve) private CngKey GetKey() { - CngKey? key = null; + CngKey key; if (_core.IsKeyGeneratedNamedCurve()) { @@ -108,7 +108,7 @@ private CngKey GetKey() } else { - CngAlgorithm? algorithm = null; + CngAlgorithm algorithm; int keySize = 0; // Map the current key size to a CNG algorithm name