Obsolete warnings

Dondon510 221 Reputation points
2022-08-21T16:46:20.447+00:00

Hi,

I got warnings below:

warning SYSLIB0021: 'MD5CryptoServiceProvider' is obsolete: 'Derived cryptographic types are obsolete. Use the Create method on the base type instead.'
warning SYSLIB0021: 'TripleDESCryptoServiceProvider' is obsolete: 'Derived cryptographic types are obsolete. Use the Create method on the base type instead.'
warning SYSLIB0023: 'RNGCryptoServiceProvider' is obsolete: 'RNGCryptoServiceProvider is obsolete. To generate a random number, use one of the RandomNumberGenerator static

those for my codes below:

MD5 md5 = new MD5CryptoServiceProvider();
TripleDES des = new TripleDESCryptoServiceProvider();
using RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider();

How to deal with them? or is it safe to ignore it?

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,164 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Brando Zhang-MSFT 2,956 Reputation points Microsoft Vendor
    2022-08-22T02:47:59.47+00:00

    According to the error message, you could find it said the 'MD5CryptoServiceProvider' is obsolete, so you should use the new method create to do it.

    More details, you could refer to below codes:

    var test = MD5.Create();  
    var test 2 = TripleDES.Create();  
    

    More details, you could refer to this article.

    0 comments No comments