* Removed unused locals from AsnReader.
The return value of the method is not needed however the out values
are.
* Remove key local from ECDiffieHellmanCng.
The return value is not needed however the key still needs to be
generated.
* Remove key local from ECDsaCng.
The return value is not needed however the key still needs to be
generated.
* Remove unused local.
The return value is not needed from the method however the out
parameters are.
* Discard result from `CryptAcquireContext`.
The result is discarded rather than entirely omitted to clearly express
the intent that the return value is not used.
Commit migrated from https://github.com/dotnet/corefx/commit/
3d4511a79cbdbe85832c2af2ec18e165b696adc9
/// <seealso cref="ReadEncodedValue"/>
public ReadOnlyMemory<byte> PeekEncodedValue()
{
- Asn1Tag tag = ReadTagAndLength(out int? length, out int bytesRead);
+ ReadTagAndLength(out int? length, out int bytesRead);
if (length == null)
{
/// <seealso cref="PeekEncodedValue"/>
public ReadOnlyMemory<byte> PeekContentBytes()
{
- Asn1Tag tag = ReadTagAndLength(out int? length, out int bytesRead);
+ ReadTagAndLength(out int? length, out int bytesRead);
if (length == null)
{
Debug.Fail($"Unknown algorithm {alg}");
throw new ArgumentException(SR.Cryptography_InvalidKeySize);
}
- CngKey key = _core.GetOrGenerateKey(keySize, alg);
+ _core.GetOrGenerateKey(keySize, alg);
ForceSetKeySize(keySize);
}
}
Debug.Fail($"Unknown algorithm {alg}");
throw new ArgumentException(SR.Cryptography_InvalidKeySize);
}
- CngKey key = _core.GetOrGenerateKey(keySize, alg);
+ _core.GetOrGenerateKey(keySize, alg);
ForceSetKeySize(keySize);
}
}
private static void ReencodeIfUsingIndefiniteLengthEncodingOnOuterStructure(ref byte[] encodedContent)
{
AsnReader reader = new AsnReader(encodedContent, AsnEncodingRules.BER);
- Asn1Tag tag = reader.ReadTagAndLength(out int? contentsLength, out int _);
+ reader.ReadTagAndLength(out int? contentsLength, out int _);
if (contentsLength != null)
{
{
CryptAcquireContextFlags flags = (pProvInfo->dwFlags & CryptAcquireContextFlags.CRYPT_MACHINE_KEYSET) | CryptAcquireContextFlags.CRYPT_DELETEKEYSET;
IntPtr hProv;
- bool success = Interop.cryptoapi.CryptAcquireContext(out hProv, pProvInfo->pwszContainerName, pProvInfo->pwszProvName, pProvInfo->dwProvType, flags);
+ _ = Interop.cryptoapi.CryptAcquireContext(out hProv, pProvInfo->pwszContainerName, pProvInfo->pwszProvName, pProvInfo->dwProvType, flags);
// Called CryptAcquireContext solely for the side effect of deleting the key containers. When called with these flags, no actual
// hProv is returned (so there's nothing to clean up.)