SYSLIB0048: RSA.EncryptValue and RSA.DecryptValue are obsolete
The following methods are obsolete, starting in .NET 8. Calling them in code generates warning SYSLIB0048
at compile time.
- System.Security.Cryptography.RSA.EncryptValue(Byte[])
- System.Security.Cryptography.RSA.DecryptValue(Byte[])
- System.Security.Cryptography.RSACryptoServiceProvider.EncryptValue(Byte[])
- System.Security.Cryptography.RSACryptoServiceProvider.DecryptValue(Byte[])
Workaround
Use RSA.Encrypt and RSA.Decrypt instead.
Suppress a warning
If you must use the obsolete APIs, you can suppress the warning in code or in your project file.
To suppress only a single violation, add preprocessor directives to your source file to disable and then re-enable the warning.
// Disable the warning.
#pragma warning disable SYSLIB0048
// Code that uses obsolete API.
// ...
// Re-enable the warning.
#pragma warning restore SYSLIB0048
To suppress all the SYSLIB0048
warnings in your project, add a <NoWarn>
property to your project file.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
...
<NoWarn>$(NoWarn);SYSLIB0048</NoWarn>
</PropertyGroup>
</Project>
For more information, see Suppress warnings.
See also
التعاون معنا على GitHub
يمكن العثور على مصدر هذا المحتوى على GitHub حيث يمكنك أيضاً إضافة مشاكل وطلبات سحب ومراجعتها. للحصول على معلومات إضافية، اطلع على دليل المساهم لدينا.