-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Description
Background and Motivation
Many of the cryptographic algorithms have an inheritance hierarchy to allow for distinct implementations to be used. For example, in .NET Framework SHA256Managed uses a fully managed implementation, SHA256CryptoServiceProvider uses Windows CAPI, and SHA256Cng uses Windows CNG.
In .NET (nee Core) these types are all always backed by a single native implementation (using Windows CNG, Apple Security.Framework, or OpenSSL (as appropriate)), so there's no reason to prefer any one type over another.
- Hash algorithms: All derived types use the same underlying implementation.
- Symmetric cryptography: AesCng and TripleDESCng both allow opening a persisted/named key via type-specific constructors. No other derived types have type-specific options, and all implementations for a particular algorithm on a given platform have the same underlying implementation.
- Asymmetric cryptography: The different providers have mild observable differences, so this issue doesn't apply to them.
Notably, the .NET (nee Core) reference assemblies already has these types marked as [EditorBrowsable(Never)].
All modern code should instantiate these algorithms via the Create() static method on the algorithm type (e.g. SHA256.Create()) (except, as noted, for the persisted key use case for AesCng and TripleDESCng).
Proposed API
namespace System.Security.Cryptography.Algorithms
{
+ [Obsolete(someID)]
[EditorBrowsable(EditorBrowsableState.Never)]
public partial class AesCryptoServiceProvider
{
}
+ [Obsolete(someID)]
[EditorBrowsable(EditorBrowsableState.Never)]
public partial class AesManaged
{
}
+ [Obsolete(someID)]
[EditorBrowsable(EditorBrowsableState.Never)]
public partial class DESCryptoServiceProvider
{
}
+ [Obsolete(someID)]
[EditorBrowsable(EditorBrowsableState.Never)]
public partial class MD5CryptoServiceProvider
{
}
+ [Obsolete(someID)]
[EditorBrowsable(EditorBrowsableState.Never)]
public partial class RC2CryptoServiceProvider
{
}
+ [Obsolete(someID)]
[EditorBrowsable(EditorBrowsableState.Never)]
public partial class SHA1Managed
{
}
+ [Obsolete(someID)]
[EditorBrowsable(EditorBrowsableState.Never)]
public partial class SHA1CryptoServiceProvider
{
}
+ [Obsolete(someID)]
[EditorBrowsable(EditorBrowsableState.Never)]
public partial class SHA256Managed
{
}
+ [Obsolete(someID)]
[EditorBrowsable(EditorBrowsableState.Never)]
public partial class SHA256CryptoServiceProvider
{
}
+ [Obsolete(someID)]
[EditorBrowsable(EditorBrowsableState.Never)]
public partial class SHA384Managed
{
}
+ [Obsolete(someID)]
[EditorBrowsable(EditorBrowsableState.Never)]
public partial class SHA384CryptoServiceProvider
{
}
+ [Obsolete(someID)]
[EditorBrowsable(EditorBrowsableState.Never)]
public partial class SHA512Managed
{
}
+ [Obsolete(someID)]
[EditorBrowsable(EditorBrowsableState.Never)]
public partial class SHA512CryptoServiceProvider
{
}
+ [Obsolete(someID)]
[EditorBrowsable(EditorBrowsableState.Never)]
public partial class TripleDESCryptoServiceProvider
{
}
}