diff --git a/src/libraries/Common/src/Internal/Cryptography/HashProvider.cs b/src/libraries/Common/src/Internal/Cryptography/HashProvider.cs index cc47097a9b2992..97814426e84f6d 100644 --- a/src/libraries/Common/src/Internal/Cryptography/HashProvider.cs +++ b/src/libraries/Common/src/Internal/Cryptography/HashProvider.cs @@ -20,7 +20,7 @@ public void AppendHashData(byte[] data, int offset, int count) // an invalid number of bytes read. Since our implementations of AppendHashDataCore // end up using unsafe code, we want to be sure the arguments are valid. if (data == null) - throw new ArgumentNullException(nameof(data), SR.ArgumentNull_Buffer); + throw new ArgumentNullException(nameof(data)); if (offset < 0) throw new ArgumentOutOfRangeException(nameof(offset), SR.ArgumentOutOfRange_NeedNonNegNum); if (count < 0) diff --git a/src/libraries/Common/src/Internal/Cryptography/Helpers.cs b/src/libraries/Common/src/Internal/Cryptography/Helpers.cs index 25c826cc8fddc5..cb8733886d27e1 100644 --- a/src/libraries/Common/src/Internal/Cryptography/Helpers.cs +++ b/src/libraries/Common/src/Internal/Cryptography/Helpers.cs @@ -10,6 +10,22 @@ namespace Internal.Cryptography { internal static partial class Helpers { + [UnsupportedOSPlatformGuard("browser")] + internal static bool HasSymmetricEncryption { get; } = +#if NET5_0_OR_GREATER + !OperatingSystem.IsBrowser(); +#else + true; +#endif + + [UnsupportedOSPlatformGuard("browser")] + internal static bool HasHMAC { get; } = +#if NET5_0_OR_GREATER + !OperatingSystem.IsBrowser(); +#else + true; +#endif + #if NET5_0_OR_GREATER [UnsupportedOSPlatformGuard("ios")] [UnsupportedOSPlatformGuard("tvos")] @@ -20,6 +36,7 @@ internal static partial class Helpers #if NET5_0_OR_GREATER [UnsupportedOSPlatformGuard("android")] + [UnsupportedOSPlatformGuard("browser")] public static bool IsRC2Supported => !OperatingSystem.IsAndroid(); #else public static bool IsRC2Supported => true; diff --git a/src/libraries/Common/src/Internal/Cryptography/UniversalCryptoTransform.cs b/src/libraries/Common/src/Internal/Cryptography/UniversalCryptoTransform.cs index a3a22165c6cebc..bd12894e5156cd 100644 --- a/src/libraries/Common/src/Internal/Cryptography/UniversalCryptoTransform.cs +++ b/src/libraries/Common/src/Internal/Cryptography/UniversalCryptoTransform.cs @@ -78,13 +78,13 @@ public int TransformBlock(byte[] inputBuffer, int inputOffset, int inputCount, b if (inputCount % InputBlockSize != 0) throw new ArgumentOutOfRangeException(nameof(inputCount), SR.Cryptography_MustTransformWholeBlock); if (inputCount > inputBuffer.Length - inputOffset) - throw new ArgumentOutOfRangeException(nameof(inputCount), SR.Cryptography_TransformBeyondEndOfBuffer); + throw new ArgumentOutOfRangeException(nameof(inputCount), SR.Argument_InvalidOffLen); if (outputBuffer == null) throw new ArgumentNullException(nameof(outputBuffer)); if (outputOffset > outputBuffer.Length) throw new ArgumentOutOfRangeException(nameof(outputOffset)); if (inputCount > outputBuffer.Length - outputOffset) - throw new ArgumentOutOfRangeException(nameof(outputOffset), SR.Cryptography_TransformBeyondEndOfBuffer); + throw new ArgumentOutOfRangeException(nameof(outputOffset), SR.Argument_InvalidOffLen); int numBytesWritten = UncheckedTransformBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset); Debug.Assert(numBytesWritten >= 0 && numBytesWritten <= inputCount); @@ -102,7 +102,7 @@ public byte[] TransformFinalBlock(byte[] inputBuffer, int inputOffset, int input if (inputOffset > inputBuffer.Length) throw new ArgumentOutOfRangeException(nameof(inputOffset)); if (inputCount > inputBuffer.Length - inputOffset) - throw new ArgumentOutOfRangeException(nameof(inputCount), SR.Cryptography_TransformBeyondEndOfBuffer); + throw new ArgumentOutOfRangeException(nameof(inputCount), SR.Argument_InvalidOffLen); byte[] output = UncheckedTransformFinalBlock(inputBuffer, inputOffset, inputCount); return output; diff --git a/src/libraries/Common/src/System/Security/Cryptography/ECDsaSecurityTransforms.cs b/src/libraries/Common/src/System/Security/Cryptography/ECDsaSecurityTransforms.cs index 431e6da9657ecd..60ac9390a9d0a6 100644 --- a/src/libraries/Common/src/System/Security/Cryptography/ECDsaSecurityTransforms.cs +++ b/src/libraries/Common/src/System/Security/Cryptography/ECDsaSecurityTransforms.cs @@ -13,7 +13,7 @@ public partial class ECDsa : AsymmetricAlgorithm /// /// Creates an instance of the platform specific implementation of the cref="ECDsa" algorithm. /// - public static new ECDsa Create() + public static new partial ECDsa Create() { return new ECDsaImplementation.ECDsaSecurityTransforms(); } @@ -24,7 +24,7 @@ public partial class ECDsa : AsymmetricAlgorithm /// /// The representing the elliptic curve. /// - public static ECDsa Create(ECCurve curve) + public static partial ECDsa Create(ECCurve curve) { ECDsa ecdsa = Create(); ecdsa.GenerateKey(curve); @@ -37,7 +37,7 @@ public static ECDsa Create(ECCurve curve) /// /// The representing the elliptic curve parameters. /// - public static ECDsa Create(ECParameters parameters) + public static partial ECDsa Create(ECParameters parameters) { ECDsa ecdsa = Create(); ecdsa.ImportParameters(parameters); diff --git a/src/libraries/Common/src/System/Security/Cryptography/HashOneShotHelpers.cs b/src/libraries/Common/src/System/Security/Cryptography/HashOneShotHelpers.cs index 95c39e02acb0c8..22fff97677f615 100644 --- a/src/libraries/Common/src/System/Security/Cryptography/HashOneShotHelpers.cs +++ b/src/libraries/Common/src/System/Security/Cryptography/HashOneShotHelpers.cs @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Diagnostics; +using Internal.Cryptography; namespace System.Security.Cryptography { @@ -15,25 +15,28 @@ public static int MacData( ReadOnlySpan source, Span destination) { - if (hashAlgorithm == HashAlgorithmName.SHA256) + if (Helpers.HasHMAC) { - return HMACSHA256.HashData(key, source, destination); - } - else if (hashAlgorithm == HashAlgorithmName.SHA1) - { - return HMACSHA1.HashData(key, source, destination); - } - else if (hashAlgorithm == HashAlgorithmName.SHA512) - { - return HMACSHA512.HashData(key, source, destination); - } - else if (hashAlgorithm == HashAlgorithmName.SHA384) - { - return HMACSHA384.HashData(key, source, destination); - } - else if (hashAlgorithm == HashAlgorithmName.MD5) - { - return HMACMD5.HashData(key, source, destination); + if (hashAlgorithm == HashAlgorithmName.SHA256) + { + return HMACSHA256.HashData(key, source, destination); + } + else if (hashAlgorithm == HashAlgorithmName.SHA1) + { + return HMACSHA1.HashData(key, source, destination); + } + else if (hashAlgorithm == HashAlgorithmName.SHA512) + { + return HMACSHA512.HashData(key, source, destination); + } + else if (hashAlgorithm == HashAlgorithmName.SHA384) + { + return HMACSHA384.HashData(key, source, destination); + } + else if (hashAlgorithm == HashAlgorithmName.MD5) + { + return HMACMD5.HashData(key, source, destination); + } } throw new CryptographicException(SR.Format(SR.Cryptography_UnknownHashAlgorithm, hashAlgorithm.Name)); diff --git a/src/libraries/Common/src/System/Security/Cryptography/PasswordBasedEncryption.cs b/src/libraries/Common/src/System/Security/Cryptography/PasswordBasedEncryption.cs index dc1fd465acfe3b..c391e8323351ac 100644 --- a/src/libraries/Common/src/System/Security/Cryptography/PasswordBasedEncryption.cs +++ b/src/libraries/Common/src/System/Security/Cryptography/PasswordBasedEncryption.cs @@ -74,6 +74,14 @@ internal static unsafe int Decrypt( { Debug.Assert(destination.Length >= encryptedData.Length); + if (!Helpers.HasSymmetricEncryption) + { + throw new CryptographicException( + SR.Format( + SR.Cryptography_UnknownAlgorithmIdentifier, + algorithmIdentifier.Algorithm)); + } + // Don't check that algorithmIdentifier.Parameters is set here. // Maybe some future PBES3 will have one with a default. @@ -229,6 +237,14 @@ internal static void InitiateEncryption( { Debug.Assert(pbeParameters != null); + if (!Helpers.HasSymmetricEncryption) + { + throw new CryptographicException( + SR.Format( + SR.Cryptography_UnknownAlgorithmIdentifier, + pbeParameters.EncryptionAlgorithm)); + } + isPkcs12 = false; switch (pbeParameters.EncryptionAlgorithm) @@ -258,7 +274,7 @@ internal static void InitiateEncryption( throw new CryptographicException( SR.Format( SR.Cryptography_UnknownAlgorithmIdentifier, - pbeParameters.HashAlgorithm.Name)); + pbeParameters.EncryptionAlgorithm)); } HashAlgorithmName prf = pbeParameters.HashAlgorithm; @@ -377,6 +393,12 @@ internal static unsafe int Encrypt( Debug.Assert(pwdTmpBytes!.Length == 0); } + if (!Helpers.HasHMAC) + { + throw new CryptographicException( + SR.Format(SR.Cryptography_AlgorithmNotSupported, "HMAC" + prf.Name)); + } + using (var pbkdf2 = new Rfc2898DeriveBytes(pwdTmpBytes, salt.ToArray(), iterationCount, prf)) { derivedKey = pbkdf2.GetBytes(keySizeBytes); @@ -518,6 +540,8 @@ private static unsafe int Pbes2Decrypt( Rfc2898DeriveBytes pbkdf2 = OpenPbkdf2(password, pbes2Params.KeyDerivationFunc.Parameters, out int? requestedKeyLength); + Debug.Assert(Helpers.HasHMAC); + using (pbkdf2) { // The biggest block size (for IV) we support is AES (128-bit / 16 byte) @@ -556,6 +580,12 @@ private static SymmetricAlgorithm OpenCipher( { string? algId = encryptionScheme.Algorithm; + if (!Helpers.HasSymmetricEncryption) + { + throw new CryptographicException( + SR.Format(SR.Cryptography_AlgorithmNotSupported, algId)); + } + if (algId == Oids.Aes128Cbc || algId == Oids.Aes192Cbc || algId == Oids.Aes256Cbc) @@ -747,6 +777,12 @@ private static unsafe Rfc2898DeriveBytes OpenPbkdf2( throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding); } + if (!Helpers.HasHMAC) + { + throw new CryptographicException( + SR.Format(SR.Cryptography_AlgorithmNotSupported, "HMAC" + prf.Name)); + } + int iterationCount = NormalizeIterationCount(pbkdf2Params.IterationCount); ReadOnlyMemory saltMemory = pbkdf2Params.Salt.Specified.Value; diff --git a/src/libraries/Common/src/System/Security/Cryptography/RSAOpenSsl.cs b/src/libraries/Common/src/System/Security/Cryptography/RSAOpenSsl.cs index aab2a5a5fb8225..f80a641a98f019 100644 --- a/src/libraries/Common/src/System/Security/Cryptography/RSAOpenSsl.cs +++ b/src/libraries/Common/src/System/Security/Cryptography/RSAOpenSsl.cs @@ -14,7 +14,7 @@ namespace System.Security.Cryptography #if INTERNAL_ASYMMETRIC_IMPLEMENTATIONS public partial class RSA : AsymmetricAlgorithm { - public static new RSA Create() => new RSAImplementation.RSAOpenSsl(); + public static new partial RSA Create() => new RSAImplementation.RSAOpenSsl(); } internal static partial class RSAImplementation diff --git a/src/libraries/Common/src/System/Security/Cryptography/RSASecurityTransforms.cs b/src/libraries/Common/src/System/Security/Cryptography/RSASecurityTransforms.cs index 9c02118e27ed00..29ce858255e768 100644 --- a/src/libraries/Common/src/System/Security/Cryptography/RSASecurityTransforms.cs +++ b/src/libraries/Common/src/System/Security/Cryptography/RSASecurityTransforms.cs @@ -16,7 +16,7 @@ namespace System.Security.Cryptography #if INTERNAL_ASYMMETRIC_IMPLEMENTATIONS public partial class RSA : AsymmetricAlgorithm { - public static new RSA Create() + public static new partial RSA Create() { return new RSAImplementation.RSASecurityTransforms(); } diff --git a/src/libraries/System.DirectoryServices/src/System.DirectoryServices.csproj b/src/libraries/System.DirectoryServices/src/System.DirectoryServices.csproj index 74b52350cf0f4b..39d6ef2c2db507 100644 --- a/src/libraries/System.DirectoryServices/src/System.DirectoryServices.csproj +++ b/src/libraries/System.DirectoryServices/src/System.DirectoryServices.csproj @@ -182,6 +182,9 @@ System.DirectoryServices.ActiveDirectory.DomainController + + + diff --git a/src/libraries/System.Net.WebSockets/src/System.Net.WebSockets.csproj b/src/libraries/System.Net.WebSockets/src/System.Net.WebSockets.csproj index aef4cc97af217f..d1983aa0c10b9a 100644 --- a/src/libraries/System.Net.WebSockets/src/System.Net.WebSockets.csproj +++ b/src/libraries/System.Net.WebSockets/src/System.Net.WebSockets.csproj @@ -51,7 +51,7 @@ - + diff --git a/src/libraries/System.Security.Cryptography.Algorithms/ref/System.Security.Cryptography.Algorithms.Forwards.cs b/src/libraries/System.Security.Cryptography.Algorithms/ref/System.Security.Cryptography.Algorithms.Forwards.cs index 5ba332dfd77fd0..5e138286de8e05 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/ref/System.Security.Cryptography.Algorithms.Forwards.cs +++ b/src/libraries/System.Security.Cryptography.Algorithms/ref/System.Security.Cryptography.Algorithms.Forwards.cs @@ -4,4 +4,63 @@ // Changes to this file must follow the https://aka.ms/api-review process. // ------------------------------------------------------------------------------ +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.Aes))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.AesCcm))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.AesGcm))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.AesManaged))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.AsymmetricKeyExchangeDeformatter))] [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.AsymmetricKeyExchangeFormatter))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.AsymmetricSignatureDeformatter))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.AsymmetricSignatureFormatter))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.ChaCha20Poly1305))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.CryptoConfig))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.DES))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.DSA))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.DSAParameters))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.DSASignatureDeformatter))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.DSASignatureFormat))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.DSASignatureFormatter))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.DeriveBytes))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.ECCurve))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.ECDiffieHellman))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.ECDiffieHellmanPublicKey))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.ECDsa))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.ECParameters))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.ECPoint))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.HKDF))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.HMACMD5))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.HMACSHA1))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.HMACSHA256))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.HMACSHA384))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.HMACSHA512))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.IncrementalHash))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.MD5))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.MaskGenerationMethod))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.PKCS1MaskGenerationMethod))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.RC2))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.RSA))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.RSAEncryptionPadding))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.RSAEncryptionPaddingMode))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.RSAOAEPKeyExchangeDeformatter))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.RSAOAEPKeyExchangeFormatter))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.RSAPKCS1KeyExchangeDeformatter))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.RSAPKCS1KeyExchangeFormatter))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.RSAPKCS1SignatureDeformatter))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.RSAPKCS1SignatureFormatter))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.RSAParameters))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.RSASignaturePadding))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.RSASignaturePaddingMode))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.RandomNumberGenerator))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.Rfc2898DeriveBytes))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.Rijndael))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.RijndaelManaged))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.SHA1))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.SHA1Managed))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.SHA256))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.SHA256Managed))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.SHA384))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.SHA384Managed))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.SHA512))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.SHA512Managed))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.SignatureDescription))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Cryptography.TripleDES))] diff --git a/src/libraries/System.Security.Cryptography.Algorithms/ref/System.Security.Cryptography.Algorithms.cs b/src/libraries/System.Security.Cryptography.Algorithms/ref/System.Security.Cryptography.Algorithms.cs deleted file mode 100644 index 86b9871075b1fd..00000000000000 --- a/src/libraries/System.Security.Cryptography.Algorithms/ref/System.Security.Cryptography.Algorithms.cs +++ /dev/null @@ -1,964 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// ------------------------------------------------------------------------------ -// Changes to this file must follow the https://aka.ms/api-review process. -// ------------------------------------------------------------------------------ - -namespace System.Security.Cryptography -{ - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] - public abstract partial class Aes : System.Security.Cryptography.SymmetricAlgorithm - { - protected Aes() { } - public static new System.Security.Cryptography.Aes Create() { throw null; } - [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")] - public static new System.Security.Cryptography.Aes? Create(string algorithmName) { throw null; } - } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] - public sealed partial class AesCcm : System.IDisposable - { - public AesCcm(byte[] key) { } - public AesCcm(System.ReadOnlySpan key) { } - public static bool IsSupported { get { throw null; } } - public static System.Security.Cryptography.KeySizes NonceByteSizes { get { throw null; } } - public static System.Security.Cryptography.KeySizes TagByteSizes { get { throw null; } } - public void Decrypt(byte[] nonce, byte[] ciphertext, byte[] tag, byte[] plaintext, byte[]? associatedData = null) { } - public void Decrypt(System.ReadOnlySpan nonce, System.ReadOnlySpan ciphertext, System.ReadOnlySpan tag, System.Span plaintext, System.ReadOnlySpan associatedData = default(System.ReadOnlySpan)) { } - public void Dispose() { } - public void Encrypt(byte[] nonce, byte[] plaintext, byte[] ciphertext, byte[] tag, byte[]? associatedData = null) { } - public void Encrypt(System.ReadOnlySpan nonce, System.ReadOnlySpan plaintext, System.Span ciphertext, System.Span tag, System.ReadOnlySpan associatedData = default(System.ReadOnlySpan)) { } - } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] - public sealed partial class AesGcm : System.IDisposable - { - public AesGcm(byte[] key) { } - public AesGcm(System.ReadOnlySpan key) { } - public static bool IsSupported { get { throw null; } } - public static System.Security.Cryptography.KeySizes NonceByteSizes { get { throw null; } } - public static System.Security.Cryptography.KeySizes TagByteSizes { get { throw null; } } - public void Decrypt(byte[] nonce, byte[] ciphertext, byte[] tag, byte[] plaintext, byte[]? associatedData = null) { } - public void Decrypt(System.ReadOnlySpan nonce, System.ReadOnlySpan ciphertext, System.ReadOnlySpan tag, System.Span plaintext, System.ReadOnlySpan associatedData = default(System.ReadOnlySpan)) { } - public void Dispose() { } - public void Encrypt(byte[] nonce, byte[] plaintext, byte[] ciphertext, byte[] tag, byte[]? associatedData = null) { } - public void Encrypt(System.ReadOnlySpan nonce, System.ReadOnlySpan plaintext, System.Span ciphertext, System.Span tag, System.ReadOnlySpan associatedData = default(System.ReadOnlySpan)) { } - } - [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the base type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] - public sealed partial class AesManaged : System.Security.Cryptography.Aes - { - public AesManaged() { } - public override int BlockSize { get { throw null; } set { } } - public override int FeedbackSize { get { throw null; } set { } } - public override byte[] IV { get { throw null; } set { } } - public override byte[] Key { get { throw null; } set { } } - public override int KeySize { get { throw null; } set { } } - public override System.Security.Cryptography.KeySizes[] LegalBlockSizes { get { throw null; } } - public override System.Security.Cryptography.KeySizes[] LegalKeySizes { get { throw null; } } - public override System.Security.Cryptography.CipherMode Mode { get { throw null; } set { } } - public override System.Security.Cryptography.PaddingMode Padding { get { throw null; } set { } } - public override System.Security.Cryptography.ICryptoTransform CreateDecryptor() { throw null; } - public override System.Security.Cryptography.ICryptoTransform CreateDecryptor(byte[] rgbKey, byte[]? rgbIV) { throw null; } - public override System.Security.Cryptography.ICryptoTransform CreateEncryptor() { throw null; } - public override System.Security.Cryptography.ICryptoTransform CreateEncryptor(byte[] rgbKey, byte[]? rgbIV) { throw null; } - protected override void Dispose(bool disposing) { } - public override void GenerateIV() { } - public override void GenerateKey() { } - } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] - public abstract partial class AsymmetricKeyExchangeDeformatter - { - protected AsymmetricKeyExchangeDeformatter() { } - public abstract string? Parameters { get; set; } - public abstract byte[] DecryptKeyExchange(byte[] rgb); - public abstract void SetKey(System.Security.Cryptography.AsymmetricAlgorithm key); - } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] - public abstract partial class AsymmetricSignatureDeformatter - { - protected AsymmetricSignatureDeformatter() { } - public abstract void SetHashAlgorithm(string strName); - public abstract void SetKey(System.Security.Cryptography.AsymmetricAlgorithm key); - public abstract bool VerifySignature(byte[] rgbHash, byte[] rgbSignature); - public virtual bool VerifySignature(System.Security.Cryptography.HashAlgorithm hash, byte[] rgbSignature) { throw null; } - } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] - public abstract partial class AsymmetricSignatureFormatter - { - protected AsymmetricSignatureFormatter() { } - public abstract byte[] CreateSignature(byte[] rgbHash); - public virtual byte[] CreateSignature(System.Security.Cryptography.HashAlgorithm hash) { throw null; } - public abstract void SetHashAlgorithm(string strName); - public abstract void SetKey(System.Security.Cryptography.AsymmetricAlgorithm key); - } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] - public sealed partial class ChaCha20Poly1305 : System.IDisposable - { - public ChaCha20Poly1305(byte[] key) { } - public ChaCha20Poly1305(System.ReadOnlySpan key) { } - public static bool IsSupported { get { throw null; } } - public void Decrypt(byte[] nonce, byte[] ciphertext, byte[] tag, byte[] plaintext, byte[]? associatedData = null) { } - public void Decrypt(System.ReadOnlySpan nonce, System.ReadOnlySpan ciphertext, System.ReadOnlySpan tag, System.Span plaintext, System.ReadOnlySpan associatedData = default(System.ReadOnlySpan)) { } - public void Dispose() { } - public void Encrypt(byte[] nonce, byte[] plaintext, byte[] ciphertext, byte[] tag, byte[]? associatedData = null) { } - public void Encrypt(System.ReadOnlySpan nonce, System.ReadOnlySpan plaintext, System.Span ciphertext, System.Span tag, System.ReadOnlySpan associatedData = default(System.ReadOnlySpan)) { } - } - public partial class CryptoConfig - { - public CryptoConfig() { } - public static bool AllowOnlyFipsAlgorithms { get { throw null; } } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] - public static void AddAlgorithm(System.Type algorithm, params string[] names) { } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] - public static void AddOID(string oid, params string[] names) { } - [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")] - public static object? CreateFromName(string name) { throw null; } - [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")] - public static object? CreateFromName(string name, params object?[]? args) { throw null; } - [System.ObsoleteAttribute("EncodeOID is obsolete. Use the ASN.1 functionality provided in System.Formats.Asn1.", DiagnosticId = "SYSLIB0031", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] - public static byte[] EncodeOID(string str) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] - public static string? MapNameToOID(string name) { throw null; } - } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] - public abstract partial class DeriveBytes : System.IDisposable - { - protected DeriveBytes() { } - public void Dispose() { } - protected virtual void Dispose(bool disposing) { } - public abstract byte[] GetBytes(int cb); - public abstract void Reset(); - } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] - public abstract partial class DES : System.Security.Cryptography.SymmetricAlgorithm - { - protected DES() { } - public override byte[] Key { get { throw null; } set { } } - public static new System.Security.Cryptography.DES Create() { throw null; } - [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")] - public static new System.Security.Cryptography.DES? Create(string algName) { throw null; } - public static bool IsSemiWeakKey(byte[] rgbKey) { throw null; } - public static bool IsWeakKey(byte[] rgbKey) { throw null; } - } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] - public abstract partial class DSA : System.Security.Cryptography.AsymmetricAlgorithm - { - protected DSA() { } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] - public static new System.Security.Cryptography.DSA Create() { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] - public static System.Security.Cryptography.DSA Create(int keySizeInBits) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] - public static System.Security.Cryptography.DSA Create(System.Security.Cryptography.DSAParameters parameters) { throw null; } - [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")] - public static new System.Security.Cryptography.DSA? Create(string algName) { throw null; } - public abstract byte[] CreateSignature(byte[] rgbHash); - public byte[] CreateSignature(byte[] rgbHash, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } - protected virtual byte[] CreateSignatureCore(System.ReadOnlySpan hash, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } - public abstract System.Security.Cryptography.DSAParameters ExportParameters(bool includePrivateParameters); - public override void FromXmlString(string xmlString) { } - public int GetMaxSignatureSize(System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } - protected virtual byte[] HashData(byte[] data, int offset, int count, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { throw null; } - protected virtual byte[] HashData(System.IO.Stream data, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { throw null; } - public override void ImportEncryptedPkcs8PrivateKey(System.ReadOnlySpan passwordBytes, System.ReadOnlySpan source, out int bytesRead) { throw null; } - public override void ImportEncryptedPkcs8PrivateKey(System.ReadOnlySpan password, System.ReadOnlySpan source, out int bytesRead) { throw null; } - public override void ImportFromEncryptedPem(System.ReadOnlySpan input, System.ReadOnlySpan passwordBytes) { } - public override void ImportFromEncryptedPem(System.ReadOnlySpan input, System.ReadOnlySpan password) { } - public override void ImportFromPem(System.ReadOnlySpan input) { } - public abstract void ImportParameters(System.Security.Cryptography.DSAParameters parameters); - public override void ImportPkcs8PrivateKey(System.ReadOnlySpan source, out int bytesRead) { throw null; } - public override void ImportSubjectPublicKeyInfo(System.ReadOnlySpan source, out int bytesRead) { throw null; } - public virtual byte[] SignData(byte[] data, int offset, int count, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { throw null; } - public byte[] SignData(byte[] data, int offset, int count, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } - public byte[] SignData(byte[] data, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { throw null; } - public byte[] SignData(byte[] data, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } - public virtual byte[] SignData(System.IO.Stream data, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { throw null; } - public byte[] SignData(System.IO.Stream data, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } - protected virtual byte[] SignDataCore(System.IO.Stream data, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } - protected virtual byte[] SignDataCore(System.ReadOnlySpan data, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } - public override string ToXmlString(bool includePrivateParameters) { throw null; } - public virtual bool TryCreateSignature(System.ReadOnlySpan hash, System.Span destination, out int bytesWritten) { throw null; } - public bool TryCreateSignature(System.ReadOnlySpan hash, System.Span destination, System.Security.Cryptography.DSASignatureFormat signatureFormat, out int bytesWritten) { throw null; } - protected virtual bool TryCreateSignatureCore(System.ReadOnlySpan hash, System.Span destination, System.Security.Cryptography.DSASignatureFormat signatureFormat, out int bytesWritten) { throw null; } - public override bool TryExportEncryptedPkcs8PrivateKey(System.ReadOnlySpan passwordBytes, System.Security.Cryptography.PbeParameters pbeParameters, System.Span destination, out int bytesWritten) { throw null; } - public override bool TryExportEncryptedPkcs8PrivateKey(System.ReadOnlySpan password, System.Security.Cryptography.PbeParameters pbeParameters, System.Span destination, out int bytesWritten) { throw null; } - public override bool TryExportPkcs8PrivateKey(System.Span destination, out int bytesWritten) { throw null; } - public override bool TryExportSubjectPublicKeyInfo(System.Span destination, out int bytesWritten) { throw null; } - protected virtual bool TryHashData(System.ReadOnlySpan data, System.Span destination, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, out int bytesWritten) { throw null; } - public virtual bool TrySignData(System.ReadOnlySpan data, System.Span destination, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, out int bytesWritten) { throw null; } - public bool TrySignData(System.ReadOnlySpan data, System.Span destination, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat, out int bytesWritten) { throw null; } - protected virtual bool TrySignDataCore(System.ReadOnlySpan data, System.Span destination, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat, out int bytesWritten) { throw null; } - public bool VerifyData(byte[] data, byte[] signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { throw null; } - public bool VerifyData(byte[] data, byte[] signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } - public virtual bool VerifyData(byte[] data, int offset, int count, byte[] signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { throw null; } - public bool VerifyData(byte[] data, int offset, int count, byte[] signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } - public virtual bool VerifyData(System.IO.Stream data, byte[] signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { throw null; } - public bool VerifyData(System.IO.Stream data, byte[] signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } - public virtual bool VerifyData(System.ReadOnlySpan data, System.ReadOnlySpan signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { throw null; } - public bool VerifyData(System.ReadOnlySpan data, System.ReadOnlySpan signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } - protected virtual bool VerifyDataCore(System.IO.Stream data, System.ReadOnlySpan signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } - protected virtual bool VerifyDataCore(System.ReadOnlySpan data, System.ReadOnlySpan signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } - public abstract bool VerifySignature(byte[] rgbHash, byte[] rgbSignature); - public bool VerifySignature(byte[] rgbHash, byte[] rgbSignature, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } - public virtual bool VerifySignature(System.ReadOnlySpan hash, System.ReadOnlySpan signature) { throw null; } - public bool VerifySignature(System.ReadOnlySpan hash, System.ReadOnlySpan signature, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } - protected virtual bool VerifySignatureCore(System.ReadOnlySpan hash, System.ReadOnlySpan signature, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } - } - public partial struct DSAParameters - { - public int Counter; - public byte[]? G; - public byte[]? J; - public byte[]? P; - public byte[]? Q; - public byte[]? Seed; - public byte[]? X; - public byte[]? Y; - } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] - public partial class DSASignatureDeformatter : System.Security.Cryptography.AsymmetricSignatureDeformatter - { - public DSASignatureDeformatter() { } - public DSASignatureDeformatter(System.Security.Cryptography.AsymmetricAlgorithm key) { } - public override void SetHashAlgorithm(string strName) { } - public override void SetKey(System.Security.Cryptography.AsymmetricAlgorithm key) { } - public override bool VerifySignature(byte[] rgbHash, byte[] rgbSignature) { throw null; } - } - public enum DSASignatureFormat - { - IeeeP1363FixedFieldConcatenation = 0, - Rfc3279DerSequence = 1, - } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] - public partial class DSASignatureFormatter : System.Security.Cryptography.AsymmetricSignatureFormatter - { - public DSASignatureFormatter() { } - public DSASignatureFormatter(System.Security.Cryptography.AsymmetricAlgorithm key) { } - public override byte[] CreateSignature(byte[] rgbHash) { throw null; } - public override void SetHashAlgorithm(string strName) { } - public override void SetKey(System.Security.Cryptography.AsymmetricAlgorithm key) { } - } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] - public partial struct ECCurve - { - private object _dummy; - private int _dummyPrimitive; - public byte[]? A; - public byte[]? B; - public byte[]? Cofactor; - public System.Security.Cryptography.ECCurve.ECCurveType CurveType; - public System.Security.Cryptography.ECPoint G; - public System.Security.Cryptography.HashAlgorithmName? Hash; - public byte[]? Order; - public byte[]? Polynomial; - public byte[]? Prime; - public byte[]? Seed; - public bool IsCharacteristic2 { get { throw null; } } - public bool IsExplicit { get { throw null; } } - public bool IsNamed { get { throw null; } } - public bool IsPrime { get { throw null; } } - public System.Security.Cryptography.Oid Oid { get { throw null; } } - public static System.Security.Cryptography.ECCurve CreateFromFriendlyName(string oidFriendlyName) { throw null; } - public static System.Security.Cryptography.ECCurve CreateFromOid(System.Security.Cryptography.Oid curveOid) { throw null; } - public static System.Security.Cryptography.ECCurve CreateFromValue(string oidValue) { throw null; } - public void Validate() { } - public enum ECCurveType - { - Implicit = 0, - PrimeShortWeierstrass = 1, - PrimeTwistedEdwards = 2, - PrimeMontgomery = 3, - Characteristic2 = 4, - Named = 5, - } - public static partial class NamedCurves - { - public static System.Security.Cryptography.ECCurve brainpoolP160r1 { get { throw null; } } - public static System.Security.Cryptography.ECCurve brainpoolP160t1 { get { throw null; } } - public static System.Security.Cryptography.ECCurve brainpoolP192r1 { get { throw null; } } - public static System.Security.Cryptography.ECCurve brainpoolP192t1 { get { throw null; } } - public static System.Security.Cryptography.ECCurve brainpoolP224r1 { get { throw null; } } - public static System.Security.Cryptography.ECCurve brainpoolP224t1 { get { throw null; } } - public static System.Security.Cryptography.ECCurve brainpoolP256r1 { get { throw null; } } - public static System.Security.Cryptography.ECCurve brainpoolP256t1 { get { throw null; } } - public static System.Security.Cryptography.ECCurve brainpoolP320r1 { get { throw null; } } - public static System.Security.Cryptography.ECCurve brainpoolP320t1 { get { throw null; } } - public static System.Security.Cryptography.ECCurve brainpoolP384r1 { get { throw null; } } - public static System.Security.Cryptography.ECCurve brainpoolP384t1 { get { throw null; } } - public static System.Security.Cryptography.ECCurve brainpoolP512r1 { get { throw null; } } - public static System.Security.Cryptography.ECCurve brainpoolP512t1 { get { throw null; } } - public static System.Security.Cryptography.ECCurve nistP256 { get { throw null; } } - public static System.Security.Cryptography.ECCurve nistP384 { get { throw null; } } - public static System.Security.Cryptography.ECCurve nistP521 { get { throw null; } } - } - } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] - public abstract partial class ECDiffieHellman : System.Security.Cryptography.AsymmetricAlgorithm - { - protected ECDiffieHellman() { } - public override string KeyExchangeAlgorithm { get { throw null; } } - public abstract System.Security.Cryptography.ECDiffieHellmanPublicKey PublicKey { get; } - public override string? SignatureAlgorithm { get { throw null; } } - public static new System.Security.Cryptography.ECDiffieHellman Create() { throw null; } - public static System.Security.Cryptography.ECDiffieHellman Create(System.Security.Cryptography.ECCurve curve) { throw null; } - public static System.Security.Cryptography.ECDiffieHellman Create(System.Security.Cryptography.ECParameters parameters) { throw null; } - [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")] - public static new System.Security.Cryptography.ECDiffieHellman? Create(string algorithm) { throw null; } - public byte[] DeriveKeyFromHash(System.Security.Cryptography.ECDiffieHellmanPublicKey otherPartyPublicKey, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { throw null; } - public virtual byte[] DeriveKeyFromHash(System.Security.Cryptography.ECDiffieHellmanPublicKey otherPartyPublicKey, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, byte[]? secretPrepend, byte[]? secretAppend) { throw null; } - public byte[] DeriveKeyFromHmac(System.Security.Cryptography.ECDiffieHellmanPublicKey otherPartyPublicKey, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, byte[]? hmacKey) { throw null; } - public virtual byte[] DeriveKeyFromHmac(System.Security.Cryptography.ECDiffieHellmanPublicKey otherPartyPublicKey, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, byte[]? hmacKey, byte[]? secretPrepend, byte[]? secretAppend) { throw null; } - public virtual byte[] DeriveKeyMaterial(System.Security.Cryptography.ECDiffieHellmanPublicKey otherPartyPublicKey) { throw null; } - public virtual byte[] DeriveKeyTls(System.Security.Cryptography.ECDiffieHellmanPublicKey otherPartyPublicKey, byte[] prfLabel, byte[] prfSeed) { throw null; } - public virtual byte[] ExportECPrivateKey() { throw null; } - public virtual System.Security.Cryptography.ECParameters ExportExplicitParameters(bool includePrivateParameters) { throw null; } - public virtual System.Security.Cryptography.ECParameters ExportParameters(bool includePrivateParameters) { throw null; } - public override void FromXmlString(string xmlString) { } - public virtual void GenerateKey(System.Security.Cryptography.ECCurve curve) { } - public virtual void ImportECPrivateKey(System.ReadOnlySpan source, out int bytesRead) { throw null; } - public override void ImportEncryptedPkcs8PrivateKey(System.ReadOnlySpan passwordBytes, System.ReadOnlySpan source, out int bytesRead) { throw null; } - public override void ImportEncryptedPkcs8PrivateKey(System.ReadOnlySpan password, System.ReadOnlySpan source, out int bytesRead) { throw null; } - public override void ImportFromEncryptedPem(System.ReadOnlySpan input, System.ReadOnlySpan passwordBytes) { } - public override void ImportFromEncryptedPem(System.ReadOnlySpan input, System.ReadOnlySpan password) { } - public override void ImportFromPem(System.ReadOnlySpan input) { } - public virtual void ImportParameters(System.Security.Cryptography.ECParameters parameters) { } - public override void ImportPkcs8PrivateKey(System.ReadOnlySpan source, out int bytesRead) { throw null; } - public override void ImportSubjectPublicKeyInfo(System.ReadOnlySpan source, out int bytesRead) { throw null; } - public override string ToXmlString(bool includePrivateParameters) { throw null; } - public virtual bool TryExportECPrivateKey(System.Span destination, out int bytesWritten) { throw null; } - public override bool TryExportEncryptedPkcs8PrivateKey(System.ReadOnlySpan passwordBytes, System.Security.Cryptography.PbeParameters pbeParameters, System.Span destination, out int bytesWritten) { throw null; } - public override bool TryExportEncryptedPkcs8PrivateKey(System.ReadOnlySpan password, System.Security.Cryptography.PbeParameters pbeParameters, System.Span destination, out int bytesWritten) { throw null; } - public override bool TryExportPkcs8PrivateKey(System.Span destination, out int bytesWritten) { throw null; } - public override bool TryExportSubjectPublicKeyInfo(System.Span destination, out int bytesWritten) { throw null; } - } - public abstract partial class ECDiffieHellmanPublicKey : System.IDisposable - { - protected ECDiffieHellmanPublicKey() { } - protected ECDiffieHellmanPublicKey(byte[] keyBlob) { } - public void Dispose() { } - protected virtual void Dispose(bool disposing) { } - public virtual System.Security.Cryptography.ECParameters ExportExplicitParameters() { throw null; } - public virtual System.Security.Cryptography.ECParameters ExportParameters() { throw null; } - public virtual byte[] ExportSubjectPublicKeyInfo() { throw null; } - public virtual byte[] ToByteArray() { throw null; } - public virtual string ToXmlString() { throw null; } - public virtual bool TryExportSubjectPublicKeyInfo(System.Span destination, out int bytesWritten) { throw null; } - } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] - public abstract partial class ECDsa : System.Security.Cryptography.AsymmetricAlgorithm - { - protected ECDsa() { } - public override string? KeyExchangeAlgorithm { get { throw null; } } - public override string SignatureAlgorithm { get { throw null; } } - public static new System.Security.Cryptography.ECDsa Create() { throw null; } - public static System.Security.Cryptography.ECDsa Create(System.Security.Cryptography.ECCurve curve) { throw null; } - public static System.Security.Cryptography.ECDsa Create(System.Security.Cryptography.ECParameters parameters) { throw null; } - [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")] - public static new System.Security.Cryptography.ECDsa? Create(string algorithm) { throw null; } - public virtual byte[] ExportECPrivateKey() { throw null; } - public virtual System.Security.Cryptography.ECParameters ExportExplicitParameters(bool includePrivateParameters) { throw null; } - public virtual System.Security.Cryptography.ECParameters ExportParameters(bool includePrivateParameters) { throw null; } - public override void FromXmlString(string xmlString) { } - public virtual void GenerateKey(System.Security.Cryptography.ECCurve curve) { } - public int GetMaxSignatureSize(System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } - protected virtual byte[] HashData(byte[] data, int offset, int count, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { throw null; } - protected virtual byte[] HashData(System.IO.Stream data, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { throw null; } - public virtual void ImportECPrivateKey(System.ReadOnlySpan source, out int bytesRead) { throw null; } - public override void ImportEncryptedPkcs8PrivateKey(System.ReadOnlySpan passwordBytes, System.ReadOnlySpan source, out int bytesRead) { throw null; } - public override void ImportEncryptedPkcs8PrivateKey(System.ReadOnlySpan password, System.ReadOnlySpan source, out int bytesRead) { throw null; } - public override void ImportFromEncryptedPem(System.ReadOnlySpan input, System.ReadOnlySpan passwordBytes) { } - public override void ImportFromEncryptedPem(System.ReadOnlySpan input, System.ReadOnlySpan password) { } - public override void ImportFromPem(System.ReadOnlySpan input) { } - public virtual void ImportParameters(System.Security.Cryptography.ECParameters parameters) { } - public override void ImportPkcs8PrivateKey(System.ReadOnlySpan source, out int bytesRead) { throw null; } - public override void ImportSubjectPublicKeyInfo(System.ReadOnlySpan source, out int bytesRead) { throw null; } - public virtual byte[] SignData(byte[] data, int offset, int count, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { throw null; } - public byte[] SignData(byte[] data, int offset, int count, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } - public virtual byte[] SignData(byte[] data, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { throw null; } - public byte[] SignData(byte[] data, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } - public virtual byte[] SignData(System.IO.Stream data, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { throw null; } - public byte[] SignData(System.IO.Stream data, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } - protected virtual byte[] SignDataCore(System.IO.Stream data, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } - protected virtual byte[] SignDataCore(System.ReadOnlySpan data, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } - public abstract byte[] SignHash(byte[] hash); - public byte[] SignHash(byte[] hash, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } - protected virtual byte[] SignHashCore(System.ReadOnlySpan hash, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } - public override string ToXmlString(bool includePrivateParameters) { throw null; } - public virtual bool TryExportECPrivateKey(System.Span destination, out int bytesWritten) { throw null; } - public override bool TryExportEncryptedPkcs8PrivateKey(System.ReadOnlySpan passwordBytes, System.Security.Cryptography.PbeParameters pbeParameters, System.Span destination, out int bytesWritten) { throw null; } - public override bool TryExportEncryptedPkcs8PrivateKey(System.ReadOnlySpan password, System.Security.Cryptography.PbeParameters pbeParameters, System.Span destination, out int bytesWritten) { throw null; } - public override bool TryExportPkcs8PrivateKey(System.Span destination, out int bytesWritten) { throw null; } - public override bool TryExportSubjectPublicKeyInfo(System.Span destination, out int bytesWritten) { throw null; } - protected virtual bool TryHashData(System.ReadOnlySpan data, System.Span destination, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, out int bytesWritten) { throw null; } - public virtual bool TrySignData(System.ReadOnlySpan data, System.Span destination, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, out int bytesWritten) { throw null; } - public bool TrySignData(System.ReadOnlySpan data, System.Span destination, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat, out int bytesWritten) { throw null; } - protected virtual bool TrySignDataCore(System.ReadOnlySpan data, System.Span destination, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat, out int bytesWritten) { throw null; } - public virtual bool TrySignHash(System.ReadOnlySpan hash, System.Span destination, out int bytesWritten) { throw null; } - public bool TrySignHash(System.ReadOnlySpan hash, System.Span destination, System.Security.Cryptography.DSASignatureFormat signatureFormat, out int bytesWritten) { throw null; } - protected virtual bool TrySignHashCore(System.ReadOnlySpan hash, System.Span destination, System.Security.Cryptography.DSASignatureFormat signatureFormat, out int bytesWritten) { throw null; } - public bool VerifyData(byte[] data, byte[] signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { throw null; } - public bool VerifyData(byte[] data, byte[] signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } - public virtual bool VerifyData(byte[] data, int offset, int count, byte[] signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { throw null; } - public bool VerifyData(byte[] data, int offset, int count, byte[] signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } - public bool VerifyData(System.IO.Stream data, byte[] signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { throw null; } - public bool VerifyData(System.IO.Stream data, byte[] signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } - public virtual bool VerifyData(System.ReadOnlySpan data, System.ReadOnlySpan signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { throw null; } - public bool VerifyData(System.ReadOnlySpan data, System.ReadOnlySpan signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } - protected virtual bool VerifyDataCore(System.IO.Stream data, System.ReadOnlySpan signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } - protected virtual bool VerifyDataCore(System.ReadOnlySpan data, System.ReadOnlySpan signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } - public abstract bool VerifyHash(byte[] hash, byte[] signature); - public bool VerifyHash(byte[] hash, byte[] signature, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } - public virtual bool VerifyHash(System.ReadOnlySpan hash, System.ReadOnlySpan signature) { throw null; } - public bool VerifyHash(System.ReadOnlySpan hash, System.ReadOnlySpan signature, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } - protected virtual bool VerifyHashCore(System.ReadOnlySpan hash, System.ReadOnlySpan signature, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } - } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] - public partial struct ECParameters - { - public System.Security.Cryptography.ECCurve Curve; - public byte[]? D; - public System.Security.Cryptography.ECPoint Q; - public void Validate() { } - } - public partial struct ECPoint - { - public byte[]? X; - public byte[]? Y; - } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] - public static partial class HKDF - { - public static byte[] DeriveKey(System.Security.Cryptography.HashAlgorithmName hashAlgorithmName, byte[] ikm, int outputLength, byte[]? salt = null, byte[]? info = null) { throw null; } - public static void DeriveKey(System.Security.Cryptography.HashAlgorithmName hashAlgorithmName, System.ReadOnlySpan ikm, System.Span output, System.ReadOnlySpan salt, System.ReadOnlySpan info) { } - public static byte[] Expand(System.Security.Cryptography.HashAlgorithmName hashAlgorithmName, byte[] prk, int outputLength, byte[]? info = null) { throw null; } - public static void Expand(System.Security.Cryptography.HashAlgorithmName hashAlgorithmName, System.ReadOnlySpan prk, System.Span output, System.ReadOnlySpan info) { } - public static byte[] Extract(System.Security.Cryptography.HashAlgorithmName hashAlgorithmName, byte[] ikm, byte[]? salt = null) { throw null; } - public static int Extract(System.Security.Cryptography.HashAlgorithmName hashAlgorithmName, System.ReadOnlySpan ikm, System.ReadOnlySpan salt, System.Span prk) { throw null; } - } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] - public partial class HMACMD5 : System.Security.Cryptography.HMAC - { - public HMACMD5() { } - public HMACMD5(byte[] key) { } - public override byte[] Key { get { throw null; } set { } } - protected override void Dispose(bool disposing) { } - protected override void HashCore(byte[] rgb, int ib, int cb) { } - protected override void HashCore(System.ReadOnlySpan source) { } - public static byte[] HashData(byte[] key, byte[] source) { throw null; } - public static byte[] HashData(System.ReadOnlySpan key, System.ReadOnlySpan source) { throw null; } - public static int HashData(System.ReadOnlySpan key, System.ReadOnlySpan source, System.Span destination) { throw null; } - protected override byte[] HashFinal() { throw null; } - public override void Initialize() { } - public static bool TryHashData(System.ReadOnlySpan key, System.ReadOnlySpan source, System.Span destination, out int bytesWritten) { throw null; } - protected override bool TryHashFinal(System.Span destination, out int bytesWritten) { throw null; } - } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] - public partial class HMACSHA1 : System.Security.Cryptography.HMAC - { - public HMACSHA1() { } - public HMACSHA1(byte[] key) { } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - [System.ObsoleteAttribute("HMACSHA1 always uses the algorithm implementation provided by the platform. Use a constructor without the useManagedSha1 parameter.", DiagnosticId = "SYSLIB0030", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] - public HMACSHA1(byte[] key, bool useManagedSha1) { } - public override byte[] Key { get { throw null; } set { } } - protected override void Dispose(bool disposing) { } - protected override void HashCore(byte[] rgb, int ib, int cb) { } - protected override void HashCore(System.ReadOnlySpan source) { } - public static byte[] HashData(byte[] key, byte[] source) { throw null; } - public static byte[] HashData(System.ReadOnlySpan key, System.ReadOnlySpan source) { throw null; } - public static int HashData(System.ReadOnlySpan key, System.ReadOnlySpan source, System.Span destination) { throw null; } - protected override byte[] HashFinal() { throw null; } - public override void Initialize() { } - public static bool TryHashData(System.ReadOnlySpan key, System.ReadOnlySpan source, System.Span destination, out int bytesWritten) { throw null; } - protected override bool TryHashFinal(System.Span destination, out int bytesWritten) { throw null; } - } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] - public partial class HMACSHA256 : System.Security.Cryptography.HMAC - { - public HMACSHA256() { } - public HMACSHA256(byte[] key) { } - public override byte[] Key { get { throw null; } set { } } - protected override void Dispose(bool disposing) { } - protected override void HashCore(byte[] rgb, int ib, int cb) { } - protected override void HashCore(System.ReadOnlySpan source) { } - public static byte[] HashData(byte[] key, byte[] source) { throw null; } - public static byte[] HashData(System.ReadOnlySpan key, System.ReadOnlySpan source) { throw null; } - public static int HashData(System.ReadOnlySpan key, System.ReadOnlySpan source, System.Span destination) { throw null; } - protected override byte[] HashFinal() { throw null; } - public override void Initialize() { } - public static bool TryHashData(System.ReadOnlySpan key, System.ReadOnlySpan source, System.Span destination, out int bytesWritten) { throw null; } - protected override bool TryHashFinal(System.Span destination, out int bytesWritten) { throw null; } - } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] - public partial class HMACSHA384 : System.Security.Cryptography.HMAC - { - public HMACSHA384() { } - public HMACSHA384(byte[] key) { } - public override byte[] Key { get { throw null; } set { } } - [System.ObsoleteAttribute("ProduceLegacyHmacValues is obsolete. Producing legacy HMAC values is not supported.", DiagnosticId = "SYSLIB0029", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] - public bool ProduceLegacyHmacValues { get { throw null; } set { } } - protected override void Dispose(bool disposing) { } - protected override void HashCore(byte[] rgb, int ib, int cb) { } - protected override void HashCore(System.ReadOnlySpan source) { } - public static byte[] HashData(byte[] key, byte[] source) { throw null; } - public static byte[] HashData(System.ReadOnlySpan key, System.ReadOnlySpan source) { throw null; } - public static int HashData(System.ReadOnlySpan key, System.ReadOnlySpan source, System.Span destination) { throw null; } - protected override byte[] HashFinal() { throw null; } - public override void Initialize() { } - public static bool TryHashData(System.ReadOnlySpan key, System.ReadOnlySpan source, System.Span destination, out int bytesWritten) { throw null; } - protected override bool TryHashFinal(System.Span destination, out int bytesWritten) { throw null; } - } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] - public partial class HMACSHA512 : System.Security.Cryptography.HMAC - { - public HMACSHA512() { } - public HMACSHA512(byte[] key) { } - public override byte[] Key { get { throw null; } set { } } - [System.ObsoleteAttribute("ProduceLegacyHmacValues is obsolete. Producing legacy HMAC values is not supported.", DiagnosticId = "SYSLIB0029", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] - public bool ProduceLegacyHmacValues { get { throw null; } set { } } - protected override void Dispose(bool disposing) { } - protected override void HashCore(byte[] rgb, int ib, int cb) { } - protected override void HashCore(System.ReadOnlySpan source) { } - public static byte[] HashData(byte[] key, byte[] source) { throw null; } - public static byte[] HashData(System.ReadOnlySpan key, System.ReadOnlySpan source) { throw null; } - public static int HashData(System.ReadOnlySpan key, System.ReadOnlySpan source, System.Span destination) { throw null; } - protected override byte[] HashFinal() { throw null; } - public override void Initialize() { } - public static bool TryHashData(System.ReadOnlySpan key, System.ReadOnlySpan source, System.Span destination, out int bytesWritten) { throw null; } - protected override bool TryHashFinal(System.Span destination, out int bytesWritten) { throw null; } - } - public sealed partial class IncrementalHash : System.IDisposable - { - internal IncrementalHash() { } - public System.Security.Cryptography.HashAlgorithmName AlgorithmName { get { throw null; } } - public int HashLengthInBytes { get { throw null; } } - public void AppendData(byte[] data) { } - public void AppendData(byte[] data, int offset, int count) { } - public void AppendData(System.ReadOnlySpan data) { } - public static System.Security.Cryptography.IncrementalHash CreateHash(System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] - public static System.Security.Cryptography.IncrementalHash CreateHMAC(System.Security.Cryptography.HashAlgorithmName hashAlgorithm, byte[] key) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] - public static System.Security.Cryptography.IncrementalHash CreateHMAC(System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.ReadOnlySpan key) { throw null; } - public void Dispose() { } - public byte[] GetCurrentHash() { throw null; } - public int GetCurrentHash(System.Span destination) { throw null; } - public byte[] GetHashAndReset() { throw null; } - public int GetHashAndReset(System.Span destination) { throw null; } - public bool TryGetCurrentHash(System.Span destination, out int bytesWritten) { throw null; } - public bool TryGetHashAndReset(System.Span destination, out int bytesWritten) { throw null; } - } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] - public abstract partial class MaskGenerationMethod - { - protected MaskGenerationMethod() { } - public abstract byte[] GenerateMask(byte[] rgbSeed, int cbReturn); - } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] - public abstract partial class MD5 : System.Security.Cryptography.HashAlgorithm - { - protected MD5() { } - public static new System.Security.Cryptography.MD5 Create() { throw null; } - [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")] - public static new System.Security.Cryptography.MD5? Create(string algName) { throw null; } - public static byte[] HashData(byte[] source) { throw null; } - public static byte[] HashData(System.ReadOnlySpan source) { throw null; } - public static int HashData(System.ReadOnlySpan source, System.Span destination) { throw null; } - public static bool TryHashData(System.ReadOnlySpan source, System.Span destination, out int bytesWritten) { throw null; } - } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] - public partial class PKCS1MaskGenerationMethod : System.Security.Cryptography.MaskGenerationMethod - { - [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("PKCS1MaskGenerationMethod is not trim compatible because the algorithm implementation referenced by HashName might be removed.")] - public PKCS1MaskGenerationMethod() { } - public string HashName { get { throw null; } set { } } - public override byte[] GenerateMask(byte[] rgbSeed, int cbReturn) { throw null; } - } - public abstract partial class RandomNumberGenerator : System.IDisposable - { - protected RandomNumberGenerator() { } - public static System.Security.Cryptography.RandomNumberGenerator Create() { throw null; } - [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] - public static System.Security.Cryptography.RandomNumberGenerator? Create(string rngName) { throw null; } - public void Dispose() { } - protected virtual void Dispose(bool disposing) { } - public static void Fill(System.Span data) { } - public abstract void GetBytes(byte[] data); - public virtual void GetBytes(byte[] data, int offset, int count) { } - public static byte[] GetBytes(int count) { throw null; } - public virtual void GetBytes(System.Span data) { } - public static int GetInt32(int toExclusive) { throw null; } - public static int GetInt32(int fromInclusive, int toExclusive) { throw null; } - public virtual void GetNonZeroBytes(byte[] data) { } - public virtual void GetNonZeroBytes(System.Span data) { } - } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] - public abstract partial class RC2 : System.Security.Cryptography.SymmetricAlgorithm - { - protected int EffectiveKeySizeValue; - protected RC2() { } - public virtual int EffectiveKeySize { get { throw null; } set { } } - public override int KeySize { get { throw null; } set { } } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - public static new System.Security.Cryptography.RC2 Create() { throw null; } - [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")] - public static new System.Security.Cryptography.RC2? Create(string AlgName) { throw null; } - } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] - public partial class Rfc2898DeriveBytes : System.Security.Cryptography.DeriveBytes - { - public Rfc2898DeriveBytes(byte[] password, byte[] salt, int iterations) { } - public Rfc2898DeriveBytes(byte[] password, byte[] salt, int iterations, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { } - public Rfc2898DeriveBytes(string password, byte[] salt) { } - public Rfc2898DeriveBytes(string password, byte[] salt, int iterations) { } - public Rfc2898DeriveBytes(string password, byte[] salt, int iterations, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { } - public Rfc2898DeriveBytes(string password, int saltSize) { } - public Rfc2898DeriveBytes(string password, int saltSize, int iterations) { } - public Rfc2898DeriveBytes(string password, int saltSize, int iterations, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { } - public System.Security.Cryptography.HashAlgorithmName HashAlgorithm { get { throw null; } } - public int IterationCount { get { throw null; } set { } } - public byte[] Salt { get { throw null; } set { } } - [System.ObsoleteAttribute("Rfc2898DeriveBytes.CryptDeriveKey is obsolete and is not supported. Use PasswordDeriveBytes.CryptDeriveKey instead.", DiagnosticId = "SYSLIB0033", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] - public byte[] CryptDeriveKey(string algname, string alghashname, int keySize, byte[] rgbIV) { throw null; } - protected override void Dispose(bool disposing) { } - public override byte[] GetBytes(int cb) { throw null; } - public static byte[] Pbkdf2(byte[] password, byte[] salt, int iterations, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, int outputLength) { throw null; } - public static byte[] Pbkdf2(System.ReadOnlySpan password, System.ReadOnlySpan salt, int iterations, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, int outputLength) { throw null; } - public static void Pbkdf2(System.ReadOnlySpan password, System.ReadOnlySpan salt, System.Span destination, int iterations, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { } - public static byte[] Pbkdf2(System.ReadOnlySpan password, System.ReadOnlySpan salt, int iterations, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, int outputLength) { throw null; } - public static void Pbkdf2(System.ReadOnlySpan password, System.ReadOnlySpan salt, System.Span destination, int iterations, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { } - public static byte[] Pbkdf2(string password, byte[] salt, int iterations, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, int outputLength) { throw null; } - public override void Reset() { } - } - [System.ObsoleteAttribute("The Rijndael and RijndaelManaged types are obsolete. Use Aes instead.", DiagnosticId = "SYSLIB0022", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] - public abstract partial class Rijndael : System.Security.Cryptography.SymmetricAlgorithm - { - protected Rijndael() { } - public static new System.Security.Cryptography.Rijndael Create() { throw null; } - [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")] - public static new System.Security.Cryptography.Rijndael? Create(string algName) { throw null; } - } - [System.ObsoleteAttribute("The Rijndael and RijndaelManaged types are obsolete. Use Aes instead.", DiagnosticId = "SYSLIB0022", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] - public sealed partial class RijndaelManaged : System.Security.Cryptography.Rijndael - { - public RijndaelManaged() { } - public override int BlockSize { get { throw null; } set { } } - public override int FeedbackSize { get { throw null; } set { } } - public override byte[] IV { get { throw null; } set { } } - public override byte[] Key { get { throw null; } set { } } - public override int KeySize { get { throw null; } set { } } - public override System.Security.Cryptography.KeySizes[] LegalKeySizes { get { throw null; } } - public override System.Security.Cryptography.CipherMode Mode { get { throw null; } set { } } - public override System.Security.Cryptography.PaddingMode Padding { get { throw null; } set { } } - public override System.Security.Cryptography.ICryptoTransform CreateDecryptor() { throw null; } - public override System.Security.Cryptography.ICryptoTransform CreateDecryptor(byte[] rgbKey, byte[]? rgbIV) { throw null; } - public override System.Security.Cryptography.ICryptoTransform CreateEncryptor() { throw null; } - public override System.Security.Cryptography.ICryptoTransform CreateEncryptor(byte[] rgbKey, byte[]? rgbIV) { throw null; } - protected override void Dispose(bool disposing) { } - public override void GenerateIV() { } - public override void GenerateKey() { } - } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] - public abstract partial class RSA : System.Security.Cryptography.AsymmetricAlgorithm - { - protected RSA() { } - public override string? KeyExchangeAlgorithm { get { throw null; } } - public override string SignatureAlgorithm { get { throw null; } } - public static new System.Security.Cryptography.RSA Create() { throw null; } - public static System.Security.Cryptography.RSA Create(int keySizeInBits) { throw null; } - public static System.Security.Cryptography.RSA Create(System.Security.Cryptography.RSAParameters parameters) { throw null; } - [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")] - public static new System.Security.Cryptography.RSA? Create(string algName) { throw null; } - public virtual byte[] Decrypt(byte[] data, System.Security.Cryptography.RSAEncryptionPadding padding) { throw null; } - public virtual byte[] DecryptValue(byte[] rgb) { throw null; } - public virtual byte[] Encrypt(byte[] data, System.Security.Cryptography.RSAEncryptionPadding padding) { throw null; } - public virtual byte[] EncryptValue(byte[] rgb) { throw null; } - public abstract System.Security.Cryptography.RSAParameters ExportParameters(bool includePrivateParameters); - public virtual byte[] ExportRSAPrivateKey() { throw null; } - public virtual byte[] ExportRSAPublicKey() { throw null; } - public override void FromXmlString(string xmlString) { } - protected virtual byte[] HashData(byte[] data, int offset, int count, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { throw null; } - protected virtual byte[] HashData(System.IO.Stream data, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { throw null; } - public override void ImportEncryptedPkcs8PrivateKey(System.ReadOnlySpan passwordBytes, System.ReadOnlySpan source, out int bytesRead) { throw null; } - public override void ImportEncryptedPkcs8PrivateKey(System.ReadOnlySpan password, System.ReadOnlySpan source, out int bytesRead) { throw null; } - public override void ImportFromEncryptedPem(System.ReadOnlySpan input, System.ReadOnlySpan passwordBytes) { } - public override void ImportFromEncryptedPem(System.ReadOnlySpan input, System.ReadOnlySpan password) { } - public override void ImportFromPem(System.ReadOnlySpan input) { } - public abstract void ImportParameters(System.Security.Cryptography.RSAParameters parameters); - public override void ImportPkcs8PrivateKey(System.ReadOnlySpan source, out int bytesRead) { throw null; } - public virtual void ImportRSAPrivateKey(System.ReadOnlySpan source, out int bytesRead) { throw null; } - public virtual void ImportRSAPublicKey(System.ReadOnlySpan source, out int bytesRead) { throw null; } - public override void ImportSubjectPublicKeyInfo(System.ReadOnlySpan source, out int bytesRead) { throw null; } - public virtual byte[] SignData(byte[] data, int offset, int count, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.RSASignaturePadding padding) { throw null; } - public byte[] SignData(byte[] data, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.RSASignaturePadding padding) { throw null; } - public virtual byte[] SignData(System.IO.Stream data, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.RSASignaturePadding padding) { throw null; } - public virtual byte[] SignHash(byte[] hash, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.RSASignaturePadding padding) { throw null; } - public override string ToXmlString(bool includePrivateParameters) { throw null; } - public virtual bool TryDecrypt(System.ReadOnlySpan data, System.Span destination, System.Security.Cryptography.RSAEncryptionPadding padding, out int bytesWritten) { throw null; } - public virtual bool TryEncrypt(System.ReadOnlySpan data, System.Span destination, System.Security.Cryptography.RSAEncryptionPadding padding, out int bytesWritten) { throw null; } - public override bool TryExportEncryptedPkcs8PrivateKey(System.ReadOnlySpan passwordBytes, System.Security.Cryptography.PbeParameters pbeParameters, System.Span destination, out int bytesWritten) { throw null; } - public override bool TryExportEncryptedPkcs8PrivateKey(System.ReadOnlySpan password, System.Security.Cryptography.PbeParameters pbeParameters, System.Span destination, out int bytesWritten) { throw null; } - public override bool TryExportPkcs8PrivateKey(System.Span destination, out int bytesWritten) { throw null; } - public virtual bool TryExportRSAPrivateKey(System.Span destination, out int bytesWritten) { throw null; } - public virtual bool TryExportRSAPublicKey(System.Span destination, out int bytesWritten) { throw null; } - public override bool TryExportSubjectPublicKeyInfo(System.Span destination, out int bytesWritten) { throw null; } - protected virtual bool TryHashData(System.ReadOnlySpan data, System.Span destination, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, out int bytesWritten) { throw null; } - public virtual bool TrySignData(System.ReadOnlySpan data, System.Span destination, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.RSASignaturePadding padding, out int bytesWritten) { throw null; } - public virtual bool TrySignHash(System.ReadOnlySpan hash, System.Span destination, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.RSASignaturePadding padding, out int bytesWritten) { throw null; } - public bool VerifyData(byte[] data, byte[] signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.RSASignaturePadding padding) { throw null; } - public virtual bool VerifyData(byte[] data, int offset, int count, byte[] signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.RSASignaturePadding padding) { throw null; } - public bool VerifyData(System.IO.Stream data, byte[] signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.RSASignaturePadding padding) { throw null; } - public virtual bool VerifyData(System.ReadOnlySpan data, System.ReadOnlySpan signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.RSASignaturePadding padding) { throw null; } - public virtual bool VerifyHash(byte[] hash, byte[] signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.RSASignaturePadding padding) { throw null; } - public virtual bool VerifyHash(System.ReadOnlySpan hash, System.ReadOnlySpan signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.RSASignaturePadding padding) { throw null; } - } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] - public sealed partial class RSAEncryptionPadding : System.IEquatable - { - internal RSAEncryptionPadding() { } - public System.Security.Cryptography.RSAEncryptionPaddingMode Mode { get { throw null; } } - public System.Security.Cryptography.HashAlgorithmName OaepHashAlgorithm { get { throw null; } } - public static System.Security.Cryptography.RSAEncryptionPadding OaepSHA1 { get { throw null; } } - public static System.Security.Cryptography.RSAEncryptionPadding OaepSHA256 { get { throw null; } } - public static System.Security.Cryptography.RSAEncryptionPadding OaepSHA384 { get { throw null; } } - public static System.Security.Cryptography.RSAEncryptionPadding OaepSHA512 { get { throw null; } } - public static System.Security.Cryptography.RSAEncryptionPadding Pkcs1 { get { throw null; } } - public static System.Security.Cryptography.RSAEncryptionPadding CreateOaep(System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { throw null; } - public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; } - public bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] System.Security.Cryptography.RSAEncryptionPadding? other) { throw null; } - public override int GetHashCode() { throw null; } - public static bool operator ==(System.Security.Cryptography.RSAEncryptionPadding? left, System.Security.Cryptography.RSAEncryptionPadding? right) { throw null; } - public static bool operator !=(System.Security.Cryptography.RSAEncryptionPadding? left, System.Security.Cryptography.RSAEncryptionPadding? right) { throw null; } - public override string ToString() { throw null; } - } - public enum RSAEncryptionPaddingMode - { - Pkcs1 = 0, - Oaep = 1, - } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] - public partial class RSAOAEPKeyExchangeDeformatter : System.Security.Cryptography.AsymmetricKeyExchangeDeformatter - { - public RSAOAEPKeyExchangeDeformatter() { } - public RSAOAEPKeyExchangeDeformatter(System.Security.Cryptography.AsymmetricAlgorithm key) { } - public override string? Parameters { get { throw null; } set { } } - public override byte[] DecryptKeyExchange(byte[] rgbData) { throw null; } - public override void SetKey(System.Security.Cryptography.AsymmetricAlgorithm key) { } - } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] - public partial class RSAOAEPKeyExchangeFormatter : System.Security.Cryptography.AsymmetricKeyExchangeFormatter - { - public RSAOAEPKeyExchangeFormatter() { } - public RSAOAEPKeyExchangeFormatter(System.Security.Cryptography.AsymmetricAlgorithm key) { } - public byte[]? Parameter { get { throw null; } set { } } - public override string? Parameters { get { throw null; } } - public System.Security.Cryptography.RandomNumberGenerator? Rng { get { throw null; } set { } } - public override byte[] CreateKeyExchange(byte[] rgbData) { throw null; } - public override byte[] CreateKeyExchange(byte[] rgbData, System.Type? symAlgType) { throw null; } - public override void SetKey(System.Security.Cryptography.AsymmetricAlgorithm key) { } - } - public partial struct RSAParameters - { - public byte[]? D; - public byte[]? DP; - public byte[]? DQ; - public byte[]? Exponent; - public byte[]? InverseQ; - public byte[]? Modulus; - public byte[]? P; - public byte[]? Q; - } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] - public partial class RSAPKCS1KeyExchangeDeformatter : System.Security.Cryptography.AsymmetricKeyExchangeDeformatter - { - public RSAPKCS1KeyExchangeDeformatter() { } - public RSAPKCS1KeyExchangeDeformatter(System.Security.Cryptography.AsymmetricAlgorithm key) { } - public override string? Parameters { get { throw null; } set { } } - public System.Security.Cryptography.RandomNumberGenerator? RNG { get { throw null; } set { } } - public override byte[] DecryptKeyExchange(byte[] rgbIn) { throw null; } - public override void SetKey(System.Security.Cryptography.AsymmetricAlgorithm key) { } - } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] - public partial class RSAPKCS1KeyExchangeFormatter : System.Security.Cryptography.AsymmetricKeyExchangeFormatter - { - public RSAPKCS1KeyExchangeFormatter() { } - public RSAPKCS1KeyExchangeFormatter(System.Security.Cryptography.AsymmetricAlgorithm key) { } - public override string Parameters { get { throw null; } } - public System.Security.Cryptography.RandomNumberGenerator? Rng { get { throw null; } set { } } - public override byte[] CreateKeyExchange(byte[] rgbData) { throw null; } - public override byte[] CreateKeyExchange(byte[] rgbData, System.Type? symAlgType) { throw null; } - public override void SetKey(System.Security.Cryptography.AsymmetricAlgorithm key) { } - } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] - public partial class RSAPKCS1SignatureDeformatter : System.Security.Cryptography.AsymmetricSignatureDeformatter - { - public RSAPKCS1SignatureDeformatter() { } - public RSAPKCS1SignatureDeformatter(System.Security.Cryptography.AsymmetricAlgorithm key) { } - public override void SetHashAlgorithm(string strName) { } - public override void SetKey(System.Security.Cryptography.AsymmetricAlgorithm key) { } - public override bool VerifySignature(byte[] rgbHash, byte[] rgbSignature) { throw null; } - } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] - public partial class RSAPKCS1SignatureFormatter : System.Security.Cryptography.AsymmetricSignatureFormatter - { - public RSAPKCS1SignatureFormatter() { } - public RSAPKCS1SignatureFormatter(System.Security.Cryptography.AsymmetricAlgorithm key) { } - public override byte[] CreateSignature(byte[] rgbHash) { throw null; } - public override void SetHashAlgorithm(string strName) { } - public override void SetKey(System.Security.Cryptography.AsymmetricAlgorithm key) { } - } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] - public sealed partial class RSASignaturePadding : System.IEquatable - { - internal RSASignaturePadding() { } - public System.Security.Cryptography.RSASignaturePaddingMode Mode { get { throw null; } } - public static System.Security.Cryptography.RSASignaturePadding Pkcs1 { get { throw null; } } - public static System.Security.Cryptography.RSASignaturePadding Pss { get { throw null; } } - public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; } - public bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] System.Security.Cryptography.RSASignaturePadding? other) { throw null; } - public override int GetHashCode() { throw null; } - public static bool operator ==(System.Security.Cryptography.RSASignaturePadding? left, System.Security.Cryptography.RSASignaturePadding? right) { throw null; } - public static bool operator !=(System.Security.Cryptography.RSASignaturePadding? left, System.Security.Cryptography.RSASignaturePadding? right) { throw null; } - public override string ToString() { throw null; } - } - public enum RSASignaturePaddingMode - { - Pkcs1 = 0, - Pss = 1, - } - public abstract partial class SHA1 : System.Security.Cryptography.HashAlgorithm - { - protected SHA1() { } - public static new System.Security.Cryptography.SHA1 Create() { throw null; } - [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")] - public static new System.Security.Cryptography.SHA1? Create(string hashName) { throw null; } - public static byte[] HashData(byte[] source) { throw null; } - public static byte[] HashData(System.ReadOnlySpan source) { throw null; } - public static int HashData(System.ReadOnlySpan source, System.Span destination) { throw null; } - public static bool TryHashData(System.ReadOnlySpan source, System.Span destination, out int bytesWritten) { throw null; } - } - [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the base type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public sealed partial class SHA1Managed : System.Security.Cryptography.SHA1 - { - public SHA1Managed() { } - protected sealed override void Dispose(bool disposing) { } - protected sealed override void HashCore(byte[] array, int ibStart, int cbSize) { } - protected sealed override void HashCore(System.ReadOnlySpan source) { } - protected sealed override byte[] HashFinal() { throw null; } - public sealed override void Initialize() { } - protected sealed override bool TryHashFinal(System.Span destination, out int bytesWritten) { throw null; } - } - public abstract partial class SHA256 : System.Security.Cryptography.HashAlgorithm - { - protected SHA256() { } - public static new System.Security.Cryptography.SHA256 Create() { throw null; } - [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")] - public static new System.Security.Cryptography.SHA256? Create(string hashName) { throw null; } - public static byte[] HashData(byte[] source) { throw null; } - public static byte[] HashData(System.ReadOnlySpan source) { throw null; } - public static int HashData(System.ReadOnlySpan source, System.Span destination) { throw null; } - public static bool TryHashData(System.ReadOnlySpan source, System.Span destination, out int bytesWritten) { throw null; } - } - [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the base type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public sealed partial class SHA256Managed : System.Security.Cryptography.SHA256 - { - public SHA256Managed() { } - protected sealed override void Dispose(bool disposing) { } - protected sealed override void HashCore(byte[] array, int ibStart, int cbSize) { } - protected sealed override void HashCore(System.ReadOnlySpan source) { } - protected sealed override byte[] HashFinal() { throw null; } - public sealed override void Initialize() { } - protected sealed override bool TryHashFinal(System.Span destination, out int bytesWritten) { throw null; } - } - public abstract partial class SHA384 : System.Security.Cryptography.HashAlgorithm - { - protected SHA384() { } - public static new System.Security.Cryptography.SHA384 Create() { throw null; } - [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")] - public static new System.Security.Cryptography.SHA384? Create(string hashName) { throw null; } - public static byte[] HashData(byte[] source) { throw null; } - public static byte[] HashData(System.ReadOnlySpan source) { throw null; } - public static int HashData(System.ReadOnlySpan source, System.Span destination) { throw null; } - public static bool TryHashData(System.ReadOnlySpan source, System.Span destination, out int bytesWritten) { throw null; } - } - [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the base type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public sealed partial class SHA384Managed : System.Security.Cryptography.SHA384 - { - public SHA384Managed() { } - protected sealed override void Dispose(bool disposing) { } - protected sealed override void HashCore(byte[] array, int ibStart, int cbSize) { } - protected sealed override void HashCore(System.ReadOnlySpan source) { } - protected sealed override byte[] HashFinal() { throw null; } - public sealed override void Initialize() { } - protected sealed override bool TryHashFinal(System.Span destination, out int bytesWritten) { throw null; } - } - public abstract partial class SHA512 : System.Security.Cryptography.HashAlgorithm - { - protected SHA512() { } - public static new System.Security.Cryptography.SHA512 Create() { throw null; } - [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")] - public static new System.Security.Cryptography.SHA512? Create(string hashName) { throw null; } - public static byte[] HashData(byte[] source) { throw null; } - public static byte[] HashData(System.ReadOnlySpan source) { throw null; } - public static int HashData(System.ReadOnlySpan source, System.Span destination) { throw null; } - public static bool TryHashData(System.ReadOnlySpan source, System.Span destination, out int bytesWritten) { throw null; } - } - [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the base type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public sealed partial class SHA512Managed : System.Security.Cryptography.SHA512 - { - public SHA512Managed() { } - protected sealed override void Dispose(bool disposing) { } - protected sealed override void HashCore(byte[] array, int ibStart, int cbSize) { } - protected sealed override void HashCore(System.ReadOnlySpan source) { } - protected sealed override byte[] HashFinal() { throw null; } - public sealed override void Initialize() { } - protected sealed override bool TryHashFinal(System.Span destination, out int bytesWritten) { throw null; } - } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] - public partial class SignatureDescription - { - public SignatureDescription() { } - public SignatureDescription(System.Security.SecurityElement el) { } - public string? DeformatterAlgorithm { get { throw null; } set { } } - public string? DigestAlgorithm { get { throw null; } set { } } - public string? FormatterAlgorithm { get { throw null; } set { } } - public string? KeyAlgorithm { get { throw null; } set { } } - [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("CreateDeformatter is not trim compatible because the algorithm implementation referenced by DeformatterAlgorithm might be removed.")] - public virtual System.Security.Cryptography.AsymmetricSignatureDeformatter CreateDeformatter(System.Security.Cryptography.AsymmetricAlgorithm key) { throw null; } - [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("CreateDigest is not trim compatible because the algorithm implementation referenced by DigestAlgorithm might be removed.")] - public virtual System.Security.Cryptography.HashAlgorithm? CreateDigest() { throw null; } - [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("CreateFormatter is not trim compatible because the algorithm implementation referenced by FormatterAlgorithm might be removed.")] - public virtual System.Security.Cryptography.AsymmetricSignatureFormatter CreateFormatter(System.Security.Cryptography.AsymmetricAlgorithm key) { throw null; } - } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] - public abstract partial class TripleDES : System.Security.Cryptography.SymmetricAlgorithm - { - protected TripleDES() { } - public override byte[] Key { get { throw null; } set { } } - public static new System.Security.Cryptography.TripleDES Create() { throw null; } - [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")] - public static new System.Security.Cryptography.TripleDES? Create(string str) { throw null; } - public static bool IsWeakKey(byte[] rgbKey) { throw null; } - } -} diff --git a/src/libraries/System.Security.Cryptography.Algorithms/ref/System.Security.Cryptography.Algorithms.csproj b/src/libraries/System.Security.Cryptography.Algorithms/ref/System.Security.Cryptography.Algorithms.csproj index 569311fe0f7323..6f78fdf5bfd120 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/ref/System.Security.Cryptography.Algorithms.csproj +++ b/src/libraries/System.Security.Cryptography.Algorithms/ref/System.Security.Cryptography.Algorithms.csproj @@ -1,16 +1,14 @@ $(NetCoreAppCurrent) + $(NoWarn);SYSLIB0021;SYSLIB0022 enable - - - diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/ExcludeApiList.PNSE.Browser.txt b/src/libraries/System.Security.Cryptography.Algorithms/src/ExcludeApiList.PNSE.Browser.txt deleted file mode 100644 index 39c223fa55ea82..00000000000000 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/ExcludeApiList.PNSE.Browser.txt +++ /dev/null @@ -1,14 +0,0 @@ -M:System.Security.Cryptography.AesCcm.IsSupported -M:System.Security.Cryptography.AesGcm.IsSupported -M:System.Security.Cryptography.ChaCha20Poly1305.IsSupported -T:System.Security.Cryptography.CryptoConfig -T:System.Security.Cryptography.RandomNumberGenerator -T:System.Security.Cryptography.IncrementalHash -T:System.Security.Cryptography.SHA1 -T:System.Security.Cryptography.SHA256 -T:System.Security.Cryptography.SHA384 -T:System.Security.Cryptography.SHA512 -T:System.Security.Cryptography.SHA1Managed -T:System.Security.Cryptography.SHA256Managed -T:System.Security.Cryptography.SHA384Managed -T:System.Security.Cryptography.SHA512Managed \ No newline at end of file diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/Resources/Strings.resx b/src/libraries/System.Security.Cryptography.Algorithms/src/Resources/Strings.resx deleted file mode 100644 index 0aafdc0ee2b6a4..00000000000000 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/Resources/Strings.resx +++ /dev/null @@ -1,363 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Non-negative number required. - - - Positive number required. - - - Destination is too short. - - - Range of random number does not contain at least one possibility. - - - Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection. - - - The OID value was invalid. - - - Value was invalid. - - - Buffer cannot be null. - - - No supported key formats were found. Check that the input represents the contents of a PEM-encoded key file, not the path to such a file. - - - The input contains multiple keys, but only one key can be imported. - - - An encrypted key was found, but no password was provided. Use ImportFromEncryptedPem to import this key. - - - Error occurred during a cryptographic operation. - - - The KDF for algorithm '{0}' requires a char-based password input. - - - Algorithm '{0}' is not supported on this platform. - - - The keys from both parties must be the same size to generate a secret agreement. - - - Keys used with the ECDiffieHellmanCng algorithm must have an algorithm group of ECDiffieHellman. - - - ASN.1 Enumerated values only apply to enum types without the [Flags] attribute. - - - Named bit list operations require an enum with the [Flags] attribute. - - - The encoded named bit list value is larger than the value size of the '{0}' enum. - - - Tags with TagClass Universal must have the appropriate TagValue value for the data type being read or written. - - - Unused bit count must be between 0 and 7, inclusive. - - - Encode cannot be called while a Sequence or SetOf is still open. - - - Cannot pop the requested tag as it is not currently in progress. - - - The computed authentication tag did not match the input authentication tag. - - - The TLS key derivation function requires both the label and seed properties to be set. - - - The TLS key derivation function requires a seed value of exactly 64 bytes. - - - The provided value of {0} bytes does not match the expected size of {1} bytes for the algorithm ({2}). - - - Encoded OID length is too large (greater than 0x7f bytes). - - - Object contains only the public half of a key pair. A private key must also be provided. - - - ASN1 corrupted data. - - - DSA keys can be imported, but new key generation is not supported on this platform. - - - The message exceeds the maximum allowable length for the chosen options ({0}). - - - XML serialization of an elliptic curve key requires using an overload which specifies the XML format to be used. - - - Only named curves are supported on this platform. - - - The provided XML could not be read. - - - The hash algorithm name cannot be null or empty. - - - Object identifier (OID) is unknown. - - - The specified curve '{0}' or its parameters are not valid for this platform. - - - The specified Oid is not valid. The Oid.FriendlyName or Oid.Value property must be set. - - - The specified key parameters are not valid. Q.X and Q.Y, or D, must be specified. Q.X, Q.Y must be the same length. If D is specified it must be the same length as Q.X and Q.Y if also specified for named curves or the same length as Order for explicit curves. - - - The specified DSA parameters are not valid; P, Q, G and Y are all required. - - - The specified DSA parameters are not valid; P, G and Y must be the same length (the key size). - - - The specified DSA parameters are not valid; Q and X (if present) must be the same length. - - - The specified DSA parameters are not valid; J (if present) must be shorter than P. - - - The specified DSA parameters are not valid; Seed, if present, must be 20 bytes long for keys shorter than 1024 bits. - - - The specified DSA parameters are not valid; Q must be 20 bytes long for keys shorter than 1024 bits. - - - The specified DSA parameters are not valid; Q's length must be one of 20, 32 or 64 bytes. - - - Input string does not contain a valid encoding of the '{0}' '{1}' parameter. - - - The specified Characteristic2 curve parameters are not valid. Polynomial, A, B, G.X, G.Y, and Order are required. A, B, G.X, G.Y must be the same length, and the same length as Q.X, Q.Y and D if those are specified. Cofactor is required. Seed and Hash are optional. Other parameters are not allowed. - - - The specified prime curve parameters are not valid. Prime, A, B, G.X, G.Y and Order are required and must be the same length, and the same length as Q.X, Q.Y and D if those are specified. Cofactor is required. Seed and Hash are optional. Other parameters are not allowed. - - - The specified named curve parameters are not valid. Only the Oid parameter must be set. - - - Specified key is not a valid size for this algorithm. - - - Specified key is a known semi-weak key for '{0}' and cannot be used. - - - Specified key is a known weak key for '{0}' and cannot be used. - - - The specified nonce is not a valid size for this algorithm. - - - The specified tag is not a valid size for this algorithm. - - - Specified initialization vector (IV) does not match the block size for this algorithm. - - - This operation is not supported for this class. - - - Padding is invalid and cannot be removed. - - - The specified RSA parameters are not valid. Exponent and Modulus are required. If D is present, it must have the same length as Modulus. If D is present, P, Q, DP, DQ, and InverseQ are required and must have half the length of Modulus, rounded up, otherwise they must be omitted. - - - Specified padding mode is not valid for this algorithm. - - - The string contains a character not in the 7 bit ASCII character set. - - - The key is too small for the requested operation. - - - The cipher mode specified requires that an initialization vector (IV) be used. - - - No asymmetric key object has been associated with this formatter object. - - - Required object identifier (OID) cannot be found. - - - TransformBlock may only process bytes in block sized increments. - - - Key is not a valid private key. - - - Key is not a valid public or private key. - - - Error occurred while decoding OAEP padding. - - - Cannot open an invalid handle. - - - The input data is not a complete block. - - - The EncryptedPrivateKeyInfo structure was decoded but was not successfully interpreted, the password may be incorrect. - - - Plaintext and ciphertext must have the same length. - - - EffectiveKeySize value must be at least 40 bits. - - - KeySize value must be at least as large as the EffectiveKeySize value. - - - EffectiveKeySize must be the same as KeySize in this implementation. - - - BlockSize must be 128 in this implementation. - - - The length of the data to decrypt is not valid for the size of this key. - - - The provided RSAPrivateKey value has version '{0}', but version '{1}' is the maximum supported. - - - The provided hash value is not the expected size for the specified hash algorithm. - - - Attempt to transform beyond end of buffer. - - - The specified feedback size '{0}' for CipherMode '{1}' is not supported. - - - The specified CipherMode '{0}' is not supported. - - - The algorithm identified by '{0}' is unknown, not valid for the requested usage, or was not handled. - - - '{0}' is not a known hash algorithm. - - - Unknown padding mode used. - - - The signature format '{0}' is unknown. - - - CNG provider unexpectedly terminated encryption or decryption prematurely. - - - The system cryptographic library returned error '{0}' of type '{1}' - - - The specified PaddingMode is not supported. - - - Method not supported. - - - Method not supported. Derived class must override. - - - Algorithms added to CryptoConfig must be accessible from outside their assembly. - - - CryptoConfig cannot add a mapping for a null or empty name. - - - The input to WriteEncodedValue must represent a single encoded value with no trailing data. - - - The pseudo-random key length must be {0} bytes. - - - Output keying material length can be at most {0} bytes (255 * hash length). - - - System.Security.Cryptography.Algorithms is not supported on this platform. - - - The total number of bytes extracted cannot exceed UInt32.MaxValue * hash length. - - - The current platform does not support the specified feedback size. - - diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System.Security.Cryptography.Algorithms.csproj b/src/libraries/System.Security.Cryptography.Algorithms/src/System.Security.Cryptography.Algorithms.csproj index 6873ecafbc81a5..ccd9e34fe31e1a 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System.Security.Cryptography.Algorithms.csproj +++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System.Security.Cryptography.Algorithms.csproj @@ -1,756 +1,11 @@  - true - $(DefineConstants);INTERNAL_ASYMMETRIC_IMPLEMENTATIONS - $(NoWarn);CA5350;CA5351;CA5379;CA5384 true - $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Android;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS;$(NetCoreAppCurrent)-Browser + $(NetCoreAppCurrent) enable - - true - true - SR.SystemSecurityCryptographyAlgorithms_PlatformNotSupported - ExcludeApiList.PNSE.Browser.txt - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Common\System\Security\Cryptography\Asn1\AlgorithmIdentifierAsn.xml - - - Common\System\Security\Cryptography\Asn1\AlgorithmIdentifierAsn.xml.cs - Common\System\Security\Cryptography\Asn1\AlgorithmIdentifierAsn.xml - - - Common\System\Security\Cryptography\Asn1\AlgorithmIdentifierAsn.manual.cs - Common\System\Security\Cryptography\Asn1\AlgorithmIdentifierAsn.xml - - - Common\System\Security\Cryptography\Asn1\AttributeAsn.xml - - - Common\System\Security\Cryptography\Asn1\AttributeAsn.xml.cs - Common\System\Security\Cryptography\Asn1\AttributeAsn.xml - - - Common\System\Security\Cryptography\Asn1\CurveAsn.xml - - - Common\System\Security\Cryptography\Asn1\CurveAsn.xml.cs - Common\System\Security\Cryptography\Asn1\CurveAsn.xml - - - Common\System\Security\Cryptography\Asn1\DssParms.xml - - - Common\System\Security\Cryptography\Asn1\DssParms.xml.cs - Common\System\Security\Cryptography\Asn1\DssParms.xml - - - Common\System\Security\Cryptography\Asn1\ECDomainParameters.xml - - - Common\System\Security\Cryptography\Asn1\ECDomainParameters.xml.cs - Common\System\Security\Cryptography\Asn1\ECDomainParameters.xml - - - Common\System\Security\Cryptography\Asn1\ECPrivateKey.xml - - - Common\System\Security\Cryptography\Asn1\ECPrivateKey.xml.cs - Common\System\Security\Cryptography\Asn1\ECPrivateKey.xml - - - Common\System\Security\Cryptography\Asn1\EncryptedPrivateKeyInfoAsn.xml - - - Common\System\Security\Cryptography\Asn1\EncryptedPrivateKeyInfoAsn.xml.cs - Common\System\Security\Cryptography\Asn1\EncryptedPrivateKeyInfoAsn.xml - - - Common\System\Security\Cryptography\Asn1\FieldID.xml - - - Common\System\Security\Cryptography\Asn1\FieldID.xml.cs - Common\System\Security\Cryptography\Asn1\FieldID.xml - - - Common\System\Security\Cryptography\Asn1\PBEParameter.xml - - - Common\System\Security\Cryptography\Asn1\PBEParameter.xml.cs - Common\System\Security\Cryptography\Asn1\PBEParameter.xml - - - Common\System\Security\Cryptography\Asn1\PBES2Params.xml - - - Common\System\Security\Cryptography\Asn1\PBES2Params.xml.cs - Common\System\Security\Cryptography\Asn1\PBES2Params.xml - - - Common\System\Security\Cryptography\Asn1\Pbkdf2Params.xml - - - Common\System\Security\Cryptography\Asn1\Pbkdf2Params.xml.cs - Common\System\Security\Cryptography\Asn1\Pbkdf2Params.xml - - - Common\System\Security\Cryptography\Asn1\Pbkdf2SaltChoice.xml - - - Common\System\Security\Cryptography\Asn1\Pbkdf2SaltChoice.xml.cs - Common\System\Security\Cryptography\Asn1\Pbkdf2SaltChoice.xml - - - Common\System\Security\Cryptography\Asn1\PrivateKeyInfoAsn.xml - - - Common\System\Security\Cryptography\Asn1\PrivateKeyInfoAsn.xml.cs - Common\System\Security\Cryptography\Asn1\PrivateKeyInfoAsn.xml - - - Common\System\Security\Cryptography\Asn1\Rc2CbcParameters.xml - - - Common\System\Security\Cryptography\Asn1\Rc2CbcParameters.xml.cs - Common\System\Security\Cryptography\Asn1\Rc2CbcParameters.xml - - - Common\System\Security\Cryptography\Asn1\Rc2CbcParameters.manual.cs - Common\System\Security\Cryptography\Asn1\Rc2CbcParameters.xml - - - Common\System\Security\Cryptography\Asn1\RSAPrivateKeyAsn.xml - - - Common\System\Security\Cryptography\Asn1\RSAPrivateKeyAsn.xml.cs - Common\System\Security\Cryptography\Asn1\RSAPrivateKeyAsn.xml - - - Common\System\Security\Cryptography\Asn1\RSAPublicKeyAsn.xml - - - Common\System\Security\Cryptography\Asn1\RSAPublicKeyAsn.xml.cs - Common\System\Security\Cryptography\Asn1\RSAPublicKeyAsn.xml - - - Common\System\Security\Cryptography\Asn1\SpecifiedECDomain.xml - - - Common\System\Security\Cryptography\Asn1\SpecifiedECDomain.xml.cs - Common\System\Security\Cryptography\Asn1\SpecifiedECDomain.xml - - - Common\System\Security\Cryptography\Asn1\SubjectPublicKeyInfoAsn.xml - - - Common\System\Security\Cryptography\Asn1\SubjectPublicKeyInfoAsn.xml.cs - Common\System\Security\Cryptography\Asn1\SubjectPublicKeyInfoAsn.xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/CryptoConfig.Browser.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/CryptoConfig.Browser.cs deleted file mode 100644 index 6564a0d48ca290..00000000000000 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/CryptoConfig.Browser.cs +++ /dev/null @@ -1,67 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.Diagnostics; -using System.Diagnostics.CodeAnalysis; -using System.Globalization; -using System.Reflection; -using System.Runtime.Versioning; - -namespace System.Security.Cryptography -{ - public partial class CryptoConfig - { - [UnsupportedOSPlatform("browser")] - public static void AddAlgorithm(Type algorithm, params string[] names) => throw new PlatformNotSupportedException(SR.SystemSecurityCryptographyAlgorithms_PlatformNotSupported); - - [UnsupportedOSPlatform("browser")] - public static void AddOID(string oid, params string[] names) => throw new PlatformNotSupportedException(SR.SystemSecurityCryptographyAlgorithms_PlatformNotSupported); - - [UnsupportedOSPlatform("browser")] - public static string? MapNameToOID(string name) => throw new PlatformNotSupportedException(SR.SystemSecurityCryptographyAlgorithms_PlatformNotSupported); - - [UnsupportedOSPlatform("browser")] - [Obsolete(Obsoletions.CryptoConfigEncodeOIDMessage, DiagnosticId = Obsoletions.CryptoConfigEncodeOIDDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] - public static byte[] EncodeOID(string str) => throw new PlatformNotSupportedException(SR.SystemSecurityCryptographyAlgorithms_PlatformNotSupported); - - [RequiresUnreferencedCode("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")] - public static object? CreateFromName(string name, params object?[]? args) - { - if (name == null) - throw new ArgumentNullException(nameof(name)); - - switch (name) - { -#pragma warning disable SYSLIB0021 // Obsolete: derived cryptographic types - // hardcode mapping for SHA* algorithm names from https://docs.microsoft.com/en-us/dotnet/api/system.security.cryptography.cryptoconfig?view=net-5.0#remarks - case "SHA": - case "SHA1": - case "System.Security.Cryptography.SHA1": - return new SHA1Managed(); - case "SHA256": - case "SHA-256": - case "System.Security.Cryptography.SHA256": - return new SHA256Managed(); - case "SHA384": - case "SHA-384": - case "System.Security.Cryptography.SHA384": - return new SHA384Managed(); - case "SHA512": - case "SHA-512": - case "System.Security.Cryptography.SHA512": - return new SHA512Managed(); -#pragma warning restore SYSLIB0021 - } - - return null; - } - - [RequiresUnreferencedCode(CreateFromNameUnreferencedCodeMessage)] - public static object? CreateFromName(string name) - { - return CreateFromName(name, null); - } - } -} diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/CryptoConfigTests.cs b/src/libraries/System.Security.Cryptography.Algorithms/tests/CryptoConfigTests.cs deleted file mode 100644 index b724370944024f..00000000000000 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/CryptoConfigTests.cs +++ /dev/null @@ -1,444 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System.Collections.Generic; -using System.Reflection; -using System.Text; -using Test.Cryptography; -using Xunit; - -#pragma warning disable SYSLIB0022 // Rijndael types are obsolete - -namespace System.Security.Cryptography.CryptoConfigTests -{ - public static class CryptoConfigTests - { - [Fact] - public static void AllowOnlyFipsAlgorithms() - { - Assert.False(CryptoConfig.AllowOnlyFipsAlgorithms); - } - - [Fact] - [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] - public static void AddOID_MapNameToOID_ReturnsMapped() - { - CryptoConfig.AddOID("1.3.14.3.2.28", "SHAFancy"); - Assert.Equal("1.3.14.3.2.28", CryptoConfig.MapNameToOID("SHAFancy")); - } - - [Fact] - [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] - public static void AddOID_EmptyString_Throws() - { - AssertExtensions.Throws(null, () => CryptoConfig.AddOID(string.Empty, string.Empty)); - } - - [Fact] - [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] - public static void AddOID_EmptyNamesArray() - { - CryptoConfig.AddOID("1.3.14.3.2.28", new string[0]); - // There is no verifiable behavior in this case. We only check that we don't throw. - } - - [Fact] - [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] - public static void AddOID_NullOid_Throws() - { - AssertExtensions.Throws("oid", () => CryptoConfig.AddOID(null, string.Empty)); - } - - [Fact] - [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] - public static void AddOID_NullNames_Throws() - { - AssertExtensions.Throws("names", () => CryptoConfig.AddOID(string.Empty, null)); - } - - [Fact] - [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] - public static void AddAlgorithm_CreateFromName_ReturnsMapped() - { - CryptoConfig.AddAlgorithm(typeof(AesCryptoServiceProvider), "AESFancy"); - Assert.Equal(typeof(AesCryptoServiceProvider).FullName, CryptoConfig.CreateFromName("AESFancy").GetType().FullName); - } - - [Fact] - [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] - public static void AddAlgorithm_NonVisibleType() - { - AssertExtensions.Throws("algorithm", () => CryptoConfig.AddAlgorithm(typeof(AESFancy), "AESFancy")); - } - - private class AESFancy - { - } - - [Fact] - [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] - public static void AddAlgorithm_EmptyString_Throws() - { - AssertExtensions.Throws(null, () => CryptoConfig.AddAlgorithm(typeof(CryptoConfigTests), string.Empty)); - } - - [Fact] - [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] - public static void AddAlgorithm_EmptyNamesArray() - { - CryptoConfig.AddAlgorithm(typeof(AesCryptoServiceProvider), new string[0]); - // There is no verifiable behavior in this case. We only check that we don't throw. - } - - [Fact] - [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] - public static void AddAlgorithm_NullAlgorithm_Throws() - { - AssertExtensions.Throws("algorithm", () => CryptoConfig.AddAlgorithm(null, string.Empty)); - } - - [Fact] - [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] - public static void AddAlgorithm_NullNames_Throws() - { - AssertExtensions.Throws("names", () => CryptoConfig.AddAlgorithm(typeof(CryptoConfigTests), null)); - } - - [Fact] - [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] - public static void StaticCreateMethods() - { - // Ensure static create methods exist and don't throw - - // Some do not have public concrete types (in Algorithms assembly) so in those cases we only check for null\failure. - VerifyStaticCreateResult(Aes.Create(typeof(AesManaged).FullName), typeof(AesManaged)); - Assert.Null(DES.Create(string.Empty)); - Assert.Null(DSA.Create(string.Empty)); - Assert.Null(ECDsa.Create(string.Empty)); - Assert.Null(MD5.Create(string.Empty)); - Assert.Null(RandomNumberGenerator.Create(string.Empty)); - Assert.Null(RC2.Create(string.Empty)); - VerifyStaticCreateResult(Rijndael.Create(typeof(RijndaelManaged).FullName), typeof(RijndaelManaged)); - Assert.Null(RSA.Create(string.Empty)); - Assert.Null(SHA1.Create(string.Empty)); - VerifyStaticCreateResult(SHA256.Create(typeof(SHA256Managed).FullName), typeof(SHA256Managed)); - VerifyStaticCreateResult(SHA384.Create(typeof(SHA384Managed).FullName), typeof(SHA384Managed)); - VerifyStaticCreateResult(SHA512.Create(typeof(SHA512Managed).FullName), typeof(SHA512Managed)); - } - - private static void VerifyStaticCreateResult(object obj, Type expectedType) - { - Assert.NotNull(obj); - Assert.IsType(expectedType, obj); - } - - [Fact] - [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] - public static void MapNameToOID() - { - Assert.Throws(() => CryptoConfig.MapNameToOID(null)); - - // Test some oids unique to CryptoConfig - Assert.Equal("1.3.14.3.2.26", CryptoConfig.MapNameToOID("SHA")); - Assert.Equal("1.3.14.3.2.26", CryptoConfig.MapNameToOID("sha")); - Assert.Equal("1.2.840.113549.3.7", CryptoConfig.MapNameToOID("TripleDES")); - - // Test fallback to Oid class - Assert.Equal("1.3.36.3.3.2.8.1.1.8", CryptoConfig.MapNameToOID("brainpoolP256t1")); - - // Invalid oid - Assert.Null(CryptoConfig.MapNameToOID("NOT_A_VALID_OID")); - } - - [Fact] - [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] - public static void CreateFromName_validation() - { - Assert.Throws(() => CryptoConfig.CreateFromName(null)); - Assert.Throws(() => CryptoConfig.CreateFromName(null, null)); - Assert.Throws(() => CryptoConfig.CreateFromName(null, string.Empty)); - Assert.Null(CryptoConfig.CreateFromName(string.Empty, null)); - Assert.Null(CryptoConfig.CreateFromName("SHA", 1, 2)); - } - - public static IEnumerable AllValidNames - { - get - { - if (PlatformDetection.IsBrowser) - { - // Hash functions - yield return new object[] { "SHA", typeof(SHA1Managed).FullName, true }; - yield return new object[] { "SHA1", typeof(SHA1Managed).FullName, true }; - yield return new object[] { "System.Security.Cryptography.SHA1", typeof(SHA1Managed).FullName, true }; - yield return new object[] { "SHA256", typeof(SHA256Managed).FullName, true }; - yield return new object[] { "SHA-256", typeof(SHA256Managed).FullName, true }; - yield return new object[] { "System.Security.Cryptography.SHA256", typeof(SHA256Managed).FullName, true }; - yield return new object[] { "SHA384", typeof(SHA384Managed).FullName, true }; - yield return new object[] { "SHA-384", typeof(SHA384Managed).FullName, true }; - yield return new object[] { "System.Security.Cryptography.SHA384", typeof(SHA384Managed).FullName, true }; - yield return new object[] { "SHA512", typeof(SHA512Managed).FullName, true }; - yield return new object[] { "SHA-512", typeof(SHA512Managed).FullName, true }; - yield return new object[] { "System.Security.Cryptography.SHA512", typeof(SHA512Managed).FullName, true }; - } - else - { - // Random number generator - yield return new object[] { "RandomNumberGenerator", "System.Security.Cryptography.RNGCryptoServiceProvider", true }; - yield return new object[] { "System.Security.Cryptography.RandomNumberGenerator", "System.Security.Cryptography.RNGCryptoServiceProvider", true }; - - // Hash functions - yield return new object[] { "SHA", "System.Security.Cryptography.SHA1CryptoServiceProvider", true }; - yield return new object[] { "SHA1", "System.Security.Cryptography.SHA1CryptoServiceProvider", true }; - yield return new object[] { "System.Security.Cryptography.SHA1", "System.Security.Cryptography.SHA1CryptoServiceProvider", true }; - yield return new object[] { "System.Security.Cryptography.HashAlgorithm", "System.Security.Cryptography.SHA1CryptoServiceProvider", true }; - yield return new object[] { "MD5", "System.Security.Cryptography.MD5CryptoServiceProvider", true }; - yield return new object[] { "System.Security.Cryptography.MD5", "System.Security.Cryptography.MD5CryptoServiceProvider", true }; - yield return new object[] { "SHA256", typeof(SHA256Managed).FullName, true }; - yield return new object[] { "SHA-256", typeof(SHA256Managed).FullName, true }; - yield return new object[] { "System.Security.Cryptography.SHA256", typeof(SHA256Managed).FullName, true }; - yield return new object[] { "SHA384", typeof(SHA384Managed).FullName, true }; - yield return new object[] { "SHA-384", typeof(SHA384Managed).FullName, true }; - yield return new object[] { "System.Security.Cryptography.SHA384", typeof(SHA384Managed).FullName, true }; - yield return new object[] { "SHA512", typeof(SHA512Managed).FullName, true }; - yield return new object[] { "SHA-512", typeof(SHA512Managed).FullName, true }; - yield return new object[] { "System.Security.Cryptography.SHA512", typeof(SHA512Managed).FullName, true }; - - // Keyed Hash Algorithms - yield return new object[] { "System.Security.Cryptography.HMAC", "System.Security.Cryptography.HMACSHA1", true }; - yield return new object[] { "System.Security.Cryptography.KeyedHashAlgorithm", "System.Security.Cryptography.HMACSHA1", true }; - yield return new object[] { "HMACMD5", "System.Security.Cryptography.HMACMD5", true }; - yield return new object[] { "System.Security.Cryptography.HMACMD5", null, true }; - yield return new object[] { "HMACSHA1", "System.Security.Cryptography.HMACSHA1", true }; - yield return new object[] { "System.Security.Cryptography.HMACSHA1", null, true }; - yield return new object[] { "HMACSHA256", "System.Security.Cryptography.HMACSHA256", true }; - yield return new object[] { "System.Security.Cryptography.HMACSHA256", null, true }; - yield return new object[] { "HMACSHA384", "System.Security.Cryptography.HMACSHA384", true }; - yield return new object[] { "System.Security.Cryptography.HMACSHA384", null, true }; - yield return new object[] { "HMACSHA512", "System.Security.Cryptography.HMACSHA512", true }; - yield return new object[] { "System.Security.Cryptography.HMACSHA512", null, true }; - - // Asymmetric algorithms - yield return new object[] { "RSA", "System.Security.Cryptography.RSACryptoServiceProvider", true }; - yield return new object[] { "System.Security.Cryptography.RSA", "System.Security.Cryptography.RSACryptoServiceProvider", true }; - yield return new object[] { "System.Security.Cryptography.AsymmetricAlgorithm", "System.Security.Cryptography.RSACryptoServiceProvider", true }; - if (!PlatformDetection.UsesMobileAppleCrypto) - { - yield return new object[] { "DSA", "System.Security.Cryptography.DSACryptoServiceProvider", true }; - yield return new object[] { "System.Security.Cryptography.DSA", "System.Security.Cryptography.DSACryptoServiceProvider", true }; - } - yield return new object[] { "ECDsa", "System.Security.Cryptography.ECDsaCng", true }; - yield return new object[] { "ECDsaCng", "System.Security.Cryptography.ECDsaCng", false }; - yield return new object[] { "System.Security.Cryptography.ECDsaCng", null, false }; - yield return new object[] { "DES", "System.Security.Cryptography.DESCryptoServiceProvider", true }; - yield return new object[] { "System.Security.Cryptography.DES", "System.Security.Cryptography.DESCryptoServiceProvider", true }; - yield return new object[] { "3DES", "System.Security.Cryptography.TripleDESCryptoServiceProvider", true }; - yield return new object[] { "TripleDES", "System.Security.Cryptography.TripleDESCryptoServiceProvider", true }; - yield return new object[] { "Triple DES", "System.Security.Cryptography.TripleDESCryptoServiceProvider", true }; - yield return new object[] { "System.Security.Cryptography.TripleDES", "System.Security.Cryptography.TripleDESCryptoServiceProvider", true }; - yield return new object[] { "RC2", "System.Security.Cryptography.RC2CryptoServiceProvider", true }; - yield return new object[] { "System.Security.Cryptography.RC2", "System.Security.Cryptography.RC2CryptoServiceProvider", true }; - yield return new object[] { "Rijndael", typeof(RijndaelManaged).FullName, true }; - yield return new object[] { "System.Security.Cryptography.Rijndael", typeof(RijndaelManaged).FullName, true }; - yield return new object[] { "System.Security.Cryptography.SymmetricAlgorithm", typeof(RijndaelManaged).FullName, true }; - yield return new object[] { "AES", "System.Security.Cryptography.AesCryptoServiceProvider", true }; - yield return new object[] { "AesCryptoServiceProvider", "System.Security.Cryptography.AesCryptoServiceProvider", true }; - yield return new object[] { "System.Security.Cryptography.AesCryptoServiceProvider", "System.Security.Cryptography.AesCryptoServiceProvider", true }; - yield return new object[] { "AesManaged", typeof(AesManaged).FullName, true }; - yield return new object[] { "System.Security.Cryptography.AesManaged", typeof(AesManaged).FullName, true }; - - // Xml Dsig/ Enc Hash algorithms - yield return new object[] { "http://www.w3.org/2000/09/xmldsig#sha1", "System.Security.Cryptography.SHA1CryptoServiceProvider", true }; - yield return new object[] { "http://www.w3.org/2001/04/xmlenc#sha256", typeof(SHA256Managed).FullName, true }; - yield return new object[] { "http://www.w3.org/2001/04/xmlenc#sha512", typeof(SHA512Managed).FullName, true }; - - // Xml Encryption symmetric keys - yield return new object[] { "http://www.w3.org/2001/04/xmlenc#des-cbc", "System.Security.Cryptography.DESCryptoServiceProvider", true }; - yield return new object[] { "http://www.w3.org/2001/04/xmlenc#tripledes-cbc", "System.Security.Cryptography.TripleDESCryptoServiceProvider", true }; - yield return new object[] { "http://www.w3.org/2001/04/xmlenc#kw-tripledes", "System.Security.Cryptography.TripleDESCryptoServiceProvider", true }; - yield return new object[] { "http://www.w3.org/2001/04/xmlenc#aes128-cbc", typeof(RijndaelManaged).FullName, true }; - yield return new object[] { "http://www.w3.org/2001/04/xmlenc#kw-aes128", typeof(RijndaelManaged).FullName, true }; - yield return new object[] { "http://www.w3.org/2001/04/xmlenc#aes192-cbc", typeof(RijndaelManaged).FullName, true }; - yield return new object[] { "http://www.w3.org/2001/04/xmlenc#kw-aes192", typeof(RijndaelManaged).FullName, true }; - yield return new object[] { "http://www.w3.org/2001/04/xmlenc#aes256-cbc", typeof(RijndaelManaged).FullName, true }; - yield return new object[] { "http://www.w3.org/2001/04/xmlenc#kw-aes256", typeof(RijndaelManaged).FullName, true }; - - // Xml Dsig HMAC URIs from http://www.w3.org/TR/xmldsig-core/ - yield return new object[] { "http://www.w3.org/2000/09/xmldsig#hmac-sha1", typeof(HMACSHA1).FullName, true }; - yield return new object[] { "http://www.w3.org/2001/04/xmldsig-more#sha384", typeof(SHA384Managed).FullName, true }; - yield return new object[] { "http://www.w3.org/2001/04/xmldsig-more#hmac-md5", typeof(HMACMD5).FullName, true }; - yield return new object[] { "http://www.w3.org/2001/04/xmldsig-more#hmac-sha256", typeof(HMACSHA256).FullName, true }; - yield return new object[] { "http://www.w3.org/2001/04/xmldsig-more#hmac-sha384", typeof(HMACSHA384).FullName, true }; - yield return new object[] { "http://www.w3.org/2001/04/xmldsig-more#hmac-sha512", typeof(HMACSHA512).FullName, true }; - - // X509 - yield return new object[] { "2.5.29.10", "System.Security.Cryptography.X509Certificates.X509BasicConstraintsExtension", true }; - yield return new object[] { "2.5.29.19", "System.Security.Cryptography.X509Certificates.X509BasicConstraintsExtension", true }; - yield return new object[] { "2.5.29.14", "System.Security.Cryptography.X509Certificates.X509SubjectKeyIdentifierExtension", true }; - yield return new object[] { "2.5.29.15", "System.Security.Cryptography.X509Certificates.X509KeyUsageExtension", true }; - yield return new object[] { "2.5.29.37", "System.Security.Cryptography.X509Certificates.X509EnhancedKeyUsageExtension", true }; - yield return new object[] { "X509Chain", "System.Security.Cryptography.X509Certificates.X509Chain", true }; - - // PKCS9 attributes - yield return new object[] { "1.2.840.113549.1.9.3", "System.Security.Cryptography.Pkcs.Pkcs9ContentType", true }; - yield return new object[] { "1.2.840.113549.1.9.4", "System.Security.Cryptography.Pkcs.Pkcs9MessageDigest", true }; - yield return new object[] { "1.2.840.113549.1.9.5", "System.Security.Cryptography.Pkcs.Pkcs9SigningTime", true }; - yield return new object[] { "1.3.6.1.4.1.311.88.2.1", "System.Security.Cryptography.Pkcs.Pkcs9DocumentName", true }; - yield return new object[] { "1.3.6.1.4.1.311.88.2.2", "System.Security.Cryptography.Pkcs.Pkcs9DocumentDescription", true }; - } - } - } - - [Theory, MemberData(nameof(AllValidNames))] - public static void CreateFromName_AllValidNames(string name, string typeName, bool supportsUnixMac) - { - bool isWindows = OperatingSystem.IsWindows(); - - if (supportsUnixMac || isWindows) - { - object obj = CryptoConfig.CreateFromName(name); - Assert.NotNull(obj); - - if (typeName == null) - { - typeName = name; - } - - // ECDsa is special on non-Windows - if (isWindows || name != "ECDsa") - { - Assert.Equal(typeName, obj.GetType().FullName); - } - else - { - Assert.NotEqual(typeName, obj.GetType().FullName); - } - - if (obj is IDisposable) - { - ((IDisposable)obj).Dispose(); - } - } - else - { - // These will be the Csp types, which currently aren't supported on Mac\Unix - Assert.Throws (() => CryptoConfig.CreateFromName(name)); - } - } - - [Fact] - [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] - public static void CreateFromName_CtorArguments() - { - string className = typeof(ClassWithCtorArguments).FullName + ", System.Security.Cryptography.Algorithms.Tests"; - - // Pass int instead of string - Assert.Throws(() => CryptoConfig.CreateFromName(className, 1)); - - // Valid case - object obj = CryptoConfig.CreateFromName(className, "Hello"); - Assert.NotNull(obj); - Assert.IsType(obj); - - ClassWithCtorArguments ctorObj = (ClassWithCtorArguments)obj; - Assert.Equal("Hello", ctorObj.MyString); - } - - [Fact] - [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] - public static void EncodeOID_Validation() - { -#pragma warning disable SYSLIB0031 // EncodeOID is obsolete - Assert.Throws(() => CryptoConfig.EncodeOID(null)); - Assert.Throws(() => CryptoConfig.EncodeOID(string.Empty)); - Assert.Throws(() => CryptoConfig.EncodeOID("BAD.OID")); - Assert.Throws(() => CryptoConfig.EncodeOID("1.2.BAD.OID")); - Assert.Throws(() => CryptoConfig.EncodeOID("1." + uint.MaxValue)); -#pragma warning restore SYSLIB0031 - } - - [Fact] - [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] - public static void EncodeOID_Compat() - { -#pragma warning disable SYSLIB0031 // EncodeOID is obsolete - string actual = CryptoConfig.EncodeOID("-1.2.-3").ByteArrayToHex(); - Assert.Equal("0602DAFD", actual); // Negative values not checked -#pragma warning restore SYSLIB0031 - } - - [Fact] - [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] - public static void EncodeOID_Length_Boundary() - { -#pragma warning disable SYSLIB0031 // EncodeOID is obsolete - string valueToRepeat = "1.1"; - - // Build a string like 1.11.11.11. ... .11.1, which has 0x80 separators. - // The BER/DER encoding of an OID has a minimum number of bytes as the number of separator characters, - // so this would produce an OID with a length segment of more than one byte, which EncodeOID can't handle. - string s = new StringBuilder(valueToRepeat.Length * 0x80).Insert(0, valueToRepeat, 0x80).ToString(); - Assert.Throws(() => CryptoConfig.EncodeOID(s)); - - // Try again with one less separator for the boundary case, but the particular output is really long - // and would just clutter up this test, so only verify it doesn't throw. - s = new StringBuilder(valueToRepeat.Length * 0x7f).Insert(0, valueToRepeat, 0x7f).ToString(); - CryptoConfig.EncodeOID(s); -#pragma warning restore SYSLIB0031 - } - - [Theory] - [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] - [InlineData(0x4000, "0603818028")] - [InlineData(0x200000, "060481808028")] - [InlineData(0x10000000, "06058180808028")] - [InlineData(0x10000001, "06058180808029")] - [InlineData(int.MaxValue, "060127")] - public static void EncodeOID_Value_Boundary_And_Compat(uint elementValue, string expectedEncoding) - { - // Boundary cases in EncodeOID; output may produce the wrong value mathematically due to encoding - // algorithm semantics but included here for compat reasons. -#pragma warning disable SYSLIB0031 // EncodeOID is obsolete - byte[] actual = CryptoConfig.EncodeOID("1." + elementValue.ToString()); - byte[] expected = expectedEncoding.HexToByteArray(); - Assert.Equal(expected, actual); -#pragma warning restore SYSLIB0031 - } - - [Theory] - [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] - [InlineData("SHA1", "1.3.14.3.2.26", "06052B0E03021A")] - [InlineData("DES", "1.3.14.3.2.7", "06052B0E030207")] - [InlineData("MD5", "1.2.840.113549.2.5", "06082A864886F70D0205")] - public static void MapAndEncodeOID(string alg, string expectedOid, string expectedEncoding) - { -#pragma warning disable SYSLIB0031 // EncodeOID is obsolete - string oid = CryptoConfig.MapNameToOID(alg); - Assert.Equal(expectedOid, oid); - - byte[] actual = CryptoConfig.EncodeOID(oid); - byte[] expected = expectedEncoding.HexToByteArray(); - Assert.Equal(expected, actual); -#pragma warning restore SYSLIB0031 - } - - private static void VerifyCreateFromName(string name) - { - object obj = CryptoConfig.CreateFromName(name); - Assert.NotNull(obj); - Assert.IsType(obj); - } - - public class ClassWithCtorArguments - { - public ClassWithCtorArguments(string s) - { - MyString = s; - } - - public string MyString; - } - } -} - -#pragma warning restore SYSLIB0022 diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/System.Security.Cryptography.Algorithms.Tests.csproj b/src/libraries/System.Security.Cryptography.Algorithms/tests/System.Security.Cryptography.Algorithms.Tests.csproj deleted file mode 100644 index c6baa15e7b6498..00000000000000 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/System.Security.Cryptography.Algorithms.Tests.csproj +++ /dev/null @@ -1,264 +0,0 @@ - - - $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Android;$(NetCoreAppCurrent)-Browser - true - true - - $(NoWarn);SYSLIB0021 - true - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/libraries/System.Security.Cryptography.Csp/src/Resources/Strings.resx b/src/libraries/System.Security.Cryptography.Csp/src/Resources/Strings.resx index 79ece78b5d9d8c..0c2d22c90f61a2 100644 --- a/src/libraries/System.Security.Cryptography.Csp/src/Resources/Strings.resx +++ b/src/libraries/System.Security.Cryptography.Csp/src/Resources/Strings.resx @@ -122,6 +122,9 @@ Value was invalid. + + Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection. + Non-negative number required. diff --git a/src/libraries/System.Security.Cryptography/ref/System.Security.Cryptography.cs b/src/libraries/System.Security.Cryptography/ref/System.Security.Cryptography.cs index 6a76359cc41fd2..c8ffe81724a602 100644 --- a/src/libraries/System.Security.Cryptography/ref/System.Security.Cryptography.cs +++ b/src/libraries/System.Security.Cryptography/ref/System.Security.Cryptography.cs @@ -6,6 +6,69 @@ namespace System.Security.Cryptography { + public abstract partial class Aes : System.Security.Cryptography.SymmetricAlgorithm + { + protected Aes() { } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + public static new System.Security.Cryptography.Aes Create() { throw null; } + [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")] + public static new System.Security.Cryptography.Aes? Create(string algorithmName) { throw null; } + } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] + public sealed partial class AesCcm : System.IDisposable + { + public AesCcm(byte[] key) { } + public AesCcm(System.ReadOnlySpan key) { } + public static bool IsSupported { get { throw null; } } + public static System.Security.Cryptography.KeySizes NonceByteSizes { get { throw null; } } + public static System.Security.Cryptography.KeySizes TagByteSizes { get { throw null; } } + public void Decrypt(byte[] nonce, byte[] ciphertext, byte[] tag, byte[] plaintext, byte[]? associatedData = null) { } + public void Decrypt(System.ReadOnlySpan nonce, System.ReadOnlySpan ciphertext, System.ReadOnlySpan tag, System.Span plaintext, System.ReadOnlySpan associatedData = default(System.ReadOnlySpan)) { } + public void Dispose() { } + public void Encrypt(byte[] nonce, byte[] plaintext, byte[] ciphertext, byte[] tag, byte[]? associatedData = null) { } + public void Encrypt(System.ReadOnlySpan nonce, System.ReadOnlySpan plaintext, System.Span ciphertext, System.Span tag, System.ReadOnlySpan associatedData = default(System.ReadOnlySpan)) { } + } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] + public sealed partial class AesGcm : System.IDisposable + { + public AesGcm(byte[] key) { } + public AesGcm(System.ReadOnlySpan key) { } + public static bool IsSupported { get { throw null; } } + public static System.Security.Cryptography.KeySizes NonceByteSizes { get { throw null; } } + public static System.Security.Cryptography.KeySizes TagByteSizes { get { throw null; } } + public void Decrypt(byte[] nonce, byte[] ciphertext, byte[] tag, byte[] plaintext, byte[]? associatedData = null) { } + public void Decrypt(System.ReadOnlySpan nonce, System.ReadOnlySpan ciphertext, System.ReadOnlySpan tag, System.Span plaintext, System.ReadOnlySpan associatedData = default(System.ReadOnlySpan)) { } + public void Dispose() { } + public void Encrypt(byte[] nonce, byte[] plaintext, byte[] ciphertext, byte[] tag, byte[]? associatedData = null) { } + public void Encrypt(System.ReadOnlySpan nonce, System.ReadOnlySpan plaintext, System.Span ciphertext, System.Span tag, System.ReadOnlySpan associatedData = default(System.ReadOnlySpan)) { } + } + [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the base type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + public sealed partial class AesManaged : System.Security.Cryptography.Aes + { + public AesManaged() { } + public override int BlockSize { get { throw null; } set { } } + public override int FeedbackSize { get { throw null; } set { } } + public override byte[] IV { get { throw null; } set { } } + public override byte[] Key { get { throw null; } set { } } + public override int KeySize { get { throw null; } set { } } + public override System.Security.Cryptography.KeySizes[] LegalBlockSizes { get { throw null; } } + public override System.Security.Cryptography.KeySizes[] LegalKeySizes { get { throw null; } } + public override System.Security.Cryptography.CipherMode Mode { get { throw null; } set { } } + public override System.Security.Cryptography.PaddingMode Padding { get { throw null; } set { } } + public override System.Security.Cryptography.ICryptoTransform CreateDecryptor() { throw null; } + public override System.Security.Cryptography.ICryptoTransform CreateDecryptor(byte[] rgbKey, byte[]? rgbIV) { throw null; } + public override System.Security.Cryptography.ICryptoTransform CreateEncryptor() { throw null; } + public override System.Security.Cryptography.ICryptoTransform CreateEncryptor(byte[] rgbKey, byte[]? rgbIV) { throw null; } + protected override void Dispose(bool disposing) { } + public override void GenerateIV() { } + public override void GenerateKey() { } + } public partial class AsnEncodedData { protected AsnEncodedData() { } @@ -85,7 +148,13 @@ public virtual void ImportFromPem(System.ReadOnlySpan input) { } public virtual bool TryExportSubjectPublicKeyInfo(System.Span destination, out int bytesWritten) { throw null; } public bool TryExportSubjectPublicKeyInfoPem(System.Span destination, out int charsWritten) { throw null; } } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + public abstract partial class AsymmetricKeyExchangeDeformatter + { + protected AsymmetricKeyExchangeDeformatter() { } + public abstract string? Parameters { get; set; } + public abstract byte[] DecryptKeyExchange(byte[] rgb); + public abstract void SetKey(System.Security.Cryptography.AsymmetricAlgorithm key); + } public abstract partial class AsymmetricKeyExchangeFormatter { protected AsymmetricKeyExchangeFormatter() { } @@ -94,6 +163,36 @@ protected AsymmetricKeyExchangeFormatter() { } public abstract byte[] CreateKeyExchange(byte[] data, System.Type? symAlgType); public abstract void SetKey(System.Security.Cryptography.AsymmetricAlgorithm key); } + public abstract partial class AsymmetricSignatureDeformatter + { + protected AsymmetricSignatureDeformatter() { } + public abstract void SetHashAlgorithm(string strName); + public abstract void SetKey(System.Security.Cryptography.AsymmetricAlgorithm key); + public abstract bool VerifySignature(byte[] rgbHash, byte[] rgbSignature); + public virtual bool VerifySignature(System.Security.Cryptography.HashAlgorithm hash, byte[] rgbSignature) { throw null; } + } + public abstract partial class AsymmetricSignatureFormatter + { + protected AsymmetricSignatureFormatter() { } + public abstract byte[] CreateSignature(byte[] rgbHash); + public virtual byte[] CreateSignature(System.Security.Cryptography.HashAlgorithm hash) { throw null; } + public abstract void SetHashAlgorithm(string strName); + public abstract void SetKey(System.Security.Cryptography.AsymmetricAlgorithm key); + } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] + public sealed partial class ChaCha20Poly1305 : System.IDisposable + { + public ChaCha20Poly1305(byte[] key) { } + public ChaCha20Poly1305(System.ReadOnlySpan key) { } + public static bool IsSupported { get { throw null; } } + public void Decrypt(byte[] nonce, byte[] ciphertext, byte[] tag, byte[] plaintext, byte[]? associatedData = null) { } + public void Decrypt(System.ReadOnlySpan nonce, System.ReadOnlySpan ciphertext, System.ReadOnlySpan tag, System.Span plaintext, System.ReadOnlySpan associatedData = default(System.ReadOnlySpan)) { } + public void Dispose() { } + public void Encrypt(byte[] nonce, byte[] plaintext, byte[] ciphertext, byte[] tag, byte[]? associatedData = null) { } + public void Encrypt(System.ReadOnlySpan nonce, System.ReadOnlySpan plaintext, System.Span ciphertext, System.Span tag, System.ReadOnlySpan associatedData = default(System.ReadOnlySpan)) { } + } public enum CipherMode { CBC = 1, @@ -103,6 +202,24 @@ public enum CipherMode CFB = 4, CTS = 5, } + public partial class CryptoConfig + { + public CryptoConfig() { } + public static bool AllowOnlyFipsAlgorithms { get { throw null; } } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + public static void AddAlgorithm(System.Type algorithm, params string[] names) { } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + public static void AddOID(string oid, params string[] names) { } + [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")] + public static object? CreateFromName(string name) { throw null; } + [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")] + public static object? CreateFromName(string name, params object?[]? args) { throw null; } + [System.ObsoleteAttribute("EncodeOID is obsolete. Use the ASN.1 functionality provided in System.Formats.Asn1.", DiagnosticId = "SYSLIB0031", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + public static byte[] EncodeOID(string str) { throw null; } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + public static string? MapNameToOID(string name) { throw null; } + } public static partial class CryptographicOperations { public static bool FixedTimeEquals(System.ReadOnlySpan left, System.ReadOnlySpan right) { throw null; } @@ -155,6 +272,316 @@ public enum CryptoStreamMode Read = 0, Write = 1, } + public abstract partial class DeriveBytes : System.IDisposable + { + protected DeriveBytes() { } + public void Dispose() { } + protected virtual void Dispose(bool disposing) { } + public abstract byte[] GetBytes(int cb); + public abstract void Reset(); + } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public abstract partial class DES : System.Security.Cryptography.SymmetricAlgorithm + { + protected DES() { } + public override byte[] Key { get { throw null; } set { } } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + public static new System.Security.Cryptography.DES Create() { throw null; } + [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")] + public static new System.Security.Cryptography.DES? Create(string algName) { throw null; } + public static bool IsSemiWeakKey(byte[] rgbKey) { throw null; } + public static bool IsWeakKey(byte[] rgbKey) { throw null; } + } + public abstract partial class DSA : System.Security.Cryptography.AsymmetricAlgorithm + { + protected DSA() { } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] + public static new System.Security.Cryptography.DSA Create() { throw null; } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] + public static System.Security.Cryptography.DSA Create(int keySizeInBits) { throw null; } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] + public static System.Security.Cryptography.DSA Create(System.Security.Cryptography.DSAParameters parameters) { throw null; } + [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")] + public static new System.Security.Cryptography.DSA? Create(string algName) { throw null; } + public abstract byte[] CreateSignature(byte[] rgbHash); + public byte[] CreateSignature(byte[] rgbHash, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } + protected virtual byte[] CreateSignatureCore(System.ReadOnlySpan hash, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } + public abstract System.Security.Cryptography.DSAParameters ExportParameters(bool includePrivateParameters); + public override void FromXmlString(string xmlString) { } + public int GetMaxSignatureSize(System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } + protected virtual byte[] HashData(byte[] data, int offset, int count, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { throw null; } + protected virtual byte[] HashData(System.IO.Stream data, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { throw null; } + public override void ImportEncryptedPkcs8PrivateKey(System.ReadOnlySpan passwordBytes, System.ReadOnlySpan source, out int bytesRead) { throw null; } + public override void ImportEncryptedPkcs8PrivateKey(System.ReadOnlySpan password, System.ReadOnlySpan source, out int bytesRead) { throw null; } + public override void ImportFromEncryptedPem(System.ReadOnlySpan input, System.ReadOnlySpan passwordBytes) { } + public override void ImportFromEncryptedPem(System.ReadOnlySpan input, System.ReadOnlySpan password) { } + public override void ImportFromPem(System.ReadOnlySpan input) { } + public abstract void ImportParameters(System.Security.Cryptography.DSAParameters parameters); + public override void ImportPkcs8PrivateKey(System.ReadOnlySpan source, out int bytesRead) { throw null; } + public override void ImportSubjectPublicKeyInfo(System.ReadOnlySpan source, out int bytesRead) { throw null; } + public virtual byte[] SignData(byte[] data, int offset, int count, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { throw null; } + public byte[] SignData(byte[] data, int offset, int count, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } + public byte[] SignData(byte[] data, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { throw null; } + public byte[] SignData(byte[] data, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } + public virtual byte[] SignData(System.IO.Stream data, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { throw null; } + public byte[] SignData(System.IO.Stream data, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } + protected virtual byte[] SignDataCore(System.IO.Stream data, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } + protected virtual byte[] SignDataCore(System.ReadOnlySpan data, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } + public override string ToXmlString(bool includePrivateParameters) { throw null; } + public virtual bool TryCreateSignature(System.ReadOnlySpan hash, System.Span destination, out int bytesWritten) { throw null; } + public bool TryCreateSignature(System.ReadOnlySpan hash, System.Span destination, System.Security.Cryptography.DSASignatureFormat signatureFormat, out int bytesWritten) { throw null; } + protected virtual bool TryCreateSignatureCore(System.ReadOnlySpan hash, System.Span destination, System.Security.Cryptography.DSASignatureFormat signatureFormat, out int bytesWritten) { throw null; } + public override bool TryExportEncryptedPkcs8PrivateKey(System.ReadOnlySpan passwordBytes, System.Security.Cryptography.PbeParameters pbeParameters, System.Span destination, out int bytesWritten) { throw null; } + public override bool TryExportEncryptedPkcs8PrivateKey(System.ReadOnlySpan password, System.Security.Cryptography.PbeParameters pbeParameters, System.Span destination, out int bytesWritten) { throw null; } + public override bool TryExportPkcs8PrivateKey(System.Span destination, out int bytesWritten) { throw null; } + public override bool TryExportSubjectPublicKeyInfo(System.Span destination, out int bytesWritten) { throw null; } + protected virtual bool TryHashData(System.ReadOnlySpan data, System.Span destination, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, out int bytesWritten) { throw null; } + public virtual bool TrySignData(System.ReadOnlySpan data, System.Span destination, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, out int bytesWritten) { throw null; } + public bool TrySignData(System.ReadOnlySpan data, System.Span destination, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat, out int bytesWritten) { throw null; } + protected virtual bool TrySignDataCore(System.ReadOnlySpan data, System.Span destination, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat, out int bytesWritten) { throw null; } + public bool VerifyData(byte[] data, byte[] signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { throw null; } + public bool VerifyData(byte[] data, byte[] signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } + public virtual bool VerifyData(byte[] data, int offset, int count, byte[] signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { throw null; } + public bool VerifyData(byte[] data, int offset, int count, byte[] signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } + public virtual bool VerifyData(System.IO.Stream data, byte[] signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { throw null; } + public bool VerifyData(System.IO.Stream data, byte[] signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } + public virtual bool VerifyData(System.ReadOnlySpan data, System.ReadOnlySpan signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { throw null; } + public bool VerifyData(System.ReadOnlySpan data, System.ReadOnlySpan signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } + protected virtual bool VerifyDataCore(System.IO.Stream data, System.ReadOnlySpan signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } + protected virtual bool VerifyDataCore(System.ReadOnlySpan data, System.ReadOnlySpan signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } + public abstract bool VerifySignature(byte[] rgbHash, byte[] rgbSignature); + public bool VerifySignature(byte[] rgbHash, byte[] rgbSignature, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } + public virtual bool VerifySignature(System.ReadOnlySpan hash, System.ReadOnlySpan signature) { throw null; } + public bool VerifySignature(System.ReadOnlySpan hash, System.ReadOnlySpan signature, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } + protected virtual bool VerifySignatureCore(System.ReadOnlySpan hash, System.ReadOnlySpan signature, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } + } + public partial struct DSAParameters + { + public int Counter; + public byte[]? G; + public byte[]? J; + public byte[]? P; + public byte[]? Q; + public byte[]? Seed; + public byte[]? X; + public byte[]? Y; + } + public partial class DSASignatureDeformatter : System.Security.Cryptography.AsymmetricSignatureDeformatter + { + public DSASignatureDeformatter() { } + public DSASignatureDeformatter(System.Security.Cryptography.AsymmetricAlgorithm key) { } + public override void SetHashAlgorithm(string strName) { } + public override void SetKey(System.Security.Cryptography.AsymmetricAlgorithm key) { } + public override bool VerifySignature(byte[] rgbHash, byte[] rgbSignature) { throw null; } + } + public enum DSASignatureFormat + { + IeeeP1363FixedFieldConcatenation = 0, + Rfc3279DerSequence = 1, + } + public partial class DSASignatureFormatter : System.Security.Cryptography.AsymmetricSignatureFormatter + { + public DSASignatureFormatter() { } + public DSASignatureFormatter(System.Security.Cryptography.AsymmetricAlgorithm key) { } + public override byte[] CreateSignature(byte[] rgbHash) { throw null; } + public override void SetHashAlgorithm(string strName) { } + public override void SetKey(System.Security.Cryptography.AsymmetricAlgorithm key) { } + } + public partial struct ECCurve + { + private object _dummy; + private int _dummyPrimitive; + public byte[]? A; + public byte[]? B; + public byte[]? Cofactor; + public System.Security.Cryptography.ECCurve.ECCurveType CurveType; + public System.Security.Cryptography.ECPoint G; + public System.Security.Cryptography.HashAlgorithmName? Hash; + public byte[]? Order; + public byte[]? Polynomial; + public byte[]? Prime; + public byte[]? Seed; + public bool IsCharacteristic2 { get { throw null; } } + public bool IsExplicit { get { throw null; } } + public bool IsNamed { get { throw null; } } + public bool IsPrime { get { throw null; } } + public System.Security.Cryptography.Oid Oid { get { throw null; } } + public static System.Security.Cryptography.ECCurve CreateFromFriendlyName(string oidFriendlyName) { throw null; } + public static System.Security.Cryptography.ECCurve CreateFromOid(System.Security.Cryptography.Oid curveOid) { throw null; } + public static System.Security.Cryptography.ECCurve CreateFromValue(string oidValue) { throw null; } + public void Validate() { } + public enum ECCurveType + { + Implicit = 0, + PrimeShortWeierstrass = 1, + PrimeTwistedEdwards = 2, + PrimeMontgomery = 3, + Characteristic2 = 4, + Named = 5, + } + public static partial class NamedCurves + { + public static System.Security.Cryptography.ECCurve brainpoolP160r1 { get { throw null; } } + public static System.Security.Cryptography.ECCurve brainpoolP160t1 { get { throw null; } } + public static System.Security.Cryptography.ECCurve brainpoolP192r1 { get { throw null; } } + public static System.Security.Cryptography.ECCurve brainpoolP192t1 { get { throw null; } } + public static System.Security.Cryptography.ECCurve brainpoolP224r1 { get { throw null; } } + public static System.Security.Cryptography.ECCurve brainpoolP224t1 { get { throw null; } } + public static System.Security.Cryptography.ECCurve brainpoolP256r1 { get { throw null; } } + public static System.Security.Cryptography.ECCurve brainpoolP256t1 { get { throw null; } } + public static System.Security.Cryptography.ECCurve brainpoolP320r1 { get { throw null; } } + public static System.Security.Cryptography.ECCurve brainpoolP320t1 { get { throw null; } } + public static System.Security.Cryptography.ECCurve brainpoolP384r1 { get { throw null; } } + public static System.Security.Cryptography.ECCurve brainpoolP384t1 { get { throw null; } } + public static System.Security.Cryptography.ECCurve brainpoolP512r1 { get { throw null; } } + public static System.Security.Cryptography.ECCurve brainpoolP512t1 { get { throw null; } } + public static System.Security.Cryptography.ECCurve nistP256 { get { throw null; } } + public static System.Security.Cryptography.ECCurve nistP384 { get { throw null; } } + public static System.Security.Cryptography.ECCurve nistP521 { get { throw null; } } + } + } + public abstract partial class ECDiffieHellman : System.Security.Cryptography.AsymmetricAlgorithm + { + protected ECDiffieHellman() { } + public override string KeyExchangeAlgorithm { get { throw null; } } + public abstract System.Security.Cryptography.ECDiffieHellmanPublicKey PublicKey { get; } + public override string? SignatureAlgorithm { get { throw null; } } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + public static new System.Security.Cryptography.ECDiffieHellman Create() { throw null; } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + public static System.Security.Cryptography.ECDiffieHellman Create(System.Security.Cryptography.ECCurve curve) { throw null; } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + public static System.Security.Cryptography.ECDiffieHellman Create(System.Security.Cryptography.ECParameters parameters) { throw null; } + [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")] + public static new System.Security.Cryptography.ECDiffieHellman? Create(string algorithm) { throw null; } + public byte[] DeriveKeyFromHash(System.Security.Cryptography.ECDiffieHellmanPublicKey otherPartyPublicKey, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { throw null; } + public virtual byte[] DeriveKeyFromHash(System.Security.Cryptography.ECDiffieHellmanPublicKey otherPartyPublicKey, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, byte[]? secretPrepend, byte[]? secretAppend) { throw null; } + public byte[] DeriveKeyFromHmac(System.Security.Cryptography.ECDiffieHellmanPublicKey otherPartyPublicKey, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, byte[]? hmacKey) { throw null; } + public virtual byte[] DeriveKeyFromHmac(System.Security.Cryptography.ECDiffieHellmanPublicKey otherPartyPublicKey, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, byte[]? hmacKey, byte[]? secretPrepend, byte[]? secretAppend) { throw null; } + public virtual byte[] DeriveKeyMaterial(System.Security.Cryptography.ECDiffieHellmanPublicKey otherPartyPublicKey) { throw null; } + public virtual byte[] DeriveKeyTls(System.Security.Cryptography.ECDiffieHellmanPublicKey otherPartyPublicKey, byte[] prfLabel, byte[] prfSeed) { throw null; } + public virtual byte[] ExportECPrivateKey() { throw null; } + public virtual System.Security.Cryptography.ECParameters ExportExplicitParameters(bool includePrivateParameters) { throw null; } + public virtual System.Security.Cryptography.ECParameters ExportParameters(bool includePrivateParameters) { throw null; } + public override void FromXmlString(string xmlString) { } + public virtual void GenerateKey(System.Security.Cryptography.ECCurve curve) { } + public virtual void ImportECPrivateKey(System.ReadOnlySpan source, out int bytesRead) { throw null; } + public override void ImportEncryptedPkcs8PrivateKey(System.ReadOnlySpan passwordBytes, System.ReadOnlySpan source, out int bytesRead) { throw null; } + public override void ImportEncryptedPkcs8PrivateKey(System.ReadOnlySpan password, System.ReadOnlySpan source, out int bytesRead) { throw null; } + public override void ImportFromEncryptedPem(System.ReadOnlySpan input, System.ReadOnlySpan passwordBytes) { } + public override void ImportFromEncryptedPem(System.ReadOnlySpan input, System.ReadOnlySpan password) { } + public override void ImportFromPem(System.ReadOnlySpan input) { } + public virtual void ImportParameters(System.Security.Cryptography.ECParameters parameters) { } + public override void ImportPkcs8PrivateKey(System.ReadOnlySpan source, out int bytesRead) { throw null; } + public override void ImportSubjectPublicKeyInfo(System.ReadOnlySpan source, out int bytesRead) { throw null; } + public override string ToXmlString(bool includePrivateParameters) { throw null; } + public virtual bool TryExportECPrivateKey(System.Span destination, out int bytesWritten) { throw null; } + public override bool TryExportEncryptedPkcs8PrivateKey(System.ReadOnlySpan passwordBytes, System.Security.Cryptography.PbeParameters pbeParameters, System.Span destination, out int bytesWritten) { throw null; } + public override bool TryExportEncryptedPkcs8PrivateKey(System.ReadOnlySpan password, System.Security.Cryptography.PbeParameters pbeParameters, System.Span destination, out int bytesWritten) { throw null; } + public override bool TryExportPkcs8PrivateKey(System.Span destination, out int bytesWritten) { throw null; } + public override bool TryExportSubjectPublicKeyInfo(System.Span destination, out int bytesWritten) { throw null; } + } + public abstract partial class ECDiffieHellmanPublicKey : System.IDisposable + { + protected ECDiffieHellmanPublicKey() { } + protected ECDiffieHellmanPublicKey(byte[] keyBlob) { } + public void Dispose() { } + protected virtual void Dispose(bool disposing) { } + public virtual System.Security.Cryptography.ECParameters ExportExplicitParameters() { throw null; } + public virtual System.Security.Cryptography.ECParameters ExportParameters() { throw null; } + public virtual byte[] ExportSubjectPublicKeyInfo() { throw null; } + public virtual byte[] ToByteArray() { throw null; } + public virtual string ToXmlString() { throw null; } + public virtual bool TryExportSubjectPublicKeyInfo(System.Span destination, out int bytesWritten) { throw null; } + } + public abstract partial class ECDsa : System.Security.Cryptography.AsymmetricAlgorithm + { + protected ECDsa() { } + public override string? KeyExchangeAlgorithm { get { throw null; } } + public override string SignatureAlgorithm { get { throw null; } } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + public static new System.Security.Cryptography.ECDsa Create() { throw null; } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + public static System.Security.Cryptography.ECDsa Create(System.Security.Cryptography.ECCurve curve) { throw null; } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + public static System.Security.Cryptography.ECDsa Create(System.Security.Cryptography.ECParameters parameters) { throw null; } + [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")] + public static new System.Security.Cryptography.ECDsa? Create(string algorithm) { throw null; } + public virtual byte[] ExportECPrivateKey() { throw null; } + public virtual System.Security.Cryptography.ECParameters ExportExplicitParameters(bool includePrivateParameters) { throw null; } + public virtual System.Security.Cryptography.ECParameters ExportParameters(bool includePrivateParameters) { throw null; } + public override void FromXmlString(string xmlString) { } + public virtual void GenerateKey(System.Security.Cryptography.ECCurve curve) { } + public int GetMaxSignatureSize(System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } + protected virtual byte[] HashData(byte[] data, int offset, int count, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { throw null; } + protected virtual byte[] HashData(System.IO.Stream data, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { throw null; } + public virtual void ImportECPrivateKey(System.ReadOnlySpan source, out int bytesRead) { throw null; } + public override void ImportEncryptedPkcs8PrivateKey(System.ReadOnlySpan passwordBytes, System.ReadOnlySpan source, out int bytesRead) { throw null; } + public override void ImportEncryptedPkcs8PrivateKey(System.ReadOnlySpan password, System.ReadOnlySpan source, out int bytesRead) { throw null; } + public override void ImportFromEncryptedPem(System.ReadOnlySpan input, System.ReadOnlySpan passwordBytes) { } + public override void ImportFromEncryptedPem(System.ReadOnlySpan input, System.ReadOnlySpan password) { } + public override void ImportFromPem(System.ReadOnlySpan input) { } + public virtual void ImportParameters(System.Security.Cryptography.ECParameters parameters) { } + public override void ImportPkcs8PrivateKey(System.ReadOnlySpan source, out int bytesRead) { throw null; } + public override void ImportSubjectPublicKeyInfo(System.ReadOnlySpan source, out int bytesRead) { throw null; } + public virtual byte[] SignData(byte[] data, int offset, int count, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { throw null; } + public byte[] SignData(byte[] data, int offset, int count, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } + public virtual byte[] SignData(byte[] data, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { throw null; } + public byte[] SignData(byte[] data, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } + public virtual byte[] SignData(System.IO.Stream data, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { throw null; } + public byte[] SignData(System.IO.Stream data, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } + protected virtual byte[] SignDataCore(System.IO.Stream data, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } + protected virtual byte[] SignDataCore(System.ReadOnlySpan data, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } + public abstract byte[] SignHash(byte[] hash); + public byte[] SignHash(byte[] hash, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } + protected virtual byte[] SignHashCore(System.ReadOnlySpan hash, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } + public override string ToXmlString(bool includePrivateParameters) { throw null; } + public virtual bool TryExportECPrivateKey(System.Span destination, out int bytesWritten) { throw null; } + public override bool TryExportEncryptedPkcs8PrivateKey(System.ReadOnlySpan passwordBytes, System.Security.Cryptography.PbeParameters pbeParameters, System.Span destination, out int bytesWritten) { throw null; } + public override bool TryExportEncryptedPkcs8PrivateKey(System.ReadOnlySpan password, System.Security.Cryptography.PbeParameters pbeParameters, System.Span destination, out int bytesWritten) { throw null; } + public override bool TryExportPkcs8PrivateKey(System.Span destination, out int bytesWritten) { throw null; } + public override bool TryExportSubjectPublicKeyInfo(System.Span destination, out int bytesWritten) { throw null; } + protected virtual bool TryHashData(System.ReadOnlySpan data, System.Span destination, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, out int bytesWritten) { throw null; } + public virtual bool TrySignData(System.ReadOnlySpan data, System.Span destination, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, out int bytesWritten) { throw null; } + public bool TrySignData(System.ReadOnlySpan data, System.Span destination, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat, out int bytesWritten) { throw null; } + protected virtual bool TrySignDataCore(System.ReadOnlySpan data, System.Span destination, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat, out int bytesWritten) { throw null; } + public virtual bool TrySignHash(System.ReadOnlySpan hash, System.Span destination, out int bytesWritten) { throw null; } + public bool TrySignHash(System.ReadOnlySpan hash, System.Span destination, System.Security.Cryptography.DSASignatureFormat signatureFormat, out int bytesWritten) { throw null; } + protected virtual bool TrySignHashCore(System.ReadOnlySpan hash, System.Span destination, System.Security.Cryptography.DSASignatureFormat signatureFormat, out int bytesWritten) { throw null; } + public bool VerifyData(byte[] data, byte[] signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { throw null; } + public bool VerifyData(byte[] data, byte[] signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } + public virtual bool VerifyData(byte[] data, int offset, int count, byte[] signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { throw null; } + public bool VerifyData(byte[] data, int offset, int count, byte[] signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } + public bool VerifyData(System.IO.Stream data, byte[] signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { throw null; } + public bool VerifyData(System.IO.Stream data, byte[] signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } + public virtual bool VerifyData(System.ReadOnlySpan data, System.ReadOnlySpan signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { throw null; } + public bool VerifyData(System.ReadOnlySpan data, System.ReadOnlySpan signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } + protected virtual bool VerifyDataCore(System.IO.Stream data, System.ReadOnlySpan signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } + protected virtual bool VerifyDataCore(System.ReadOnlySpan data, System.ReadOnlySpan signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } + public abstract bool VerifyHash(byte[] hash, byte[] signature); + public bool VerifyHash(byte[] hash, byte[] signature, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } + public virtual bool VerifyHash(System.ReadOnlySpan hash, System.ReadOnlySpan signature) { throw null; } + public bool VerifyHash(System.ReadOnlySpan hash, System.ReadOnlySpan signature, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } + protected virtual bool VerifyHashCore(System.ReadOnlySpan hash, System.ReadOnlySpan signature, System.Security.Cryptography.DSASignatureFormat signatureFormat) { throw null; } + } + public partial struct ECParameters + { + public System.Security.Cryptography.ECCurve Curve; + public byte[]? D; + public System.Security.Cryptography.ECPoint Q; + public void Validate() { } + } + public partial struct ECPoint + { + public byte[]? X; + public byte[]? Y; + } public partial class FromBase64Transform : System.IDisposable, System.Security.Cryptography.ICryptoTransform { public FromBase64Transform() { } @@ -227,6 +654,16 @@ protected virtual void HashCore(System.ReadOnlySpan source) { } public override string ToString() { throw null; } public static bool TryFromOid(string oidValue, out System.Security.Cryptography.HashAlgorithmName value) { throw null; } } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + public static partial class HKDF + { + public static byte[] DeriveKey(System.Security.Cryptography.HashAlgorithmName hashAlgorithmName, byte[] ikm, int outputLength, byte[]? salt = null, byte[]? info = null) { throw null; } + public static void DeriveKey(System.Security.Cryptography.HashAlgorithmName hashAlgorithmName, System.ReadOnlySpan ikm, System.Span output, System.ReadOnlySpan salt, System.ReadOnlySpan info) { } + public static byte[] Expand(System.Security.Cryptography.HashAlgorithmName hashAlgorithmName, byte[] prk, int outputLength, byte[]? info = null) { throw null; } + public static void Expand(System.Security.Cryptography.HashAlgorithmName hashAlgorithmName, System.ReadOnlySpan prk, System.Span output, System.ReadOnlySpan info) { } + public static byte[] Extract(System.Security.Cryptography.HashAlgorithmName hashAlgorithmName, byte[] ikm, byte[]? salt = null) { throw null; } + public static int Extract(System.Security.Cryptography.HashAlgorithmName hashAlgorithmName, System.ReadOnlySpan ikm, System.ReadOnlySpan salt, System.Span prk) { throw null; } + } public abstract partial class HMAC : System.Security.Cryptography.KeyedHashAlgorithm { protected HMAC() { } @@ -244,6 +681,98 @@ protected override void HashCore(System.ReadOnlySpan source) { } public override void Initialize() { } protected override bool TryHashFinal(System.Span destination, out int bytesWritten) { throw null; } } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + public partial class HMACMD5 : System.Security.Cryptography.HMAC + { + public HMACMD5() { } + public HMACMD5(byte[] key) { } + public override byte[] Key { get { throw null; } set { } } + protected override void Dispose(bool disposing) { } + protected override void HashCore(byte[] rgb, int ib, int cb) { } + protected override void HashCore(System.ReadOnlySpan source) { } + public static byte[] HashData(byte[] key, byte[] source) { throw null; } + public static byte[] HashData(System.ReadOnlySpan key, System.ReadOnlySpan source) { throw null; } + public static int HashData(System.ReadOnlySpan key, System.ReadOnlySpan source, System.Span destination) { throw null; } + protected override byte[] HashFinal() { throw null; } + public override void Initialize() { } + public static bool TryHashData(System.ReadOnlySpan key, System.ReadOnlySpan source, System.Span destination, out int bytesWritten) { throw null; } + protected override bool TryHashFinal(System.Span destination, out int bytesWritten) { throw null; } + } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + public partial class HMACSHA1 : System.Security.Cryptography.HMAC + { + public HMACSHA1() { } + public HMACSHA1(byte[] key) { } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + [System.ObsoleteAttribute("HMACSHA1 always uses the algorithm implementation provided by the platform. Use a constructor without the useManagedSha1 parameter.", DiagnosticId = "SYSLIB0030", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + public HMACSHA1(byte[] key, bool useManagedSha1) { } + public override byte[] Key { get { throw null; } set { } } + protected override void Dispose(bool disposing) { } + protected override void HashCore(byte[] rgb, int ib, int cb) { } + protected override void HashCore(System.ReadOnlySpan source) { } + public static byte[] HashData(byte[] key, byte[] source) { throw null; } + public static byte[] HashData(System.ReadOnlySpan key, System.ReadOnlySpan source) { throw null; } + public static int HashData(System.ReadOnlySpan key, System.ReadOnlySpan source, System.Span destination) { throw null; } + protected override byte[] HashFinal() { throw null; } + public override void Initialize() { } + public static bool TryHashData(System.ReadOnlySpan key, System.ReadOnlySpan source, System.Span destination, out int bytesWritten) { throw null; } + protected override bool TryHashFinal(System.Span destination, out int bytesWritten) { throw null; } + } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + public partial class HMACSHA256 : System.Security.Cryptography.HMAC + { + public HMACSHA256() { } + public HMACSHA256(byte[] key) { } + public override byte[] Key { get { throw null; } set { } } + protected override void Dispose(bool disposing) { } + protected override void HashCore(byte[] rgb, int ib, int cb) { } + protected override void HashCore(System.ReadOnlySpan source) { } + public static byte[] HashData(byte[] key, byte[] source) { throw null; } + public static byte[] HashData(System.ReadOnlySpan key, System.ReadOnlySpan source) { throw null; } + public static int HashData(System.ReadOnlySpan key, System.ReadOnlySpan source, System.Span destination) { throw null; } + protected override byte[] HashFinal() { throw null; } + public override void Initialize() { } + public static bool TryHashData(System.ReadOnlySpan key, System.ReadOnlySpan source, System.Span destination, out int bytesWritten) { throw null; } + protected override bool TryHashFinal(System.Span destination, out int bytesWritten) { throw null; } + } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + public partial class HMACSHA384 : System.Security.Cryptography.HMAC + { + public HMACSHA384() { } + public HMACSHA384(byte[] key) { } + public override byte[] Key { get { throw null; } set { } } + [System.ObsoleteAttribute("ProduceLegacyHmacValues is obsolete. Producing legacy HMAC values is not supported.", DiagnosticId = "SYSLIB0029", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + public bool ProduceLegacyHmacValues { get { throw null; } set { } } + protected override void Dispose(bool disposing) { } + protected override void HashCore(byte[] rgb, int ib, int cb) { } + protected override void HashCore(System.ReadOnlySpan source) { } + public static byte[] HashData(byte[] key, byte[] source) { throw null; } + public static byte[] HashData(System.ReadOnlySpan key, System.ReadOnlySpan source) { throw null; } + public static int HashData(System.ReadOnlySpan key, System.ReadOnlySpan source, System.Span destination) { throw null; } + protected override byte[] HashFinal() { throw null; } + public override void Initialize() { } + public static bool TryHashData(System.ReadOnlySpan key, System.ReadOnlySpan source, System.Span destination, out int bytesWritten) { throw null; } + protected override bool TryHashFinal(System.Span destination, out int bytesWritten) { throw null; } + } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + public partial class HMACSHA512 : System.Security.Cryptography.HMAC + { + public HMACSHA512() { } + public HMACSHA512(byte[] key) { } + public override byte[] Key { get { throw null; } set { } } + [System.ObsoleteAttribute("ProduceLegacyHmacValues is obsolete. Producing legacy HMAC values is not supported.", DiagnosticId = "SYSLIB0029", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + public bool ProduceLegacyHmacValues { get { throw null; } set { } } + protected override void Dispose(bool disposing) { } + protected override void HashCore(byte[] rgb, int ib, int cb) { } + protected override void HashCore(System.ReadOnlySpan source) { } + public static byte[] HashData(byte[] key, byte[] source) { throw null; } + public static byte[] HashData(System.ReadOnlySpan key, System.ReadOnlySpan source) { throw null; } + public static int HashData(System.ReadOnlySpan key, System.ReadOnlySpan source, System.Span destination) { throw null; } + protected override byte[] HashFinal() { throw null; } + public override void Initialize() { } + public static bool TryHashData(System.ReadOnlySpan key, System.ReadOnlySpan source, System.Span destination, out int bytesWritten) { throw null; } + protected override bool TryHashFinal(System.Span destination, out int bytesWritten) { throw null; } + } public partial interface ICryptoTransform : System.IDisposable { bool CanReuseTransform { get; } @@ -253,6 +782,27 @@ public partial interface ICryptoTransform : System.IDisposable int TransformBlock(byte[] inputBuffer, int inputOffset, int inputCount, byte[] outputBuffer, int outputOffset); byte[] TransformFinalBlock(byte[] inputBuffer, int inputOffset, int inputCount); } + public sealed partial class IncrementalHash : System.IDisposable + { + internal IncrementalHash() { } + public System.Security.Cryptography.HashAlgorithmName AlgorithmName { get { throw null; } } + public int HashLengthInBytes { get { throw null; } } + public void AppendData(byte[] data) { } + public void AppendData(byte[] data, int offset, int count) { } + public void AppendData(System.ReadOnlySpan data) { } + public static System.Security.Cryptography.IncrementalHash CreateHash(System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { throw null; } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + public static System.Security.Cryptography.IncrementalHash CreateHMAC(System.Security.Cryptography.HashAlgorithmName hashAlgorithm, byte[] key) { throw null; } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + public static System.Security.Cryptography.IncrementalHash CreateHMAC(System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.ReadOnlySpan key) { throw null; } + public void Dispose() { } + public byte[] GetCurrentHash() { throw null; } + public int GetCurrentHash(System.Span destination) { throw null; } + public byte[] GetHashAndReset() { throw null; } + public int GetHashAndReset(System.Span destination) { throw null; } + public bool TryGetCurrentHash(System.Span destination, out int bytesWritten) { throw null; } + public bool TryGetHashAndReset(System.Span destination, out int bytesWritten) { throw null; } + } public abstract partial class KeyedHashAlgorithm : System.Security.Cryptography.HashAlgorithm { protected byte[] KeyValue; @@ -271,6 +821,23 @@ public KeySizes(int minSize, int maxSize, int skipSize) { } public int MinSize { get { throw null; } } public int SkipSize { get { throw null; } } } + public abstract partial class MaskGenerationMethod + { + protected MaskGenerationMethod() { } + public abstract byte[] GenerateMask(byte[] rgbSeed, int cbReturn); + } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + public abstract partial class MD5 : System.Security.Cryptography.HashAlgorithm + { + protected MD5() { } + public static new System.Security.Cryptography.MD5 Create() { throw null; } + [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")] + public static new System.Security.Cryptography.MD5? Create(string algName) { throw null; } + public static byte[] HashData(byte[] source) { throw null; } + public static byte[] HashData(System.ReadOnlySpan source) { throw null; } + public static int HashData(System.ReadOnlySpan source, System.Span destination) { throw null; } + public static bool TryHashData(System.ReadOnlySpan source, System.Span destination, out int bytesWritten) { throw null; } + } public sealed partial class Oid { public Oid() { } @@ -357,6 +924,373 @@ public readonly partial struct PemFields public System.Range Label { get { throw null; } } public System.Range Location { get { throw null; } } } + public partial class PKCS1MaskGenerationMethod : System.Security.Cryptography.MaskGenerationMethod + { + [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("PKCS1MaskGenerationMethod is not trim compatible because the algorithm implementation referenced by HashName might be removed.")] + public PKCS1MaskGenerationMethod() { } + public string HashName { get { throw null; } set { } } + public override byte[] GenerateMask(byte[] rgbSeed, int cbReturn) { throw null; } + } + public abstract partial class RandomNumberGenerator : System.IDisposable + { + protected RandomNumberGenerator() { } + public static System.Security.Cryptography.RandomNumberGenerator Create() { throw null; } + [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")] + public static System.Security.Cryptography.RandomNumberGenerator? Create(string rngName) { throw null; } + public void Dispose() { } + protected virtual void Dispose(bool disposing) { } + public static void Fill(System.Span data) { } + public abstract void GetBytes(byte[] data); + public virtual void GetBytes(byte[] data, int offset, int count) { } + public static byte[] GetBytes(int count) { throw null; } + public virtual void GetBytes(System.Span data) { } + public static int GetInt32(int toExclusive) { throw null; } + public static int GetInt32(int fromInclusive, int toExclusive) { throw null; } + public virtual void GetNonZeroBytes(byte[] data) { } + public virtual void GetNonZeroBytes(System.Span data) { } + } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public abstract partial class RC2 : System.Security.Cryptography.SymmetricAlgorithm + { + protected int EffectiveKeySizeValue; + protected RC2() { } + public virtual int EffectiveKeySize { get { throw null; } set { } } + public override int KeySize { get { throw null; } set { } } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + public static new System.Security.Cryptography.RC2 Create() { throw null; } + [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")] + public static new System.Security.Cryptography.RC2? Create(string AlgName) { throw null; } + } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + public partial class Rfc2898DeriveBytes : System.Security.Cryptography.DeriveBytes + { + public Rfc2898DeriveBytes(byte[] password, byte[] salt, int iterations) { } + public Rfc2898DeriveBytes(byte[] password, byte[] salt, int iterations, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { } + public Rfc2898DeriveBytes(string password, byte[] salt) { } + public Rfc2898DeriveBytes(string password, byte[] salt, int iterations) { } + public Rfc2898DeriveBytes(string password, byte[] salt, int iterations, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { } + public Rfc2898DeriveBytes(string password, int saltSize) { } + public Rfc2898DeriveBytes(string password, int saltSize, int iterations) { } + public Rfc2898DeriveBytes(string password, int saltSize, int iterations, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { } + public System.Security.Cryptography.HashAlgorithmName HashAlgorithm { get { throw null; } } + public int IterationCount { get { throw null; } set { } } + public byte[] Salt { get { throw null; } set { } } + [System.ObsoleteAttribute("Rfc2898DeriveBytes.CryptDeriveKey is obsolete and is not supported. Use PasswordDeriveBytes.CryptDeriveKey instead.", DiagnosticId = "SYSLIB0033", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + public byte[] CryptDeriveKey(string algname, string alghashname, int keySize, byte[] rgbIV) { throw null; } + protected override void Dispose(bool disposing) { } + public override byte[] GetBytes(int cb) { throw null; } + public static byte[] Pbkdf2(byte[] password, byte[] salt, int iterations, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, int outputLength) { throw null; } + public static byte[] Pbkdf2(System.ReadOnlySpan password, System.ReadOnlySpan salt, int iterations, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, int outputLength) { throw null; } + public static void Pbkdf2(System.ReadOnlySpan password, System.ReadOnlySpan salt, System.Span destination, int iterations, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { } + public static byte[] Pbkdf2(System.ReadOnlySpan password, System.ReadOnlySpan salt, int iterations, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, int outputLength) { throw null; } + public static void Pbkdf2(System.ReadOnlySpan password, System.ReadOnlySpan salt, System.Span destination, int iterations, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { } + public static byte[] Pbkdf2(string password, byte[] salt, int iterations, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, int outputLength) { throw null; } + public override void Reset() { } + } + [System.ObsoleteAttribute("The Rijndael and RijndaelManaged types are obsolete. Use Aes instead.", DiagnosticId = "SYSLIB0022", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public abstract partial class Rijndael : System.Security.Cryptography.SymmetricAlgorithm + { + protected Rijndael() { } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + public static new System.Security.Cryptography.Rijndael Create() { throw null; } + [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")] + public static new System.Security.Cryptography.Rijndael? Create(string algName) { throw null; } + } + [System.ObsoleteAttribute("The Rijndael and RijndaelManaged types are obsolete. Use Aes instead.", DiagnosticId = "SYSLIB0022", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + public sealed partial class RijndaelManaged : System.Security.Cryptography.Rijndael + { + public RijndaelManaged() { } + public override int BlockSize { get { throw null; } set { } } + public override int FeedbackSize { get { throw null; } set { } } + public override byte[] IV { get { throw null; } set { } } + public override byte[] Key { get { throw null; } set { } } + public override int KeySize { get { throw null; } set { } } + public override System.Security.Cryptography.KeySizes[] LegalKeySizes { get { throw null; } } + public override System.Security.Cryptography.CipherMode Mode { get { throw null; } set { } } + public override System.Security.Cryptography.PaddingMode Padding { get { throw null; } set { } } + public override System.Security.Cryptography.ICryptoTransform CreateDecryptor() { throw null; } + public override System.Security.Cryptography.ICryptoTransform CreateDecryptor(byte[] rgbKey, byte[]? rgbIV) { throw null; } + public override System.Security.Cryptography.ICryptoTransform CreateEncryptor() { throw null; } + public override System.Security.Cryptography.ICryptoTransform CreateEncryptor(byte[] rgbKey, byte[]? rgbIV) { throw null; } + protected override void Dispose(bool disposing) { } + public override void GenerateIV() { } + public override void GenerateKey() { } + } + public abstract partial class RSA : System.Security.Cryptography.AsymmetricAlgorithm + { + protected RSA() { } + public override string? KeyExchangeAlgorithm { get { throw null; } } + public override string SignatureAlgorithm { get { throw null; } } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + public static new System.Security.Cryptography.RSA Create() { throw null; } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + public static System.Security.Cryptography.RSA Create(int keySizeInBits) { throw null; } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + public static System.Security.Cryptography.RSA Create(System.Security.Cryptography.RSAParameters parameters) { throw null; } + [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")] + public static new System.Security.Cryptography.RSA? Create(string algName) { throw null; } + public virtual byte[] Decrypt(byte[] data, System.Security.Cryptography.RSAEncryptionPadding padding) { throw null; } + public virtual byte[] DecryptValue(byte[] rgb) { throw null; } + public virtual byte[] Encrypt(byte[] data, System.Security.Cryptography.RSAEncryptionPadding padding) { throw null; } + public virtual byte[] EncryptValue(byte[] rgb) { throw null; } + public abstract System.Security.Cryptography.RSAParameters ExportParameters(bool includePrivateParameters); + public virtual byte[] ExportRSAPrivateKey() { throw null; } + public virtual byte[] ExportRSAPublicKey() { throw null; } + public override void FromXmlString(string xmlString) { } + protected virtual byte[] HashData(byte[] data, int offset, int count, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { throw null; } + protected virtual byte[] HashData(System.IO.Stream data, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { throw null; } + public override void ImportEncryptedPkcs8PrivateKey(System.ReadOnlySpan passwordBytes, System.ReadOnlySpan source, out int bytesRead) { throw null; } + public override void ImportEncryptedPkcs8PrivateKey(System.ReadOnlySpan password, System.ReadOnlySpan source, out int bytesRead) { throw null; } + public override void ImportFromEncryptedPem(System.ReadOnlySpan input, System.ReadOnlySpan passwordBytes) { } + public override void ImportFromEncryptedPem(System.ReadOnlySpan input, System.ReadOnlySpan password) { } + public override void ImportFromPem(System.ReadOnlySpan input) { } + public abstract void ImportParameters(System.Security.Cryptography.RSAParameters parameters); + public override void ImportPkcs8PrivateKey(System.ReadOnlySpan source, out int bytesRead) { throw null; } + public virtual void ImportRSAPrivateKey(System.ReadOnlySpan source, out int bytesRead) { throw null; } + public virtual void ImportRSAPublicKey(System.ReadOnlySpan source, out int bytesRead) { throw null; } + public override void ImportSubjectPublicKeyInfo(System.ReadOnlySpan source, out int bytesRead) { throw null; } + public virtual byte[] SignData(byte[] data, int offset, int count, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.RSASignaturePadding padding) { throw null; } + public byte[] SignData(byte[] data, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.RSASignaturePadding padding) { throw null; } + public virtual byte[] SignData(System.IO.Stream data, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.RSASignaturePadding padding) { throw null; } + public virtual byte[] SignHash(byte[] hash, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.RSASignaturePadding padding) { throw null; } + public override string ToXmlString(bool includePrivateParameters) { throw null; } + public virtual bool TryDecrypt(System.ReadOnlySpan data, System.Span destination, System.Security.Cryptography.RSAEncryptionPadding padding, out int bytesWritten) { throw null; } + public virtual bool TryEncrypt(System.ReadOnlySpan data, System.Span destination, System.Security.Cryptography.RSAEncryptionPadding padding, out int bytesWritten) { throw null; } + public override bool TryExportEncryptedPkcs8PrivateKey(System.ReadOnlySpan passwordBytes, System.Security.Cryptography.PbeParameters pbeParameters, System.Span destination, out int bytesWritten) { throw null; } + public override bool TryExportEncryptedPkcs8PrivateKey(System.ReadOnlySpan password, System.Security.Cryptography.PbeParameters pbeParameters, System.Span destination, out int bytesWritten) { throw null; } + public override bool TryExportPkcs8PrivateKey(System.Span destination, out int bytesWritten) { throw null; } + public virtual bool TryExportRSAPrivateKey(System.Span destination, out int bytesWritten) { throw null; } + public virtual bool TryExportRSAPublicKey(System.Span destination, out int bytesWritten) { throw null; } + public override bool TryExportSubjectPublicKeyInfo(System.Span destination, out int bytesWritten) { throw null; } + protected virtual bool TryHashData(System.ReadOnlySpan data, System.Span destination, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, out int bytesWritten) { throw null; } + public virtual bool TrySignData(System.ReadOnlySpan data, System.Span destination, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.RSASignaturePadding padding, out int bytesWritten) { throw null; } + public virtual bool TrySignHash(System.ReadOnlySpan hash, System.Span destination, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.RSASignaturePadding padding, out int bytesWritten) { throw null; } + public bool VerifyData(byte[] data, byte[] signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.RSASignaturePadding padding) { throw null; } + public virtual bool VerifyData(byte[] data, int offset, int count, byte[] signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.RSASignaturePadding padding) { throw null; } + public bool VerifyData(System.IO.Stream data, byte[] signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.RSASignaturePadding padding) { throw null; } + public virtual bool VerifyData(System.ReadOnlySpan data, System.ReadOnlySpan signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.RSASignaturePadding padding) { throw null; } + public virtual bool VerifyHash(byte[] hash, byte[] signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.RSASignaturePadding padding) { throw null; } + public virtual bool VerifyHash(System.ReadOnlySpan hash, System.ReadOnlySpan signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.RSASignaturePadding padding) { throw null; } + } + public sealed partial class RSAEncryptionPadding : System.IEquatable + { + internal RSAEncryptionPadding() { } + public System.Security.Cryptography.RSAEncryptionPaddingMode Mode { get { throw null; } } + public System.Security.Cryptography.HashAlgorithmName OaepHashAlgorithm { get { throw null; } } + public static System.Security.Cryptography.RSAEncryptionPadding OaepSHA1 { get { throw null; } } + public static System.Security.Cryptography.RSAEncryptionPadding OaepSHA256 { get { throw null; } } + public static System.Security.Cryptography.RSAEncryptionPadding OaepSHA384 { get { throw null; } } + public static System.Security.Cryptography.RSAEncryptionPadding OaepSHA512 { get { throw null; } } + public static System.Security.Cryptography.RSAEncryptionPadding Pkcs1 { get { throw null; } } + public static System.Security.Cryptography.RSAEncryptionPadding CreateOaep(System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { throw null; } + public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; } + public bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] System.Security.Cryptography.RSAEncryptionPadding? other) { throw null; } + public override int GetHashCode() { throw null; } + public static bool operator ==(System.Security.Cryptography.RSAEncryptionPadding? left, System.Security.Cryptography.RSAEncryptionPadding? right) { throw null; } + public static bool operator !=(System.Security.Cryptography.RSAEncryptionPadding? left, System.Security.Cryptography.RSAEncryptionPadding? right) { throw null; } + public override string ToString() { throw null; } + } + public enum RSAEncryptionPaddingMode + { + Pkcs1 = 0, + Oaep = 1, + } + public partial class RSAOAEPKeyExchangeDeformatter : System.Security.Cryptography.AsymmetricKeyExchangeDeformatter + { + public RSAOAEPKeyExchangeDeformatter() { } + public RSAOAEPKeyExchangeDeformatter(System.Security.Cryptography.AsymmetricAlgorithm key) { } + public override string? Parameters { get { throw null; } set { } } + public override byte[] DecryptKeyExchange(byte[] rgbData) { throw null; } + public override void SetKey(System.Security.Cryptography.AsymmetricAlgorithm key) { } + } + public partial class RSAOAEPKeyExchangeFormatter : System.Security.Cryptography.AsymmetricKeyExchangeFormatter + { + public RSAOAEPKeyExchangeFormatter() { } + public RSAOAEPKeyExchangeFormatter(System.Security.Cryptography.AsymmetricAlgorithm key) { } + public byte[]? Parameter { get { throw null; } set { } } + public override string? Parameters { get { throw null; } } + public System.Security.Cryptography.RandomNumberGenerator? Rng { get { throw null; } set { } } + public override byte[] CreateKeyExchange(byte[] rgbData) { throw null; } + public override byte[] CreateKeyExchange(byte[] rgbData, System.Type? symAlgType) { throw null; } + public override void SetKey(System.Security.Cryptography.AsymmetricAlgorithm key) { } + } + public partial struct RSAParameters + { + public byte[]? D; + public byte[]? DP; + public byte[]? DQ; + public byte[]? Exponent; + public byte[]? InverseQ; + public byte[]? Modulus; + public byte[]? P; + public byte[]? Q; + } + public partial class RSAPKCS1KeyExchangeDeformatter : System.Security.Cryptography.AsymmetricKeyExchangeDeformatter + { + public RSAPKCS1KeyExchangeDeformatter() { } + public RSAPKCS1KeyExchangeDeformatter(System.Security.Cryptography.AsymmetricAlgorithm key) { } + public override string? Parameters { get { throw null; } set { } } + public System.Security.Cryptography.RandomNumberGenerator? RNG { get { throw null; } set { } } + public override byte[] DecryptKeyExchange(byte[] rgbIn) { throw null; } + public override void SetKey(System.Security.Cryptography.AsymmetricAlgorithm key) { } + } + public partial class RSAPKCS1KeyExchangeFormatter : System.Security.Cryptography.AsymmetricKeyExchangeFormatter + { + public RSAPKCS1KeyExchangeFormatter() { } + public RSAPKCS1KeyExchangeFormatter(System.Security.Cryptography.AsymmetricAlgorithm key) { } + public override string Parameters { get { throw null; } } + public System.Security.Cryptography.RandomNumberGenerator? Rng { get { throw null; } set { } } + public override byte[] CreateKeyExchange(byte[] rgbData) { throw null; } + public override byte[] CreateKeyExchange(byte[] rgbData, System.Type? symAlgType) { throw null; } + public override void SetKey(System.Security.Cryptography.AsymmetricAlgorithm key) { } + } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + public partial class RSAPKCS1SignatureDeformatter : System.Security.Cryptography.AsymmetricSignatureDeformatter + { + public RSAPKCS1SignatureDeformatter() { } + public RSAPKCS1SignatureDeformatter(System.Security.Cryptography.AsymmetricAlgorithm key) { } + public override void SetHashAlgorithm(string strName) { } + public override void SetKey(System.Security.Cryptography.AsymmetricAlgorithm key) { } + public override bool VerifySignature(byte[] rgbHash, byte[] rgbSignature) { throw null; } + } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + public partial class RSAPKCS1SignatureFormatter : System.Security.Cryptography.AsymmetricSignatureFormatter + { + public RSAPKCS1SignatureFormatter() { } + public RSAPKCS1SignatureFormatter(System.Security.Cryptography.AsymmetricAlgorithm key) { } + public override byte[] CreateSignature(byte[] rgbHash) { throw null; } + public override void SetHashAlgorithm(string strName) { } + public override void SetKey(System.Security.Cryptography.AsymmetricAlgorithm key) { } + } + public sealed partial class RSASignaturePadding : System.IEquatable + { + internal RSASignaturePadding() { } + public System.Security.Cryptography.RSASignaturePaddingMode Mode { get { throw null; } } + public static System.Security.Cryptography.RSASignaturePadding Pkcs1 { get { throw null; } } + public static System.Security.Cryptography.RSASignaturePadding Pss { get { throw null; } } + public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; } + public bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] System.Security.Cryptography.RSASignaturePadding? other) { throw null; } + public override int GetHashCode() { throw null; } + public static bool operator ==(System.Security.Cryptography.RSASignaturePadding? left, System.Security.Cryptography.RSASignaturePadding? right) { throw null; } + public static bool operator !=(System.Security.Cryptography.RSASignaturePadding? left, System.Security.Cryptography.RSASignaturePadding? right) { throw null; } + public override string ToString() { throw null; } + } + public enum RSASignaturePaddingMode + { + Pkcs1 = 0, + Pss = 1, + } + public abstract partial class SHA1 : System.Security.Cryptography.HashAlgorithm + { + protected SHA1() { } + public static new System.Security.Cryptography.SHA1 Create() { throw null; } + [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")] + public static new System.Security.Cryptography.SHA1? Create(string hashName) { throw null; } + public static byte[] HashData(byte[] source) { throw null; } + public static byte[] HashData(System.ReadOnlySpan source) { throw null; } + public static int HashData(System.ReadOnlySpan source, System.Span destination) { throw null; } + public static bool TryHashData(System.ReadOnlySpan source, System.Span destination, out int bytesWritten) { throw null; } + } + [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the base type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public sealed partial class SHA1Managed : System.Security.Cryptography.SHA1 + { + public SHA1Managed() { } + protected sealed override void Dispose(bool disposing) { } + protected sealed override void HashCore(byte[] array, int ibStart, int cbSize) { } + protected sealed override void HashCore(System.ReadOnlySpan source) { } + protected sealed override byte[] HashFinal() { throw null; } + public sealed override void Initialize() { } + protected sealed override bool TryHashFinal(System.Span destination, out int bytesWritten) { throw null; } + } + public abstract partial class SHA256 : System.Security.Cryptography.HashAlgorithm + { + protected SHA256() { } + public static new System.Security.Cryptography.SHA256 Create() { throw null; } + [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")] + public static new System.Security.Cryptography.SHA256? Create(string hashName) { throw null; } + public static byte[] HashData(byte[] source) { throw null; } + public static byte[] HashData(System.ReadOnlySpan source) { throw null; } + public static int HashData(System.ReadOnlySpan source, System.Span destination) { throw null; } + public static bool TryHashData(System.ReadOnlySpan source, System.Span destination, out int bytesWritten) { throw null; } + } + [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the base type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public sealed partial class SHA256Managed : System.Security.Cryptography.SHA256 + { + public SHA256Managed() { } + protected sealed override void Dispose(bool disposing) { } + protected sealed override void HashCore(byte[] array, int ibStart, int cbSize) { } + protected sealed override void HashCore(System.ReadOnlySpan source) { } + protected sealed override byte[] HashFinal() { throw null; } + public sealed override void Initialize() { } + protected sealed override bool TryHashFinal(System.Span destination, out int bytesWritten) { throw null; } + } + public abstract partial class SHA384 : System.Security.Cryptography.HashAlgorithm + { + protected SHA384() { } + public static new System.Security.Cryptography.SHA384 Create() { throw null; } + [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")] + public static new System.Security.Cryptography.SHA384? Create(string hashName) { throw null; } + public static byte[] HashData(byte[] source) { throw null; } + public static byte[] HashData(System.ReadOnlySpan source) { throw null; } + public static int HashData(System.ReadOnlySpan source, System.Span destination) { throw null; } + public static bool TryHashData(System.ReadOnlySpan source, System.Span destination, out int bytesWritten) { throw null; } + } + [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the base type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public sealed partial class SHA384Managed : System.Security.Cryptography.SHA384 + { + public SHA384Managed() { } + protected sealed override void Dispose(bool disposing) { } + protected sealed override void HashCore(byte[] array, int ibStart, int cbSize) { } + protected sealed override void HashCore(System.ReadOnlySpan source) { } + protected sealed override byte[] HashFinal() { throw null; } + public sealed override void Initialize() { } + protected sealed override bool TryHashFinal(System.Span destination, out int bytesWritten) { throw null; } + } + public abstract partial class SHA512 : System.Security.Cryptography.HashAlgorithm + { + protected SHA512() { } + public static new System.Security.Cryptography.SHA512 Create() { throw null; } + [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")] + public static new System.Security.Cryptography.SHA512? Create(string hashName) { throw null; } + public static byte[] HashData(byte[] source) { throw null; } + public static byte[] HashData(System.ReadOnlySpan source) { throw null; } + public static int HashData(System.ReadOnlySpan source, System.Span destination) { throw null; } + public static bool TryHashData(System.ReadOnlySpan source, System.Span destination, out int bytesWritten) { throw null; } + } + [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the base type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public sealed partial class SHA512Managed : System.Security.Cryptography.SHA512 + { + public SHA512Managed() { } + protected sealed override void Dispose(bool disposing) { } + protected sealed override void HashCore(byte[] array, int ibStart, int cbSize) { } + protected sealed override void HashCore(System.ReadOnlySpan source) { } + protected sealed override byte[] HashFinal() { throw null; } + public sealed override void Initialize() { } + protected sealed override bool TryHashFinal(System.Span destination, out int bytesWritten) { throw null; } + } + public partial class SignatureDescription + { + public SignatureDescription() { } + public SignatureDescription(System.Security.SecurityElement el) { } + public string? DeformatterAlgorithm { get { throw null; } set { } } + public string? DigestAlgorithm { get { throw null; } set { } } + public string? FormatterAlgorithm { get { throw null; } set { } } + public string? KeyAlgorithm { get { throw null; } set { } } + [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("CreateDeformatter is not trim compatible because the algorithm implementation referenced by DeformatterAlgorithm might be removed.")] + public virtual System.Security.Cryptography.AsymmetricSignatureDeformatter CreateDeformatter(System.Security.Cryptography.AsymmetricAlgorithm key) { throw null; } + [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("CreateDigest is not trim compatible because the algorithm implementation referenced by DigestAlgorithm might be removed.")] + public virtual System.Security.Cryptography.HashAlgorithm? CreateDigest() { throw null; } + [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("CreateFormatter is not trim compatible because the algorithm implementation referenced by FormatterAlgorithm might be removed.")] + public virtual System.Security.Cryptography.AsymmetricSignatureFormatter CreateFormatter(System.Security.Cryptography.AsymmetricAlgorithm key) { throw null; } + } public abstract partial class SymmetricAlgorithm : System.IDisposable { protected int BlockSizeValue; @@ -442,4 +1376,14 @@ protected virtual void Dispose(bool disposing) { } public int TransformBlock(byte[] inputBuffer, int inputOffset, int inputCount, byte[] outputBuffer, int outputOffset) { throw null; } public byte[] TransformFinalBlock(byte[] inputBuffer, int inputOffset, int inputCount) { throw null; } } + public abstract partial class TripleDES : System.Security.Cryptography.SymmetricAlgorithm + { + protected TripleDES() { } + public override byte[] Key { get { throw null; } set { } } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + public static new System.Security.Cryptography.TripleDES Create() { throw null; } + [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")] + public static new System.Security.Cryptography.TripleDES? Create(string str) { throw null; } + public static bool IsWeakKey(byte[] rgbKey) { throw null; } + } } diff --git a/src/libraries/System.Security.Cryptography/src/Resources/Strings.resx b/src/libraries/System.Security.Cryptography/src/Resources/Strings.resx index 5473ef0b799f64..84a24a8fc9ef46 100644 --- a/src/libraries/System.Security.Cryptography/src/Resources/Strings.resx +++ b/src/libraries/System.Security.Cryptography/src/Resources/Strings.resx @@ -69,6 +69,9 @@ Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection. + + Range of random number does not contain at least one possibility. + Value was invalid. @@ -108,38 +111,173 @@ Positive number required. + + Accessing a hash algorithm by manipulating the HashName property is not supported on this platform. Instead, you must instantiate one of the supplied subtypes (such as HMACSHA1.) + + + CryptoConfig cannot add a mapping for a null or empty name. + + + The KDF for algorithm '{0}' requires a char-based password input. + + + Algorithm '{0}' is not supported on this platform. + + + Algorithms added to CryptoConfig must be accessible from outside their assembly. + + + The keys from both parties must be the same size to generate a secret agreement. + + + Keys used with the ECDiffieHellmanCng algorithm must have an algorithm group of ECDiffieHellman. + + + The computed authentication tag did not match the input authentication tag. + + + The provided value of {0} bytes does not match the expected size of {1} bytes for the algorithm ({2}). + + + The specified feedback size '{0}' for CipherMode '{1}' is not supported. + + + The specified CipherMode '{0}' is not supported. + + + Encoded OID length is too large (greater than 0x7f bytes). + FlushFinalBlock() method was called twice on a CryptoStream. It can only be called once. + + Object contains only the public half of a key pair. A private key must also be provided. + + + The specified curve '{0}' or its parameters are not valid for this platform. + This platform does not allow the automatic selection of an algorithm. ASN1 corrupted data. + + DSA keys can be imported, but new key generation is not supported on this platform. + + + Only named curves are supported on this platform. + + + XML serialization of an elliptic curve key requires using an overload which specifies the XML format to be used. + + + {0} unexpectedly produced a ciphertext with the incorrect length. + + + The total number of bytes extracted cannot exceed UInt32.MaxValue * hash length. + + + The current platform does not support the specified feedback size. + + + No hash algorithm has been associated with this formatter object, assign one via the SetHashAlgorithm method. + + + No asymmetric key object has been associated with this formatter object, assign one via the SetKey method. + + + The provided XML could not be read. + + + The hash algorithm name cannot be null or empty. + Hash must be finalized before the hash value is retrieved. - - Specified feedback size is not valid for this algorithm. - Specified block size is not valid for this algorithm. Specified cipher mode is not valid for this algorithm. + + The specified key parameters are not valid. Q.X and Q.Y, or D, must be specified. Q.X, Q.Y must be the same length. If D is specified it must be the same length as Q.X and Q.Y if also specified for named curves or the same length as Order for explicit curves. + + + The specified Oid is not valid. The Oid.FriendlyName or Oid.Value property must be set. + + + The specified DSA parameters are not valid; P, G and Y must be the same length (the key size). + + + The specified DSA parameters are not valid; J (if present) must be shorter than P. + + + The specified DSA parameters are not valid; Q and X (if present) must be the same length. + + + The specified DSA parameters are not valid; P, Q, G and Y are all required. + + + The specified DSA parameters are not valid; Q's length must be one of 20, 32 or 64 bytes. + + + The specified DSA parameters are not valid; Q must be 20 bytes long for keys shorter than 1024 bits. + + + The specified DSA parameters are not valid; Seed, if present, must be 20 bytes long for keys shorter than 1024 bits. + + + The specified Characteristic2 curve parameters are not valid. Polynomial, A, B, G.X, G.Y, and Order are required. A, B, G.X, G.Y must be the same length, and the same length as Q.X, Q.Y and D if those are specified. Cofactor is required. Seed and Hash are optional. Other parameters are not allowed. + + + The specified prime curve parameters are not valid. Prime, A, B, G.X, G.Y and Order are required and must be the same length, and the same length as Q.X, Q.Y and D if those are specified. Cofactor is required. Seed and Hash are optional. Other parameters are not allowed. + + + The specified named curve parameters are not valid. Only the Oid parameter must be set. + + + Specified feedback size is not valid for this algorithm. + + + Input string does not contain a valid encoding of the '{0}' '{1}' parameter. + + + The specified OID ({0}) does not represent a known hash algorithm. + Specified initialization vector (IV) does not match the block size for this algorithm. + + Specified key is a known semi-weak key for '{0}' and cannot be used. + + + Specified key is a known weak key for '{0}' and cannot be used. + Specified key is not a valid size for this algorithm. + + The specified nonce is not a valid size for this algorithm. + + + Object identifier (OID) is unknown. + + + Padding is invalid and cannot be removed. + Specified padding mode is not valid for this algorithm. - - The specified OID ({0}) does not represent a known hash algorithm. + + This operation is not supported for this class. + + + The specified tag is not a valid size for this algorithm. + + + The key is too small for the requested operation. The specified plaintext size is not valid for the the padding and block size. @@ -147,6 +285,27 @@ The specified plaintext size is not valid for the the padding and feedback size. + + The message exceeds the maximum allowable length for the chosen options ({0}). + + + The specified RSA parameters are not valid. Exponent and Modulus are required. If D is present, it must have the same length as Modulus. If D is present, P, Q, DP, DQ, and InverseQ are required and must have half the length of Modulus, rounded up, otherwise they must be omitted. + + + The cipher mode specified requires that an initialization vector (IV) be used. + + + TransformBlock may only process bytes in block sized increments. + + + Key is not a valid private key. + + + Key is not a valid public or private key. + + + Error occurred while decoding OAEP padding. + No OID value matches this name. @@ -159,36 +318,96 @@ The OID value cannot be changed from its current value. + + Output keying material length can be at most {0} bytes (255 * hash length). + + + Cannot open an invalid handle. + + + The input data is not a complete block. + + + The EncryptedPrivateKeyInfo structure was decoded but was not successfully interpreted, the password may be incorrect. + + + Plaintext and ciphertext must have the same length. + The specified plaintext size is too large. - - {0} unexpectedly produced a ciphertext with the incorrect length. + + The pseudo-random key length must be at least {0} bytes. - - Method not supported. Derived class must override. + + EffectiveKeySize value must be at least 40 bits. - - Stream does not support reading. + + KeySize value must be at least as large as the EffectiveKeySize value. - - Stream does not support seeking. + + EffectiveKeySize must be the same as KeySize in this implementation. - - Stream does not support writing. + + BlockSize must be 128 in this implementation. + + + The length of the data to decrypt is not valid for the size of this key. + + + The provided RSAPrivateKey value has version '{0}', but version '{1}' is the maximum supported. + + + The provided hash value is not the expected size for the specified hash algorithm. + + + The TLS key derivation function requires a seed value of exactly 64 bytes. + + + CNG provider unexpectedly terminated encryption or decryption prematurely. + + + The algorithm identified by '{0}' is unknown, not valid for the requested usage, or was not handled. + + + '{0}' is not a known hash algorithm. + + + Unknown padding mode used. + + + The signature format '{0}' is unknown. + + + The system cryptographic library returned error '{0}' of type '{1}' + + + The specified PaddingMode is not supported. Setting the hashname after it's already been set is not supported on this platform. - - Accessing a hash algorithm by manipulating the HashName property is not supported on this platform. Instead, you must instantiate one of the supplied subtypes (such as HMACSHA1.) - The algorithm's implementation is incorrect. The algorithm's block size is not supported. + + Method not supported. + + + Method not supported. Derived class must override. + + + Stream does not support reading. + + + Stream does not support seeking. + + + Stream does not support writing. + System.Security.Cryptography is not supported on this platform. diff --git a/src/libraries/System.Security.Cryptography/src/System.Security.Cryptography.csproj b/src/libraries/System.Security.Cryptography/src/System.Security.Cryptography.csproj index bc8d17c1f702aa..a4a5617e4c4826 100644 --- a/src/libraries/System.Security.Cryptography/src/System.Security.Cryptography.csproj +++ b/src/libraries/System.Security.Cryptography/src/System.Security.Cryptography.csproj @@ -1,7 +1,9 @@ true + $(DefineConstants);INTERNAL_ASYMMETRIC_IMPLEMENTATIONS $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Android;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS;$(NetCoreAppCurrent)-Browser;$(NetCoreAppCurrent) + $(NoWarn);CA5350;CA5351;CA5379;CA5384 enable @@ -11,47 +13,272 @@ true true true + true + true - - + + + + + + + + + + + + + + - - + + Common\System\Security\Cryptography\Asn1\AlgorithmIdentifierAsn.xml + + + Common\System\Security\Cryptography\Asn1\AlgorithmIdentifierAsn.xml.cs + Common\System\Security\Cryptography\Asn1\AlgorithmIdentifierAsn.xml + + + Common\System\Security\Cryptography\Asn1\AlgorithmIdentifierAsn.manual.cs + Common\System\Security\Cryptography\Asn1\AlgorithmIdentifierAsn.xml + + + Common\System\Security\Cryptography\Asn1\AttributeAsn.xml + + + Common\System\Security\Cryptography\Asn1\AttributeAsn.xml.cs + Common\System\Security\Cryptography\Asn1\AttributeAsn.xml + + + Common\System\Security\Cryptography\Asn1\CurveAsn.xml + + + Common\System\Security\Cryptography\Asn1\CurveAsn.xml.cs + Common\System\Security\Cryptography\Asn1\CurveAsn.xml + + + Common\System\Security\Cryptography\Asn1\DssParms.xml + + + Common\System\Security\Cryptography\Asn1\DssParms.xml.cs + Common\System\Security\Cryptography\Asn1\DssParms.xml + + + Common\System\Security\Cryptography\Asn1\ECDomainParameters.xml + + + Common\System\Security\Cryptography\Asn1\ECDomainParameters.xml.cs + Common\System\Security\Cryptography\Asn1\ECDomainParameters.xml + + + Common\System\Security\Cryptography\Asn1\ECPrivateKey.xml + + + Common\System\Security\Cryptography\Asn1\ECPrivateKey.xml.cs + Common\System\Security\Cryptography\Asn1\ECPrivateKey.xml + + + Common\System\Security\Cryptography\Asn1\EncryptedPrivateKeyInfoAsn.xml + + + Common\System\Security\Cryptography\Asn1\EncryptedPrivateKeyInfoAsn.xml.cs + Common\System\Security\Cryptography\Asn1\EncryptedPrivateKeyInfoAsn.xml + + + Common\System\Security\Cryptography\Asn1\FieldID.xml + + + Common\System\Security\Cryptography\Asn1\FieldID.xml.cs + Common\System\Security\Cryptography\Asn1\FieldID.xml + + + Common\System\Security\Cryptography\Asn1\PBEParameter.xml + + + Common\System\Security\Cryptography\Asn1\PBEParameter.xml.cs + Common\System\Security\Cryptography\Asn1\PBEParameter.xml + + + Common\System\Security\Cryptography\Asn1\PBES2Params.xml + + + Common\System\Security\Cryptography\Asn1\PBES2Params.xml.cs + Common\System\Security\Cryptography\Asn1\PBES2Params.xml + + + Common\System\Security\Cryptography\Asn1\Pbkdf2Params.xml + + + Common\System\Security\Cryptography\Asn1\Pbkdf2Params.xml.cs + Common\System\Security\Cryptography\Asn1\Pbkdf2Params.xml + + + Common\System\Security\Cryptography\Asn1\Pbkdf2SaltChoice.xml + + + Common\System\Security\Cryptography\Asn1\Pbkdf2SaltChoice.xml.cs + Common\System\Security\Cryptography\Asn1\Pbkdf2SaltChoice.xml + + + Common\System\Security\Cryptography\Asn1\PrivateKeyInfoAsn.xml + + + Common\System\Security\Cryptography\Asn1\PrivateKeyInfoAsn.xml.cs + Common\System\Security\Cryptography\Asn1\PrivateKeyInfoAsn.xml + + + Common\System\Security\Cryptography\Asn1\Rc2CbcParameters.xml + + + Common\System\Security\Cryptography\Asn1\Rc2CbcParameters.xml.cs + Common\System\Security\Cryptography\Asn1\Rc2CbcParameters.xml + + + Common\System\Security\Cryptography\Asn1\Rc2CbcParameters.manual.cs + Common\System\Security\Cryptography\Asn1\Rc2CbcParameters.xml + + + Common\System\Security\Cryptography\Asn1\RSAPrivateKeyAsn.xml + + + Common\System\Security\Cryptography\Asn1\RSAPrivateKeyAsn.xml.cs + Common\System\Security\Cryptography\Asn1\RSAPrivateKeyAsn.xml + + + Common\System\Security\Cryptography\Asn1\RSAPublicKeyAsn.xml + + + Common\System\Security\Cryptography\Asn1\RSAPublicKeyAsn.xml.cs + Common\System\Security\Cryptography\Asn1\RSAPublicKeyAsn.xml + + + Common\System\Security\Cryptography\Asn1\SpecifiedECDomain.xml + + + Common\System\Security\Cryptography\Asn1\SpecifiedECDomain.xml.cs + Common\System\Security\Cryptography\Asn1\SpecifiedECDomain.xml + + + Common\System\Security\Cryptography\Asn1\SubjectPublicKeyInfoAsn.xml + + + Common\System\Security\Cryptography\Asn1\SubjectPublicKeyInfoAsn.xml.cs + Common\System\Security\Cryptography\Asn1\SubjectPublicKeyInfoAsn.xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -62,11 +289,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - Common\System\Security\Cryptography\Asn1\DirectoryStringAsn.xml @@ -95,69 +355,506 @@ - + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AeadCommon.Windows.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AeadCommon.Windows.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AeadCommon.Windows.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AeadCommon.Windows.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AeadCommon.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AeadCommon.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AeadCommon.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AeadCommon.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/Aes.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/Aes.cs similarity index 96% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/Aes.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/Aes.cs index 3fdfd83871fc0e..d58995772b7f81 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/Aes.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/Aes.cs @@ -7,7 +7,6 @@ namespace System.Security.Cryptography { - [UnsupportedOSPlatform("browser")] public abstract class Aes : SymmetricAlgorithm { protected Aes() @@ -21,6 +20,7 @@ protected Aes() ModeValue = CipherMode.CBC; } + [UnsupportedOSPlatform("browser")] public static new Aes Create() { return new AesImplementation(); diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AesAEAD.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesAEAD.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AesAEAD.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesAEAD.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AesCcm.Android.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesCcm.Android.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AesCcm.Android.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesCcm.Android.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AesCcm.NotSupported.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesCcm.NotSupported.cs similarity index 95% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AesCcm.NotSupported.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesCcm.NotSupported.cs index 6cbfe82d10ab73..6469f5a8ad3753 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AesCcm.NotSupported.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesCcm.NotSupported.cs @@ -9,7 +9,6 @@ public partial class AesCcm { public static bool IsSupported => false; -#if !BROWSER // allow GenFacades to handle browser target private void ImportKey(ReadOnlySpan key) { Debug.Fail("Instance ctor should fail before we reach this point."); @@ -43,6 +42,5 @@ public void Dispose() Debug.Fail("Instance ctor should fail before we reach this point."); // no-op } -#endif } } diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AesCcm.Unix.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesCcm.OpenSsl.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AesCcm.Unix.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesCcm.OpenSsl.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AesCcm.Windows.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesCcm.Windows.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AesCcm.Windows.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesCcm.Windows.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AesCcm.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesCcm.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AesCcm.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesCcm.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AesGcm.Android.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesGcm.Android.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AesGcm.Android.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesGcm.Android.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AesGcm.NotSupported.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesGcm.NotSupported.cs similarity index 95% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AesGcm.NotSupported.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesGcm.NotSupported.cs index 0950177836646c..e8a82787e8ee3f 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AesGcm.NotSupported.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesGcm.NotSupported.cs @@ -9,7 +9,6 @@ public partial class AesGcm { public static bool IsSupported => false; -#if !BROWSER // allow GenFacades to handle browser target private void ImportKey(ReadOnlySpan key) { Debug.Fail("Instance ctor should fail before we reach this point."); @@ -43,6 +42,5 @@ public void Dispose() Debug.Fail("Instance ctor should fail before we reach this point."); // no-op } -#endif } } diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AesGcm.Unix.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesGcm.OpenSsl.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AesGcm.Unix.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesGcm.OpenSsl.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AesGcm.Windows.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesGcm.Windows.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AesGcm.Windows.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesGcm.Windows.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AesGcm.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesGcm.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AesGcm.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesGcm.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/AesImplementation.OSX.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesImplementation.Apple.cs similarity index 94% rename from src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/AesImplementation.OSX.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesImplementation.Apple.cs index 5c2a9c5602fcb5..f4b595ca0839b3 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/AesImplementation.OSX.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesImplementation.Apple.cs @@ -1,10 +1,9 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; -using System.Security.Cryptography; +using Internal.Cryptography; -namespace Internal.Cryptography +namespace System.Security.Cryptography { internal sealed partial class AesImplementation { diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesImplementation.NotSupported.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesImplementation.NotSupported.cs new file mode 100644 index 00000000000000..86483ca199806c --- /dev/null +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesImplementation.NotSupported.cs @@ -0,0 +1,35 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Internal.Cryptography; + +namespace System.Security.Cryptography +{ + internal sealed partial class AesImplementation : Aes + { + private static UniversalCryptoTransform CreateTransformCore( + CipherMode cipherMode, + PaddingMode paddingMode, + byte[] key, + byte[]? iv, + int blockSize, + int paddingSize, + int feedback, + bool encrypting) + { + throw new PlatformNotSupportedException(SR.Format(SR.Cryptography_AlgorithmNotSupported, nameof(Aes))); + } + + private static ILiteSymmetricCipher CreateLiteCipher( + CipherMode cipherMode, + ReadOnlySpan key, + ReadOnlySpan iv, + int blockSize, + int paddingSize, + int feedback, + bool encrypting) + { + throw new PlatformNotSupportedException(SR.Format(SR.Cryptography_AlgorithmNotSupported, nameof(Aes))); + } + } +} diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/AesImplementation.Unix.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesImplementation.OpenSsl.cs similarity index 97% rename from src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/AesImplementation.Unix.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesImplementation.OpenSsl.cs index 649e22dea891ee..1f4720184dd40c 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/AesImplementation.Unix.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesImplementation.OpenSsl.cs @@ -1,10 +1,9 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; -using System.Security.Cryptography; +using Internal.Cryptography; -namespace Internal.Cryptography +namespace System.Security.Cryptography { internal sealed partial class AesImplementation { diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/AesImplementation.Windows.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesImplementation.Windows.cs similarity index 95% rename from src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/AesImplementation.Windows.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesImplementation.Windows.cs index c66b9918e67236..9e2f44653026de 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/AesImplementation.Windows.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesImplementation.Windows.cs @@ -1,11 +1,10 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; -using System.Security.Cryptography; +using Internal.Cryptography; using Internal.NativeCrypto; -namespace Internal.Cryptography +namespace System.Security.Cryptography { internal sealed partial class AesImplementation { diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/AesImplementation.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesImplementation.cs similarity index 98% rename from src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/AesImplementation.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesImplementation.cs index d7b43bd0c7de1c..9b413892203448 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/AesImplementation.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesImplementation.cs @@ -1,10 +1,9 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; -using System.Security.Cryptography; +using Internal.Cryptography; -namespace Internal.Cryptography +namespace System.Security.Cryptography { internal sealed partial class AesImplementation : Aes { diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AesManaged.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesManaged.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AesManaged.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesManaged.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/AppleCCCryptor.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AppleCCCryptor.cs similarity index 97% rename from src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/AppleCCCryptor.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AppleCCCryptor.cs index c99a6bd3514230..a5a0f696ee74c3 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/AppleCCCryptor.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AppleCCCryptor.cs @@ -1,13 +1,11 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; -using System.Security.Cryptography; using Internal.Cryptography; -namespace Internal.Cryptography +namespace System.Security.Cryptography { internal sealed class AppleCCCryptor : BasicSymmetricCipher { diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/AppleCCCryptorLite.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AppleCCCryptorLite.cs similarity index 98% rename from src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/AppleCCCryptorLite.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AppleCCCryptorLite.cs index 34c00b04d96422..f4bb6969361f82 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/AppleCCCryptorLite.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AppleCCCryptorLite.cs @@ -1,18 +1,17 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; using System.Buffers; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; -using System.Security.Cryptography; +using Internal.Cryptography; using Microsoft.Win32.SafeHandles; using PAL_SymmetricAlgorithm = Interop.AppleCrypto.PAL_SymmetricAlgorithm; using PAL_ChainingMode = Interop.AppleCrypto.PAL_ChainingMode; -namespace Internal.Cryptography +namespace System.Security.Cryptography { internal sealed class AppleCCCryptorLite : ILiteSymmetricCipher { diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AsymmetricKeyExchangeDeformatter.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AsymmetricKeyExchangeDeformatter.cs similarity index 87% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AsymmetricKeyExchangeDeformatter.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AsymmetricKeyExchangeDeformatter.cs index 5065ae0a7c5dff..21836c6d9ce24e 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AsymmetricKeyExchangeDeformatter.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AsymmetricKeyExchangeDeformatter.cs @@ -1,11 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Runtime.Versioning; - namespace System.Security.Cryptography { - [UnsupportedOSPlatform("browser")] public abstract class AsymmetricKeyExchangeDeformatter { protected AsymmetricKeyExchangeDeformatter() { } diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AsymmetricKeyExchangeFormatter.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AsymmetricKeyExchangeFormatter.cs index 8d883bc5aee80d..73750b20bfbcec 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AsymmetricKeyExchangeFormatter.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AsymmetricKeyExchangeFormatter.cs @@ -1,11 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Runtime.Versioning; - namespace System.Security.Cryptography { - [UnsupportedOSPlatform("browser")] public abstract class AsymmetricKeyExchangeFormatter { protected AsymmetricKeyExchangeFormatter() { } diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AsymmetricSignatureDeformatter.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AsymmetricSignatureDeformatter.cs similarity index 89% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AsymmetricSignatureDeformatter.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AsymmetricSignatureDeformatter.cs index 1783303ea8d522..2cd815e66dec61 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AsymmetricSignatureDeformatter.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AsymmetricSignatureDeformatter.cs @@ -2,12 +2,9 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Diagnostics; -using System.Runtime.Versioning; -using Internal.Cryptography; namespace System.Security.Cryptography { - [UnsupportedOSPlatform("browser")] public abstract class AsymmetricSignatureDeformatter { protected AsymmetricSignatureDeformatter() { } diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AsymmetricSignatureFormatter.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AsymmetricSignatureFormatter.cs similarity index 89% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AsymmetricSignatureFormatter.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AsymmetricSignatureFormatter.cs index 95d0a92c763e3e..4fd2bd0869004e 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AsymmetricSignatureFormatter.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AsymmetricSignatureFormatter.cs @@ -2,12 +2,9 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Diagnostics; -using System.Runtime.Versioning; -using Internal.Cryptography; namespace System.Security.Cryptography { - [UnsupportedOSPlatform("browser")] public abstract class AsymmetricSignatureFormatter { protected AsymmetricSignatureFormatter() { } diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ChaCha20Poly1305.Android.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ChaCha20Poly1305.Android.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ChaCha20Poly1305.Android.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ChaCha20Poly1305.Android.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ChaCha20Poly1305.NotSupported.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ChaCha20Poly1305.NotSupported.cs similarity index 95% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ChaCha20Poly1305.NotSupported.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ChaCha20Poly1305.NotSupported.cs index 05e4d39531f6e0..6e4c1536e66119 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ChaCha20Poly1305.NotSupported.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ChaCha20Poly1305.NotSupported.cs @@ -9,7 +9,6 @@ public partial class ChaCha20Poly1305 { public static bool IsSupported => false; -#if !BROWSER // allow GenFacades to handle browser target private void ImportKey(ReadOnlySpan key) { Debug.Fail("Instance ctor should fail before we reach this point."); @@ -43,6 +42,5 @@ public void Dispose() Debug.Fail("Instance ctor should fail before we reach this point."); // no-op } -#endif } } diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ChaCha20Poly1305.Unix.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ChaCha20Poly1305.OpenSsl.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ChaCha20Poly1305.Unix.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ChaCha20Poly1305.OpenSsl.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ChaCha20Poly1305.Windows.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ChaCha20Poly1305.Windows.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ChaCha20Poly1305.Windows.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ChaCha20Poly1305.Windows.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ChaCha20Poly1305.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ChaCha20Poly1305.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ChaCha20Poly1305.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ChaCha20Poly1305.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/CngKeyLite.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/CngKeyLite.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/CngKeyLite.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/CngKeyLite.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/CngPkcs8.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/CngPkcs8.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/CngPkcs8.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/CngPkcs8.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/CryptoConfig.Common.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/CryptoConfig.Common.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/CryptoConfig.Common.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/CryptoConfig.Common.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/CryptoConfig.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/CryptoConfig.cs similarity index 95% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/CryptoConfig.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/CryptoConfig.cs index baa5fa2d3db6a0..886bfb290731ec 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/CryptoConfig.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/CryptoConfig.cs @@ -13,6 +13,7 @@ namespace System.Security.Cryptography { public partial class CryptoConfig { +#if !BROWSER private const string AssemblyName_Cng = "System.Security.Cryptography.Cng"; private const string AssemblyName_Csp = "System.Security.Cryptography.Csp"; private const string AssemblyName_Pkcs = "System.Security.Cryptography.Pkcs"; @@ -299,10 +300,14 @@ private static Dictionary DefaultNameHT // string DpapiDataProtectorType = "System.Security.Cryptography.DpapiDataProtector, " + AssemblyRef.SystemSecurity; } } +#endif [UnsupportedOSPlatform("browser")] public static void AddAlgorithm(Type algorithm, params string[] names) { +#if BROWSER + throw new PlatformNotSupportedException(SR.SystemSecurityCryptography_PlatformNotSupported); +#else if (algorithm == null) throw new ArgumentNullException(nameof(algorithm)); if (!algorithm.IsVisible) @@ -328,6 +333,7 @@ public static void AddAlgorithm(Type algorithm, params string[] names) { appNameHT[name] = algorithm; } +#endif } [RequiresUnreferencedCode("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")] @@ -336,6 +342,32 @@ public static void AddAlgorithm(Type algorithm, params string[] names) if (name == null) throw new ArgumentNullException(nameof(name)); +#if BROWSER + switch (name) + { +#pragma warning disable SYSLIB0021 // Obsolete: derived cryptographic types + // hardcode mapping for SHA* algorithm names from https://docs.microsoft.com/en-us/dotnet/api/system.security.cryptography.cryptoconfig?view=net-5.0#remarks + case "SHA": + case "SHA1": + case "System.Security.Cryptography.SHA1": + return new SHA1Managed(); + case "SHA256": + case "SHA-256": + case "System.Security.Cryptography.SHA256": + return new SHA256Managed(); + case "SHA384": + case "SHA-384": + case "System.Security.Cryptography.SHA384": + return new SHA384Managed(); + case "SHA512": + case "SHA-512": + case "System.Security.Cryptography.SHA512": + return new SHA512Managed(); +#pragma warning restore SYSLIB0021 + } + + return null; +#else // Check to see if we have an application defined mapping appNameHT.TryGetValue(name, out Type? retvalType); @@ -449,6 +481,7 @@ public static void AddAlgorithm(Type algorithm, params string[] names) } return retval; +#endif } [RequiresUnreferencedCode(CreateFromNameUnreferencedCodeMessage)] @@ -460,6 +493,9 @@ public static void AddAlgorithm(Type algorithm, params string[] names) [UnsupportedOSPlatform("browser")] public static void AddOID(string oid, params string[] names) { +#if BROWSER + throw new PlatformNotSupportedException(SR.SystemSecurityCryptography_PlatformNotSupported); +#else if (oid == null) throw new ArgumentNullException(nameof(oid)); if (names == null) @@ -483,11 +519,15 @@ public static void AddOID(string oid, params string[] names) { appOidHT[name] = oid; } +#endif } [UnsupportedOSPlatform("browser")] public static string? MapNameToOID(string name) { +#if BROWSER + throw new PlatformNotSupportedException(SR.SystemSecurityCryptography_PlatformNotSupported); +#else if (name == null) throw new ArgumentNullException(nameof(name)); @@ -504,12 +544,16 @@ public static void AddOID(string oid, params string[] names) } return oidName; +#endif } [UnsupportedOSPlatform("browser")] [Obsolete(Obsoletions.CryptoConfigEncodeOIDMessage, DiagnosticId = Obsoletions.CryptoConfigEncodeOIDDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] public static byte[] EncodeOID(string str) { +#if BROWSER + throw new PlatformNotSupportedException(SR.SystemSecurityCryptography_PlatformNotSupported); +#else if (str == null) throw new ArgumentNullException(nameof(str)); @@ -555,8 +599,10 @@ public static byte[] EncodeOID(string str) encodedOidNums[1] = (byte)(encodedOidNumsIndex - 2); return encodedOidNums; +#endif } +#if !BROWSER private static void EncodeSingleOidNum(uint value, byte[]? destination, ref int index) { // Write directly to destination starting at index, and update index based on how many bytes written. @@ -636,5 +682,6 @@ private static void EncodeSingleOidNum(uint value, byte[]? destination, ref int } } } +#endif } } diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DES.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DES.cs similarity index 98% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DES.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DES.cs index 4f7be0a3944d6e..ebf918c65a4410 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DES.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DES.cs @@ -9,7 +9,6 @@ namespace System.Security.Cryptography { - [UnsupportedOSPlatform("browser")] [EditorBrowsable(EditorBrowsableState.Never)] public abstract class DES : SymmetricAlgorithm { @@ -22,6 +21,7 @@ protected DES() FeedbackSizeValue = BlockSizeValue; } + [UnsupportedOSPlatform("browser")] public static new DES Create() { return new DesImplementation(); diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSA.Create.Android.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DSA.Create.Android.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSA.Create.Android.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DSA.Create.Android.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSA.Create.NotSupported.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DSA.Create.NotSupported.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSA.Create.NotSupported.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DSA.Create.NotSupported.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSA.Xml.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DSA.Xml.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSA.Xml.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DSA.Xml.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSA.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DSA.cs similarity index 99% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSA.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DSA.cs index d9c8944f530f9c..c19b7103384cc0 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSA.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DSA.cs @@ -7,12 +7,10 @@ using System.Formats.Asn1; using System.IO; using System.Runtime.Versioning; -using System.Security.Cryptography.Asn1; using Internal.Cryptography; namespace System.Security.Cryptography { - [UnsupportedOSPlatform("browser")] public abstract partial class DSA : AsymmetricAlgorithm { // As of FIPS 186-4 the maximum Q size is 256 bits (32 bytes). @@ -35,6 +33,7 @@ protected DSA() { } return (DSA?)CryptoConfig.CreateFromName(algName); } + [UnsupportedOSPlatform("browser")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] public static new DSA Create() @@ -42,6 +41,7 @@ protected DSA() { } return CreateCore(); } + [UnsupportedOSPlatform("browser")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] public static DSA Create(int keySizeInBits) @@ -60,6 +60,7 @@ public static DSA Create(int keySizeInBits) } } + [UnsupportedOSPlatform("browser")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] public static DSA Create(DSAParameters parameters) diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSACng.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DSACng.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSACng.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DSACng.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSAParameters.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DSAParameters.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSAParameters.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DSAParameters.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSASignatureDeformatter.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DSASignatureDeformatter.cs similarity index 92% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSASignatureDeformatter.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DSASignatureDeformatter.cs index b2fb1ee1da41b9..8bc3023057a26a 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSASignatureDeformatter.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DSASignatureDeformatter.cs @@ -1,12 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Runtime.Versioning; -using Internal.Cryptography; - namespace System.Security.Cryptography { - [UnsupportedOSPlatform("browser")] public class DSASignatureDeformatter : AsymmetricSignatureDeformatter { private DSA? _dsaKey; @@ -45,7 +41,7 @@ public override bool VerifySignature(byte[] rgbHash, byte[] rgbSignature) if (rgbSignature == null) throw new ArgumentNullException(nameof(rgbSignature)); if (_dsaKey == null) - throw new CryptographicUnexpectedOperationException(SR.Cryptography_MissingKey); + throw new CryptographicUnexpectedOperationException(SR.Cryptography_FormatterMissingKey); return _dsaKey.VerifySignature(rgbHash, rgbSignature); } diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSASignatureFormat.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DSASignatureFormat.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSASignatureFormat.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DSASignatureFormat.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSASignatureFormatter.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DSASignatureFormatter.cs similarity index 91% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSASignatureFormatter.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DSASignatureFormatter.cs index f6f5bf3f4283a5..9e2a9ef0aa376a 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSASignatureFormatter.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DSASignatureFormatter.cs @@ -1,12 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Runtime.Versioning; -using Internal.Cryptography; - namespace System.Security.Cryptography { - [UnsupportedOSPlatform("browser")] public class DSASignatureFormatter : AsymmetricSignatureFormatter { private DSA? _dsaKey; @@ -43,7 +39,7 @@ public override byte[] CreateSignature(byte[] rgbHash) if (rgbHash == null) throw new ArgumentNullException(nameof(rgbHash)); if (_dsaKey == null) - throw new CryptographicUnexpectedOperationException(SR.Cryptography_MissingKey); + throw new CryptographicUnexpectedOperationException(SR.Cryptography_FormatterMissingKey); return _dsaKey.CreateSignature(rgbHash); } diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DeriveBytes.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DeriveBytes.cs similarity index 87% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DeriveBytes.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DeriveBytes.cs index f1036945dc5e86..a75a250f32ecfb 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DeriveBytes.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DeriveBytes.cs @@ -1,11 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Runtime.Versioning; - namespace System.Security.Cryptography { - [UnsupportedOSPlatform("browser")] public abstract class DeriveBytes : IDisposable { public abstract byte[] GetBytes(int cb); diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/DesImplementation.Android.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DesImplementation.Android.cs similarity index 94% rename from src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/DesImplementation.Android.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DesImplementation.Android.cs index 2e335992252383..fabe9105200325 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/DesImplementation.Android.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DesImplementation.Android.cs @@ -1,11 +1,9 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; -using System.Diagnostics; -using System.Security.Cryptography; +using Internal.Cryptography; -namespace Internal.Cryptography +namespace System.Security.Cryptography { internal sealed partial class DesImplementation { diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/DesImplementation.OSX.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DesImplementation.Apple.cs similarity index 95% rename from src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/DesImplementation.OSX.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DesImplementation.Apple.cs index 2b99a07adc1310..2ee2586941ab61 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/DesImplementation.OSX.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DesImplementation.Apple.cs @@ -1,10 +1,9 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; -using System.Security.Cryptography; +using Internal.Cryptography; -namespace Internal.Cryptography +namespace System.Security.Cryptography { internal sealed partial class DesImplementation { diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DesImplementation.NotSupported.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DesImplementation.NotSupported.cs new file mode 100644 index 00000000000000..22964d37cebd86 --- /dev/null +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DesImplementation.NotSupported.cs @@ -0,0 +1,36 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Internal.Cryptography; + +namespace System.Security.Cryptography +{ + internal sealed partial class DesImplementation : DES + { + private static UniversalCryptoTransform CreateTransformCore( + CipherMode cipherMode, + PaddingMode paddingMode, + byte[] key, + byte[]? iv, + int blockSize, + int feedbackSizeInBytes, + int paddingSize, + bool encrypting) + { + throw new PlatformNotSupportedException(SR.Format(SR.Cryptography_AlgorithmNotSupported, nameof(DES))); + } + + private static ILiteSymmetricCipher CreateLiteCipher( + CipherMode cipherMode, + PaddingMode paddingMode, + ReadOnlySpan key, + ReadOnlySpan iv, + int blockSize, + int feedbackSizeInBytes, + int paddingSize, + bool encrypting) + { + throw new PlatformNotSupportedException(SR.Format(SR.Cryptography_AlgorithmNotSupported, nameof(DES))); + } + } +} diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/DesImplementation.Unix.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DesImplementation.OpenSsl.cs similarity index 95% rename from src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/DesImplementation.Unix.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DesImplementation.OpenSsl.cs index b22a1da6cf18ab..6320601afeab52 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/DesImplementation.Unix.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DesImplementation.OpenSsl.cs @@ -1,11 +1,9 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; -using System.Diagnostics; -using System.Security.Cryptography; +using Internal.Cryptography; -namespace Internal.Cryptography +namespace System.Security.Cryptography { internal sealed partial class DesImplementation { diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/DesImplementation.Windows.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DesImplementation.Windows.cs similarity index 95% rename from src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/DesImplementation.Windows.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DesImplementation.Windows.cs index b3bf43ea3440de..39447249767ddb 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/DesImplementation.Windows.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DesImplementation.Windows.cs @@ -1,11 +1,10 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; -using System.Security.Cryptography; +using Internal.Cryptography; using Internal.NativeCrypto; -namespace Internal.Cryptography +namespace System.Security.Cryptography { internal sealed partial class DesImplementation { diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/DesImplementation.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DesImplementation.cs similarity index 99% rename from src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/DesImplementation.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DesImplementation.cs index 396f451f1b6a88..d22e7d79725f7c 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/DesImplementation.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DesImplementation.cs @@ -1,10 +1,9 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; -using System.Security.Cryptography; +using Internal.Cryptography; -namespace Internal.Cryptography +namespace System.Security.Cryptography { [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA5350", Justification = "We are providing the implementation for DES, not consuming it.")] internal sealed partial class DesImplementation : DES diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECCngKey.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECCngKey.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECCngKey.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECCngKey.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECCurve.ECCurveType.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECCurve.ECCurveType.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECCurve.ECCurveType.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECCurve.ECCurveType.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECCurve.NamedCurves.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECCurve.NamedCurves.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECCurve.NamedCurves.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECCurve.NamedCurves.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECCurve.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECCurve.cs similarity index 99% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECCurve.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECCurve.cs index 11de2e1cfd62a4..a14e816f799df6 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECCurve.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECCurve.cs @@ -14,7 +14,6 @@ namespace System.Security.Cryptography /// which is either a prime curve or a characteristic-2 curve. /// [DebuggerDisplay("ECCurve: {Oid}")] - [UnsupportedOSPlatform("browser")] public partial struct ECCurve { /// diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDiffieHellman.Create.Android.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDiffieHellman.Create.Android.cs similarity index 79% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDiffieHellman.Create.Android.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDiffieHellman.Create.Android.cs index 0ec4bd325a6d96..cf8fadbb052cf0 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDiffieHellman.Create.Android.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDiffieHellman.Create.Android.cs @@ -5,17 +5,17 @@ namespace System.Security.Cryptography { public abstract partial class ECDiffieHellman : AsymmetricAlgorithm { - public static new ECDiffieHellman Create() + public static new partial ECDiffieHellman Create() { return new ECDiffieHellmanImplementation.ECDiffieHellmanAndroid(); } - public static ECDiffieHellman Create(ECCurve curve) + public static partial ECDiffieHellman Create(ECCurve curve) { return new ECDiffieHellmanImplementation.ECDiffieHellmanAndroid(curve); } - public static ECDiffieHellman Create(ECParameters parameters) + public static partial ECDiffieHellman Create(ECParameters parameters) { ECDiffieHellman ecdh = new ECDiffieHellmanImplementation.ECDiffieHellmanAndroid(); diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDiffieHellman.Create.Cng.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDiffieHellman.Create.Cng.cs similarity index 79% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDiffieHellman.Create.Cng.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDiffieHellman.Create.Cng.cs index c0d24574ef64d1..38cc0fb02d0a97 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDiffieHellman.Create.Cng.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDiffieHellman.Create.Cng.cs @@ -5,17 +5,17 @@ namespace System.Security.Cryptography { public abstract partial class ECDiffieHellman : AsymmetricAlgorithm { - public static new ECDiffieHellman Create() + public static new partial ECDiffieHellman Create() { return new ECDiffieHellmanImplementation.ECDiffieHellmanCng(); } - public static ECDiffieHellman Create(ECCurve curve) + public static partial ECDiffieHellman Create(ECCurve curve) { return new ECDiffieHellmanImplementation.ECDiffieHellmanCng(curve); } - public static ECDiffieHellman Create(ECParameters parameters) + public static partial ECDiffieHellman Create(ECParameters parameters) { ECDiffieHellman ecdh = new ECDiffieHellmanImplementation.ECDiffieHellmanCng(); diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDiffieHellman.Create.NotSupported.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDiffieHellman.Create.NotSupported.cs new file mode 100644 index 00000000000000..7653d3442b0fda --- /dev/null +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDiffieHellman.Create.NotSupported.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace System.Security.Cryptography +{ + public partial class ECDiffieHellman : AsymmetricAlgorithm + { + public static new partial ECDiffieHellman Create() + { + throw new PlatformNotSupportedException(); + } + + public static partial ECDiffieHellman Create(ECCurve curve) + { + throw new PlatformNotSupportedException(); + } + + public static partial ECDiffieHellman Create(ECParameters parameters) + { + throw new PlatformNotSupportedException(); + } + } +} diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDiffieHellman.Create.OpenSsl.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDiffieHellman.Create.OpenSsl.cs similarity index 79% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDiffieHellman.Create.OpenSsl.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDiffieHellman.Create.OpenSsl.cs index 1f9a60c9764a7b..00ccd89167451b 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDiffieHellman.Create.OpenSsl.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDiffieHellman.Create.OpenSsl.cs @@ -5,17 +5,17 @@ namespace System.Security.Cryptography { public abstract partial class ECDiffieHellman : AsymmetricAlgorithm { - public static new ECDiffieHellman Create() + public static new partial ECDiffieHellman Create() { return new ECDiffieHellmanImplementation.ECDiffieHellmanOpenSsl(); } - public static ECDiffieHellman Create(ECCurve curve) + public static partial ECDiffieHellman Create(ECCurve curve) { return new ECDiffieHellmanImplementation.ECDiffieHellmanOpenSsl(curve); } - public static ECDiffieHellman Create(ECParameters parameters) + public static partial ECDiffieHellman Create(ECParameters parameters) { ECDiffieHellman ecdh = new ECDiffieHellmanImplementation.ECDiffieHellmanOpenSsl(); diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDiffieHellman.Create.SecurityTransforms.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDiffieHellman.Create.SecurityTransforms.cs similarity index 82% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDiffieHellman.Create.SecurityTransforms.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDiffieHellman.Create.SecurityTransforms.cs index 855f2f46f1bee0..9d33e0c4e361a6 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDiffieHellman.Create.SecurityTransforms.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDiffieHellman.Create.SecurityTransforms.cs @@ -5,12 +5,12 @@ namespace System.Security.Cryptography { public abstract partial class ECDiffieHellman : AsymmetricAlgorithm { - public static new ECDiffieHellman Create() + public static new partial ECDiffieHellman Create() { return new ECDiffieHellmanImplementation.ECDiffieHellmanSecurityTransforms(); } - public static ECDiffieHellman Create(ECCurve curve) + public static partial ECDiffieHellman Create(ECCurve curve) { ECDiffieHellman ecdh = Create(); @@ -26,7 +26,7 @@ public static ECDiffieHellman Create(ECCurve curve) } } - public static ECDiffieHellman Create(ECParameters parameters) + public static partial ECDiffieHellman Create(ECParameters parameters) { ECDiffieHellman ecdh = Create(); diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDiffieHellman.Xml.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDiffieHellman.Xml.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDiffieHellman.Xml.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDiffieHellman.Xml.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDiffieHellman.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDiffieHellman.cs similarity index 98% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDiffieHellman.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDiffieHellman.cs index 3cc29e9bd87254..f3868103c2c9c0 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDiffieHellman.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDiffieHellman.cs @@ -4,7 +4,6 @@ using System.Diagnostics.CodeAnalysis; using System.Formats.Asn1; using System.Runtime.Versioning; -using System.Security.Cryptography.Asn1; using Internal.Cryptography; namespace System.Security.Cryptography @@ -12,7 +11,6 @@ namespace System.Security.Cryptography /// /// Abstract base class for implementations of elliptic curve Diffie-Hellman to derive from /// - [UnsupportedOSPlatform("browser")] public abstract partial class ECDiffieHellman : AsymmetricAlgorithm { private static readonly string[] s_validOids = @@ -32,6 +30,15 @@ public override string? SignatureAlgorithm get { return null; } } + [UnsupportedOSPlatform("browser")] + public static new partial ECDiffieHellman Create(); + + [UnsupportedOSPlatform("browser")] + public static partial ECDiffieHellman Create(ECCurve curve); + + [UnsupportedOSPlatform("browser")] + public static partial ECDiffieHellman Create(ECParameters parameters); + [RequiresUnreferencedCode(CryptoConfig.CreateFromNameUnreferencedCodeMessage)] public static new ECDiffieHellman? Create(string algorithm) { diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDiffieHellmanCng.Derive.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDiffieHellmanCng.Derive.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDiffieHellmanCng.Derive.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDiffieHellmanCng.Derive.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDiffieHellmanCng.Key.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDiffieHellmanCng.Key.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDiffieHellmanCng.Key.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDiffieHellmanCng.Key.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDiffieHellmanCng.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDiffieHellmanCng.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDiffieHellmanCng.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDiffieHellmanCng.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDiffieHellmanCngPublicKey.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDiffieHellmanCngPublicKey.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDiffieHellmanCngPublicKey.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDiffieHellmanCngPublicKey.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDiffieHellmanPublicKey.ExportParameters.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDiffieHellmanPublicKey.ExportParameters.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDiffieHellmanPublicKey.ExportParameters.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDiffieHellmanPublicKey.ExportParameters.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDiffieHellmanPublicKey.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDiffieHellmanPublicKey.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDiffieHellmanPublicKey.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDiffieHellmanPublicKey.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDsa.Create.Android.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDsa.Create.Android.cs similarity index 88% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDsa.Create.Android.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDsa.Create.Android.cs index d4b8e83bc99832..b2c02e05625f81 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDsa.Create.Android.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDsa.Create.Android.cs @@ -13,7 +13,7 @@ public partial class ECDsa : AsymmetricAlgorithm /// /// Creates an instance of the platform specific implementation of the cref="ECDsa" algorithm. /// - public static new ECDsa Create() + public static new partial ECDsa Create() { return new ECDsaImplementation.ECDsaAndroid(); } @@ -24,7 +24,7 @@ public partial class ECDsa : AsymmetricAlgorithm /// /// The representing the elliptic curve. /// - public static ECDsa Create(ECCurve curve) + public static partial ECDsa Create(ECCurve curve) { return new ECDsaImplementation.ECDsaAndroid(curve); } @@ -35,7 +35,7 @@ public static ECDsa Create(ECCurve curve) /// /// The representing the elliptic curve parameters. /// - public static ECDsa Create(ECParameters parameters) + public static partial ECDsa Create(ECParameters parameters) { ECDsa ec = new ECDsaImplementation.ECDsaAndroid(); ec.ImportParameters(parameters); diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDsa.Create.NotSupported.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDsa.Create.NotSupported.cs new file mode 100644 index 00000000000000..be8e95d1ed3cf3 --- /dev/null +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDsa.Create.NotSupported.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace System.Security.Cryptography +{ + public partial class ECDsa : AsymmetricAlgorithm + { + public static new partial ECDsa Create() + { + throw new PlatformNotSupportedException(); + } + + public static partial ECDsa Create(ECCurve curve) + { + throw new PlatformNotSupportedException(); + } + + public static partial ECDsa Create(ECParameters parameters) + { + throw new PlatformNotSupportedException(); + } + } +} diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDsaOpenSsl.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDsa.Create.OpenSsl.cs similarity index 87% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDsaOpenSsl.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDsa.Create.OpenSsl.cs index f51eb3e8c5bd2a..6d46f2825b3077 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDsaOpenSsl.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDsa.Create.OpenSsl.cs @@ -8,7 +8,7 @@ public partial class ECDsa : AsymmetricAlgorithm /// /// Creates an instance of the platform specific implementation of the cref="ECDsa" algorithm. /// - public static new ECDsa Create() + public static new partial ECDsa Create() { return new ECDsaImplementation.ECDsaOpenSsl(); } @@ -19,7 +19,7 @@ public partial class ECDsa : AsymmetricAlgorithm /// /// The representing the elliptic curve. /// - public static ECDsa Create(ECCurve curve) + public static partial ECDsa Create(ECCurve curve) { return new ECDsaImplementation.ECDsaOpenSsl(curve); } @@ -30,7 +30,7 @@ public static ECDsa Create(ECCurve curve) /// /// The representing the elliptic curve parameters. /// - public static ECDsa Create(ECParameters parameters) + public static partial ECDsa Create(ECParameters parameters) { ECDsa ec = new ECDsaImplementation.ECDsaOpenSsl(); ec.ImportParameters(parameters); diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDsa.Xml.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDsa.Xml.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDsa.Xml.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDsa.Xml.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDsa.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDsa.cs similarity index 99% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDsa.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDsa.cs index 77d87b102f2547..aac5c43e086b3b 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDsa.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDsa.cs @@ -12,7 +12,6 @@ namespace System.Security.Cryptography { - [UnsupportedOSPlatform("browser")] public abstract partial class ECDsa : AsymmetricAlgorithm { // secp521r1 maxes out at 139 bytes in the DER format, so 256 should always be enough @@ -29,6 +28,15 @@ public abstract partial class ECDsa : AsymmetricAlgorithm protected ECDsa() { } + [UnsupportedOSPlatform("browser")] + public static new partial ECDsa Create(); + + [UnsupportedOSPlatform("browser")] + public static partial ECDsa Create(ECCurve curve); + + [UnsupportedOSPlatform("browser")] + public static partial ECDsa Create(ECParameters parameters); + [RequiresUnreferencedCode(CryptoConfig.CreateFromNameUnreferencedCodeMessage)] public static new ECDsa? Create(string algorithm) { diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDsaCng.Key.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDsaCng.Key.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDsaCng.Key.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDsaCng.Key.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDsaCng.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDsaCng.cs similarity index 96% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDsaCng.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDsaCng.cs index f4c50e3b3ce336..4d0b96d8053e93 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDsaCng.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDsaCng.cs @@ -13,7 +13,7 @@ public partial class ECDsa : AsymmetricAlgorithm /// /// Creates an instance of the platform specific implementation of the cref="ECDsa" algorithm. /// - public static new ECDsa Create() + public static new partial ECDsa Create() { return new ECDsaImplementation.ECDsaCng(); } @@ -24,7 +24,7 @@ public partial class ECDsa : AsymmetricAlgorithm /// /// The representing the elliptic curve. /// - public static ECDsa Create(ECCurve curve) + public static partial ECDsa Create(ECCurve curve) { return new ECDsaImplementation.ECDsaCng(curve); } @@ -35,7 +35,7 @@ public static ECDsa Create(ECCurve curve) /// /// The representing the elliptic curve parameters. /// - public static ECDsa Create(ECParameters parameters) + public static partial ECDsa Create(ECParameters parameters) { ECDsa ec = new ECDsaImplementation.ECDsaCng(); ec.ImportParameters(parameters); diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECParameters.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECParameters.cs similarity index 91% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECParameters.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECParameters.cs index 5aec01dd373ec5..165f9877fcef84 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECParameters.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECParameters.cs @@ -1,17 +1,11 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Buffers; -using System.Runtime.InteropServices; -using System.Runtime.Versioning; -using System.Security.Cryptography.Asn1; - namespace System.Security.Cryptography { /// /// Represents the public and private key of the specified elliptic curve. /// - [UnsupportedOSPlatform("browser")] public struct ECParameters { /// diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECPoint.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECPoint.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECPoint.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECPoint.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HKDF.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HKDF.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HKDF.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HKDF.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/HMACCommon.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HMACCommon.cs similarity index 98% rename from src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/HMACCommon.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HMACCommon.cs index 8a9a0491a6c88e..7e64fc27c8da90 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/HMACCommon.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HMACCommon.cs @@ -1,11 +1,11 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; +using Internal.Cryptography; -namespace Internal.Cryptography +namespace System.Security.Cryptography { // // This class provides the common functionality for HMACSHA1, HMACSHA256, HMACMD5, etc. diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HMACMD5.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HMACMD5.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HMACMD5.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HMACMD5.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HMACSHA1.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HMACSHA1.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HMACSHA1.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HMACSHA1.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HMACSHA256.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HMACSHA256.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HMACSHA256.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HMACSHA256.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HMACSHA384.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HMACSHA384.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HMACSHA384.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HMACSHA384.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HMACSHA512.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HMACSHA512.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HMACSHA512.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HMACSHA512.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/HashAlgorithmNames.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HashAlgorithmNames.cs similarity index 96% rename from src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/HashAlgorithmNames.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HashAlgorithmNames.cs index cd1032317fa024..dc0a42f78ac8d3 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/HashAlgorithmNames.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HashAlgorithmNames.cs @@ -1,11 +1,9 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; using System.Collections.Generic; -using System.Security.Cryptography; -namespace Internal.Cryptography +namespace System.Security.Cryptography { internal static class HashAlgorithmNames { diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/HashProviderDispenser.OSX.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HashProviderDispenser.Apple.cs similarity index 99% rename from src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/HashProviderDispenser.OSX.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HashProviderDispenser.Apple.cs index c562dfff5a907d..fa80816a75abfb 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/HashProviderDispenser.OSX.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HashProviderDispenser.Apple.cs @@ -1,12 +1,11 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; using System.Diagnostics; -using System.Security.Cryptography; using System.Security.Cryptography.Apple; +using Internal.Cryptography; -namespace Internal.Cryptography +namespace System.Security.Cryptography { internal static partial class HashProviderDispenser { diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/HashProviderDispenser.Browser.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HashProviderDispenser.Browser.cs similarity index 94% rename from src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/HashProviderDispenser.Browser.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HashProviderDispenser.Browser.cs index cc0dc6f57319f8..893339cad6b417 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/HashProviderDispenser.Browser.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HashProviderDispenser.Browser.cs @@ -32,7 +32,7 @@ public static unsafe int MacData( ReadOnlySpan source, Span destination) { - throw new PlatformNotSupportedException(SR.SystemSecurityCryptographyAlgorithms_PlatformNotSupported); + throw new PlatformNotSupportedException(SR.SystemSecurityCryptography_PlatformNotSupported); } public static int HashData(string hashAlgorithmId, ReadOnlySpan source, Span destination) @@ -45,7 +45,7 @@ public static int HashData(string hashAlgorithmId, ReadOnlySpan source, Sp public static unsafe HashProvider CreateMacProvider(string hashAlgorithmId, ReadOnlySpan key) { - throw new PlatformNotSupportedException(SR.SystemSecurityCryptographyAlgorithms_PlatformNotSupported); + throw new PlatformNotSupportedException(SR.SystemSecurityCryptography_PlatformNotSupported); } } } diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/HashProviderDispenser.Unix.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HashProviderDispenser.OpenSsl.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/HashProviderDispenser.Unix.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HashProviderDispenser.OpenSsl.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/HashProviderDispenser.Windows.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HashProviderDispenser.Windows.cs similarity index 99% rename from src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/HashProviderDispenser.Windows.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HashProviderDispenser.Windows.cs index 88dd4da404679f..19b06adf5b0591 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/HashProviderDispenser.Windows.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HashProviderDispenser.Windows.cs @@ -1,17 +1,16 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; using System.Diagnostics; using System.Runtime.InteropServices; -using System.Security.Cryptography; +using Internal.Cryptography; using Microsoft.Win32.SafeHandles; using NTSTATUS = Interop.BCrypt.NTSTATUS; using BCryptOpenAlgorithmProviderFlags = Interop.BCrypt.BCryptOpenAlgorithmProviderFlags; using BCryptCreateHashFlags = Interop.BCrypt.BCryptCreateHashFlags; using BCryptAlgorithmCache = Interop.BCrypt.BCryptAlgorithmCache; -namespace Internal.Cryptography +namespace System.Security.Cryptography { // // Provides hash services via the native provider (CNG). diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/Helpers.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/Helpers.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/Helpers.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/Helpers.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/IncrementalHash.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/IncrementalHash.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/IncrementalHash.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/IncrementalHash.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/MD5.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/MD5.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/MD5.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/MD5.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/MaskGenerationMethod.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/MaskGenerationMethod.cs similarity index 81% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/MaskGenerationMethod.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/MaskGenerationMethod.cs index d737a491fc692c..701fb6c06a79d0 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/MaskGenerationMethod.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/MaskGenerationMethod.cs @@ -1,11 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Runtime.Versioning; - namespace System.Security.Cryptography { - [UnsupportedOSPlatform("browser")] public abstract class MaskGenerationMethod { public abstract byte[] GenerateMask(byte[] rgbSeed, int cbReturn); diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/OpenSslCipher.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/OpenSslCipher.cs similarity index 95% rename from src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/OpenSslCipher.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/OpenSslCipher.cs index e02f2e670dde46..7c03cf7fd8a34f 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/OpenSslCipher.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/OpenSslCipher.cs @@ -1,11 +1,10 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; using System.Diagnostics; -using System.Security.Cryptography; +using Internal.Cryptography; -namespace Internal.Cryptography +namespace System.Security.Cryptography { internal sealed class OpenSslCipher : BasicSymmetricCipher { diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/OpenSslCipherLite.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/OpenSslCipherLite.cs similarity index 98% rename from src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/OpenSslCipherLite.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/OpenSslCipherLite.cs index 82b4c38d3bb752..c378dc81140476 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/OpenSslCipherLite.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/OpenSslCipherLite.cs @@ -1,15 +1,14 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; using System.Buffers; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; -using System.Security.Cryptography; +using Internal.Cryptography; using Microsoft.Win32.SafeHandles; -namespace Internal.Cryptography +namespace System.Security.Cryptography { internal sealed class OpenSslCipherLite : ILiteSymmetricCipher { diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/PKCS1MaskGenerationMethod.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/PKCS1MaskGenerationMethod.cs similarity index 97% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/PKCS1MaskGenerationMethod.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/PKCS1MaskGenerationMethod.cs index 3a20624cfae8e6..8ae3747ed3a2da 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/PKCS1MaskGenerationMethod.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/PKCS1MaskGenerationMethod.cs @@ -4,11 +4,9 @@ using System.Buffers.Binary; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; -using System.Runtime.Versioning; namespace System.Security.Cryptography { - [UnsupportedOSPlatform("browser")] public class PKCS1MaskGenerationMethod : MaskGenerationMethod { private string _hashNameValue; diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/Pbkdf2Implementation.Managed.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/Pbkdf2Implementation.Managed.cs similarity index 77% rename from src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/Pbkdf2Implementation.Managed.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/Pbkdf2Implementation.Managed.cs index 9bb1a2c2f0247b..462382623c6f7d 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/Pbkdf2Implementation.Managed.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/Pbkdf2Implementation.Managed.cs @@ -1,11 +1,10 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; using System.Diagnostics; -using System.Security.Cryptography; +using Internal.Cryptography; -namespace Internal.Cryptography +namespace System.Security.Cryptography { internal static partial class Pbkdf2Implementation { @@ -18,8 +17,13 @@ public static unsafe void Fill( { Debug.Assert(!destination.IsEmpty); Debug.Assert(hashAlgorithmName.Name is not null); - // Fall back to managed implementation since Android doesn't support the full Pbkdf2 APIs - // until API level 26. + + if (!Helpers.HasHMAC) + { + throw new CryptographicException( + SR.Format(SR.Cryptography_AlgorithmNotSupported, "HMAC" + hashAlgorithmName.Name)); + } + using (Rfc2898DeriveBytes deriveBytes = new Rfc2898DeriveBytes( password.ToArray(), salt.ToArray(), diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/Pbkdf2Implementation.Unix.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/Pbkdf2Implementation.OpenSsl.cs similarity index 92% rename from src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/Pbkdf2Implementation.Unix.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/Pbkdf2Implementation.OpenSsl.cs index bace89794cafec..767bb87738aa8d 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/Pbkdf2Implementation.Unix.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/Pbkdf2Implementation.OpenSsl.cs @@ -1,11 +1,9 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; using System.Diagnostics; -using System.Security.Cryptography; -namespace Internal.Cryptography +namespace System.Security.Cryptography { internal static partial class Pbkdf2Implementation { diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/Pbkdf2Implementation.Windows.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/Pbkdf2Implementation.Windows.cs similarity index 99% rename from src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/Pbkdf2Implementation.Windows.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/Pbkdf2Implementation.Windows.cs index e9275bc28ae3cc..c8ea77d32a2ffa 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/Pbkdf2Implementation.Windows.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/Pbkdf2Implementation.Windows.cs @@ -1,10 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; using System.Diagnostics; using System.Threading; -using System.Security.Cryptography; using Microsoft.Win32.SafeHandles; using BCryptAlgPseudoHandle = Interop.BCrypt.BCryptAlgPseudoHandle; using BCryptBuffer = Interop.BCrypt.BCryptBuffer; @@ -12,7 +10,7 @@ using CngBufferDescriptors = Interop.BCrypt.CngBufferDescriptors; using NTSTATUS = Interop.BCrypt.NTSTATUS; -namespace Internal.Cryptography +namespace System.Security.Cryptography { internal static partial class Pbkdf2Implementation { diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/Pbkdf2Implementation.OSX.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/Pbkdf2Implementation.macOS.cs similarity index 94% rename from src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/Pbkdf2Implementation.OSX.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/Pbkdf2Implementation.macOS.cs index 4450166381e374..be842135d75f73 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/Pbkdf2Implementation.OSX.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/Pbkdf2Implementation.macOS.cs @@ -1,12 +1,10 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; using System.Diagnostics; -using System.Security.Cryptography; using PAL_HashAlgorithm = Interop.AppleCrypto.PAL_HashAlgorithm; -namespace Internal.Cryptography +namespace System.Security.Cryptography { internal static partial class Pbkdf2Implementation { diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RC2.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RC2.cs similarity index 97% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RC2.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RC2.cs index 73df4d554c21c2..c6a71fa5d5e96c 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RC2.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RC2.cs @@ -4,12 +4,10 @@ using System.ComponentModel; using System.Diagnostics.CodeAnalysis; using System.Runtime.Versioning; -using Internal.Cryptography; namespace System.Security.Cryptography { [EditorBrowsable(EditorBrowsableState.Never)] - [UnsupportedOSPlatform("browser")] public abstract class RC2 : SymmetricAlgorithm { protected int EffectiveKeySizeValue; @@ -24,6 +22,7 @@ protected RC2() } [UnsupportedOSPlatform("android")] + [UnsupportedOSPlatform("browser")] public static new RC2 Create() { return new RC2Implementation(); diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RC2Implementation.OSX.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RC2Implementation.Apple.cs similarity index 95% rename from src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RC2Implementation.OSX.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RC2Implementation.Apple.cs index e8076d8325cc14..a993ecf7099d60 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RC2Implementation.OSX.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RC2Implementation.Apple.cs @@ -1,10 +1,9 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; -using System.Security.Cryptography; +using Internal.Cryptography; -namespace Internal.Cryptography +namespace System.Security.Cryptography { internal sealed partial class RC2Implementation { diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RC2Implementation.Android.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RC2Implementation.NotSupported.cs similarity index 94% rename from src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RC2Implementation.Android.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RC2Implementation.NotSupported.cs index c1fb5a95f453a9..d1b39f89227802 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RC2Implementation.Android.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RC2Implementation.NotSupported.cs @@ -1,10 +1,9 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; -using System.Security.Cryptography; +using Internal.Cryptography; -namespace Internal.Cryptography +namespace System.Security.Cryptography { [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA5350", Justification = "We are providing the implementation for RC2, not consuming it.")] internal sealed partial class RC2Implementation : RC2 diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RC2Implementation.Unix.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RC2Implementation.OpenSsl.cs similarity index 94% rename from src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RC2Implementation.Unix.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RC2Implementation.OpenSsl.cs index b479d915330010..acb946a2c601b6 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RC2Implementation.Unix.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RC2Implementation.OpenSsl.cs @@ -1,11 +1,9 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; -using System.Diagnostics; -using System.Security.Cryptography; +using Internal.Cryptography; -namespace Internal.Cryptography +namespace System.Security.Cryptography { internal sealed partial class RC2Implementation { diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RC2Implementation.Windows.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RC2Implementation.Windows.cs similarity index 94% rename from src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RC2Implementation.Windows.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RC2Implementation.Windows.cs index 20d0e04e88ac10..1223fbdbcc3e9e 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RC2Implementation.Windows.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RC2Implementation.Windows.cs @@ -1,12 +1,10 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; -using System.Security.Cryptography; -using System.Diagnostics; +using Internal.Cryptography; using Internal.NativeCrypto; -namespace Internal.Cryptography +namespace System.Security.Cryptography { internal sealed partial class RC2Implementation { diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RC2Implementation.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RC2Implementation.cs similarity index 99% rename from src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RC2Implementation.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RC2Implementation.cs index 5353006e0989c6..5e85bab4a4f3d7 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RC2Implementation.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RC2Implementation.cs @@ -1,11 +1,10 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; using System.Diagnostics; -using System.Security.Cryptography; +using Internal.Cryptography; -namespace Internal.Cryptography +namespace System.Security.Cryptography { [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA5350", Justification = "We are providing the implementation for RC2, not consuming it.")] internal sealed partial class RC2Implementation : RC2 diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSA.Create.Android.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSA.Create.Android.cs similarity index 82% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSA.Create.Android.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSA.Create.Android.cs index 1b312327545918..0d391d3fef5800 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSA.Create.Android.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSA.Create.Android.cs @@ -12,6 +12,6 @@ namespace System.Security.Cryptography { public partial class RSA : AsymmetricAlgorithm { - public static new RSA Create() => new RSAImplementation.RSAAndroid(); + public static new partial RSA Create() => new RSAImplementation.RSAAndroid(); } } diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSA.Create.NotSupported.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSA.Create.NotSupported.cs new file mode 100644 index 00000000000000..3d06565e660a97 --- /dev/null +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSA.Create.NotSupported.cs @@ -0,0 +1,13 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace System.Security.Cryptography +{ + public partial class RSA : AsymmetricAlgorithm + { + public static new partial RSA Create() + { + throw new PlatformNotSupportedException(); + } + } +} diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSA.Xml.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSA.Xml.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSA.Xml.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSA.Xml.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSA.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSA.cs similarity index 99% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSA.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSA.cs index 9aa15207646682..780c6e759f9032 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSA.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSA.cs @@ -12,15 +12,18 @@ namespace System.Security.Cryptography { - [UnsupportedOSPlatform("browser")] public abstract partial class RSA : AsymmetricAlgorithm { + [UnsupportedOSPlatform("browser")] + public static new partial RSA Create(); + [RequiresUnreferencedCode(CryptoConfig.CreateFromNameUnreferencedCodeMessage)] public static new RSA? Create(string algName) { return (RSA?)CryptoConfig.CreateFromName(algName); } + [UnsupportedOSPlatform("browser")] public static RSA Create(int keySizeInBits) { RSA rsa = Create(); @@ -37,6 +40,7 @@ public static RSA Create(int keySizeInBits) } } + [UnsupportedOSPlatform("browser")] public static RSA Create(RSAParameters parameters) { RSA rsa = Create(); diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSACng.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSACng.cs similarity index 99% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSACng.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSACng.cs index fecac4b75dd319..a3297868525192 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSACng.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSACng.cs @@ -9,7 +9,7 @@ namespace System.Security.Cryptography { public partial class RSA : AsymmetricAlgorithm { - public static new RSA Create() + public static new partial RSA Create() { return new RSAImplementation.RSACng(); } diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAEncryptionPadding.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSAEncryptionPadding.cs similarity index 98% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAEncryptionPadding.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSAEncryptionPadding.cs index ae356492bcec0d..cfc36cbbacf554 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAEncryptionPadding.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSAEncryptionPadding.cs @@ -2,14 +2,12 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Diagnostics.CodeAnalysis; -using System.Runtime.Versioning; namespace System.Security.Cryptography { /// /// Specifies the padding mode and parameters to use with RSA encryption or decryption operations. /// - [UnsupportedOSPlatform("browser")] public sealed class RSAEncryptionPadding : IEquatable { private static readonly RSAEncryptionPadding s_pkcs1 = new RSAEncryptionPadding(RSAEncryptionPaddingMode.Pkcs1, default(HashAlgorithmName)); diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAEncryptionPaddingMode.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSAEncryptionPaddingMode.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAEncryptionPaddingMode.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSAEncryptionPaddingMode.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAOAEPKeyExchangeDeformatter.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSAOAEPKeyExchangeDeformatter.cs similarity index 91% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAOAEPKeyExchangeDeformatter.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSAOAEPKeyExchangeDeformatter.cs index 0c2b3ba17ddaeb..668d0784db8a95 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAOAEPKeyExchangeDeformatter.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSAOAEPKeyExchangeDeformatter.cs @@ -1,11 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Runtime.Versioning; - namespace System.Security.Cryptography { - [UnsupportedOSPlatform("browser")] public class RSAOAEPKeyExchangeDeformatter : AsymmetricKeyExchangeDeformatter { private RSA? _rsaKey; @@ -28,7 +25,7 @@ public override string? Parameters public override byte[] DecryptKeyExchange(byte[] rgbData) { if (_rsaKey == null) - throw new CryptographicUnexpectedOperationException(SR.Cryptography_MissingKey); + throw new CryptographicUnexpectedOperationException(SR.Cryptography_FormatterMissingKey); return _rsaKey.Decrypt(rgbData, RSAEncryptionPadding.OaepSHA1); } diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAOAEPKeyExchangeFormatter.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSAOAEPKeyExchangeFormatter.cs similarity index 95% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAOAEPKeyExchangeFormatter.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSAOAEPKeyExchangeFormatter.cs index e6eceeaca70860..dd8568c359453d 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAOAEPKeyExchangeFormatter.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSAOAEPKeyExchangeFormatter.cs @@ -1,11 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Runtime.Versioning; - namespace System.Security.Cryptography { - [UnsupportedOSPlatform("browser")] public class RSAOAEPKeyExchangeFormatter : AsymmetricKeyExchangeFormatter { private byte[]? ParameterValue; @@ -72,7 +69,7 @@ public override byte[] CreateKeyExchange(byte[] rgbData, Type? symAlgType) public override byte[] CreateKeyExchange(byte[] rgbData) { if (_rsaKey == null) - throw new CryptographicUnexpectedOperationException(SR.Cryptography_MissingKey); + throw new CryptographicUnexpectedOperationException(SR.Cryptography_FormatterMissingKey); return _rsaKey.Encrypt(rgbData, RSAEncryptionPadding.OaepSHA1); } diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAPKCS1KeyExchangeDeformatter.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSAPKCS1KeyExchangeDeformatter.cs similarity index 95% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAPKCS1KeyExchangeDeformatter.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSAPKCS1KeyExchangeDeformatter.cs index 8270bcb7427dd8..ea54291305abcf 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAPKCS1KeyExchangeDeformatter.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSAPKCS1KeyExchangeDeformatter.cs @@ -5,7 +5,6 @@ namespace System.Security.Cryptography { - [UnsupportedOSPlatform("browser")] public class RSAPKCS1KeyExchangeDeformatter : AsymmetricKeyExchangeDeformatter { private RSA? _rsaKey; @@ -36,7 +35,7 @@ public override string? Parameters public override byte[] DecryptKeyExchange(byte[] rgbIn) { if (_rsaKey == null) - throw new CryptographicUnexpectedOperationException(SR.Cryptography_MissingKey); + throw new CryptographicUnexpectedOperationException(SR.Cryptography_FormatterMissingKey); return _rsaKey.Decrypt(rgbIn, RSAEncryptionPadding.Pkcs1); } diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAPKCS1KeyExchangeFormatter.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSAPKCS1KeyExchangeFormatter.cs similarity index 95% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAPKCS1KeyExchangeFormatter.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSAPKCS1KeyExchangeFormatter.cs index 9251511ae15359..b9cd034075a406 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAPKCS1KeyExchangeFormatter.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSAPKCS1KeyExchangeFormatter.cs @@ -5,7 +5,6 @@ namespace System.Security.Cryptography { - [UnsupportedOSPlatform("browser")] public class RSAPKCS1KeyExchangeFormatter : AsymmetricKeyExchangeFormatter { private RSA? _rsaKey; @@ -51,7 +50,7 @@ public override byte[] CreateKeyExchange(byte[] rgbData, Type? symAlgType) public override byte[] CreateKeyExchange(byte[] rgbData) { if (_rsaKey == null) - throw new CryptographicUnexpectedOperationException(SR.Cryptography_MissingKey); + throw new CryptographicUnexpectedOperationException(SR.Cryptography_FormatterMissingKey); return _rsaKey.Encrypt(rgbData, RSAEncryptionPadding.Pkcs1); } diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAPKCS1SignatureDeformatter.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSAPKCS1SignatureDeformatter.cs similarity index 95% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAPKCS1SignatureDeformatter.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSAPKCS1SignatureDeformatter.cs index 81feeca7e89775..22eeaae1fc6596 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAPKCS1SignatureDeformatter.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSAPKCS1SignatureDeformatter.cs @@ -51,9 +51,9 @@ public override bool VerifySignature(byte[] rgbHash, byte[] rgbSignature) if (rgbSignature == null) throw new ArgumentNullException(nameof(rgbSignature)); if (_algName == null) - throw new CryptographicUnexpectedOperationException(SR.Cryptography_MissingOID); + throw new CryptographicUnexpectedOperationException(SR.Cryptography_FormatterMissingAlgorithm); if (_rsaKey == null) - throw new CryptographicUnexpectedOperationException(SR.Cryptography_MissingKey); + throw new CryptographicUnexpectedOperationException(SR.Cryptography_FormatterMissingKey); return _rsaKey.VerifyHash(rgbHash, rgbSignature, new HashAlgorithmName(_algName), RSASignaturePadding.Pkcs1); } diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAPKCS1SignatureFormatter.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSAPKCS1SignatureFormatter.cs similarity index 95% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAPKCS1SignatureFormatter.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSAPKCS1SignatureFormatter.cs index dcd7139c2a5a82..938e2a60c3eb20 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAPKCS1SignatureFormatter.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSAPKCS1SignatureFormatter.cs @@ -50,9 +50,9 @@ public override byte[] CreateSignature(byte[] rgbHash) if (rgbHash == null) throw new ArgumentNullException(nameof(rgbHash)); if (_algName == null) - throw new CryptographicUnexpectedOperationException(SR.Cryptography_MissingOID); + throw new CryptographicUnexpectedOperationException(SR.Cryptography_FormatterMissingAlgorithm); if (_rsaKey == null) - throw new CryptographicUnexpectedOperationException(SR.Cryptography_MissingKey); + throw new CryptographicUnexpectedOperationException(SR.Cryptography_FormatterMissingKey); return _rsaKey.SignHash(rgbHash, new HashAlgorithmName(_algName), RSASignaturePadding.Pkcs1); } diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAParameters.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSAParameters.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAParameters.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSAParameters.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSASignaturePadding.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSASignaturePadding.cs similarity index 98% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSASignaturePadding.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSASignaturePadding.cs index 82b37d63c799d8..60ee325a9fccbc 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSASignaturePadding.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSASignaturePadding.cs @@ -13,7 +13,6 @@ namespace System.Security.Cryptography /// /// Specifies the padding mode and parameters to use with RSA signature creation or verification operations. /// - [UnsupportedOSPlatform("browser")] public sealed class RSASignaturePadding : IEquatable { private static readonly RSASignaturePadding s_pkcs1 = new RSASignaturePadding(RSASignaturePaddingMode.Pkcs1); diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSASignaturePaddingMode.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSASignaturePaddingMode.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSASignaturePaddingMode.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSASignaturePaddingMode.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RandomNumberGenerator.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RandomNumberGenerator.cs similarity index 98% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RandomNumberGenerator.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RandomNumberGenerator.cs index baad2d1e5c6a20..b299396c595d9a 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RandomNumberGenerator.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RandomNumberGenerator.cs @@ -4,7 +4,6 @@ using System.Buffers; using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; -using System.Runtime.Versioning; namespace System.Security.Cryptography { @@ -14,7 +13,6 @@ protected RandomNumberGenerator() { } public static RandomNumberGenerator Create() => RandomNumberGeneratorImplementation.s_singleton; - [UnsupportedOSPlatform("browser")] [RequiresUnreferencedCode(CryptoConfig.CreateFromNameUnreferencedCodeMessage)] public static RandomNumberGenerator? Create(string rngName) { diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RandomNumberGeneratorImplementation.OSX.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RandomNumberGeneratorImplementation.Apple.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RandomNumberGeneratorImplementation.OSX.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RandomNumberGeneratorImplementation.Apple.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RandomNumberGeneratorImplementation.Browser.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RandomNumberGeneratorImplementation.Browser.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RandomNumberGeneratorImplementation.Browser.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RandomNumberGeneratorImplementation.Browser.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RandomNumberGeneratorImplementation.Unix.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RandomNumberGeneratorImplementation.OpenSsl.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RandomNumberGeneratorImplementation.Unix.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RandomNumberGeneratorImplementation.OpenSsl.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RandomNumberGeneratorImplementation.Windows.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RandomNumberGeneratorImplementation.Windows.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RandomNumberGeneratorImplementation.Windows.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RandomNumberGeneratorImplementation.Windows.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RandomNumberGeneratorImplementation.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RandomNumberGeneratorImplementation.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RandomNumberGeneratorImplementation.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RandomNumberGeneratorImplementation.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/Rfc2898DeriveBytes.OneShot.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/Rfc2898DeriveBytes.OneShot.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/Rfc2898DeriveBytes.OneShot.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/Rfc2898DeriveBytes.OneShot.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/Rfc2898DeriveBytes.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/Rfc2898DeriveBytes.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/Rfc2898DeriveBytes.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/Rfc2898DeriveBytes.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/Rijndael.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/Rijndael.cs similarity index 97% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/Rijndael.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/Rijndael.cs index 35e3f117cbeb0d..c01c867cb9a2d4 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/Rijndael.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/Rijndael.cs @@ -10,9 +10,9 @@ namespace System.Security.Cryptography { [Obsolete(Obsoletions.RijndaelMessage, DiagnosticId = Obsoletions.RijndaelDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] [EditorBrowsable(EditorBrowsableState.Never)] - [UnsupportedOSPlatform("browser")] public abstract class Rijndael : SymmetricAlgorithm { + [UnsupportedOSPlatform("browser")] public static new Rijndael Create() { return new RijndaelImplementation(); diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RijndaelImplementation.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RijndaelImplementation.cs similarity index 96% rename from src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RijndaelImplementation.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RijndaelImplementation.cs index 8fa834703033b9..698926032dfdbb 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RijndaelImplementation.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RijndaelImplementation.cs @@ -1,11 +1,10 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; using System.Diagnostics; -using System.Security.Cryptography; +using System.Runtime.Versioning; -namespace Internal.Cryptography +namespace System.Security.Cryptography { /// /// Internal implementation of Rijndael. @@ -18,6 +17,7 @@ internal sealed class RijndaelImplementation : Rijndael { private readonly Aes _impl; + [UnsupportedOSPlatform("browser")] internal RijndaelImplementation() { LegalBlockSizesValue = new KeySizes[] { new KeySizes(minSize: 128, maxSize: 128, skipSize: 0) }; diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RijndaelManaged.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RijndaelManaged.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RijndaelManaged.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RijndaelManaged.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA1.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/SHA1.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA1.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/SHA1.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA1Managed.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/SHA1Managed.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA1Managed.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/SHA1Managed.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA256.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/SHA256.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA256.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/SHA256.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA256Managed.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/SHA256Managed.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA256Managed.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/SHA256Managed.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA384.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/SHA384.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA384.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/SHA384.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA384Managed.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/SHA384Managed.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA384Managed.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/SHA384Managed.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA512.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/SHA512.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA512.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/SHA512.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA512Managed.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/SHA512Managed.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA512Managed.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/SHA512Managed.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/SHAHashProvider.Browser.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/SHAHashProvider.Browser.cs similarity index 99% rename from src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/SHAHashProvider.Browser.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/SHAHashProvider.Browser.cs index fccdff3feb81a6..5a72d4de54b071 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/SHAHashProvider.Browser.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/SHAHashProvider.Browser.cs @@ -1,19 +1,19 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; using System.IO; using System.Diagnostics; -using System.Security.Cryptography; +using Internal.Cryptography; + using static System.Numerics.BitOperations; -namespace Internal.Cryptography +namespace System.Security.Cryptography { internal sealed class SHAHashProvider : HashProvider { private int hashSizeInBytes; private SHAManagedImplementationBase impl; - private MemoryStream buffer; + private MemoryStream? buffer; public SHAHashProvider(string hashAlgorithmId) { diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SignatureDescription.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/SignatureDescription.cs similarity index 96% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SignatureDescription.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/SignatureDescription.cs index 6ea774a53b41db..6415c9e5c03ae4 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SignatureDescription.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/SignatureDescription.cs @@ -2,11 +2,9 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Diagnostics.CodeAnalysis; -using System.Runtime.Versioning; namespace System.Security.Cryptography { - [UnsupportedOSPlatform("browser")] public class SignatureDescription { public string? KeyAlgorithm { get; set; } diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/TripleDES.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/TripleDES.cs similarity index 98% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/TripleDES.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/TripleDES.cs index 78a5dffe32d271..f81aa38669a04f 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/TripleDES.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/TripleDES.cs @@ -9,7 +9,6 @@ namespace System.Security.Cryptography { [SuppressMessage("Microsoft.Security", "CA5350", Justification = "We are providing the implementation for TripleDES, not consuming it.")] - [UnsupportedOSPlatform("browser")] public abstract class TripleDES : SymmetricAlgorithm { protected TripleDES() @@ -21,6 +20,7 @@ protected TripleDES() LegalKeySizesValue = s_legalKeySizes.CloneKeySizesArray(); } + [UnsupportedOSPlatform("browser")] public static new TripleDES Create() { return new TripleDesImplementation(); diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/TripleDesImplementation.OSX.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/TripleDesImplementation.Apple.cs similarity index 95% rename from src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/TripleDesImplementation.OSX.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/TripleDesImplementation.Apple.cs index 2f5d4d35594376..a94f8c13453189 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/TripleDesImplementation.OSX.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/TripleDesImplementation.Apple.cs @@ -1,10 +1,9 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; -using System.Security.Cryptography; +using Internal.Cryptography; -namespace Internal.Cryptography +namespace System.Security.Cryptography { internal sealed partial class TripleDesImplementation { diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/TripleDesImplementation.NotSupported.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/TripleDesImplementation.NotSupported.cs new file mode 100644 index 00000000000000..8bffe0f665219e --- /dev/null +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/TripleDesImplementation.NotSupported.cs @@ -0,0 +1,36 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Internal.Cryptography; + +namespace System.Security.Cryptography +{ + internal sealed partial class TripleDesImplementation : TripleDES + { + private static UniversalCryptoTransform CreateTransformCore( + CipherMode cipherMode, + PaddingMode paddingMode, + byte[] key, + byte[]? iv, + int blockSize, + int paddingSize, + int feedbackSize, + bool encrypting) + { + throw new PlatformNotSupportedException(SR.Format(SR.Cryptography_AlgorithmNotSupported, nameof(TripleDES))); + } + + private static ILiteSymmetricCipher CreateLiteCipher( + CipherMode cipherMode, + PaddingMode paddingMode, + ReadOnlySpan key, + ReadOnlySpan iv, + int blockSize, + int paddingSize, + int feedbackSize, + bool encrypting) + { + throw new PlatformNotSupportedException(SR.Format(SR.Cryptography_AlgorithmNotSupported, nameof(TripleDES))); + } + } +} diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/TripleDesImplementation.Unix.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/TripleDesImplementation.OpenSsl.cs similarity index 96% rename from src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/TripleDesImplementation.Unix.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/TripleDesImplementation.OpenSsl.cs index 475ca6d31809c5..98a2262f1bd861 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/TripleDesImplementation.Unix.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/TripleDesImplementation.OpenSsl.cs @@ -1,10 +1,9 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; -using System.Security.Cryptography; +using Internal.Cryptography; -namespace Internal.Cryptography +namespace System.Security.Cryptography { internal sealed partial class TripleDesImplementation { diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/TripleDesImplementation.Windows.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/TripleDesImplementation.Windows.cs similarity index 95% rename from src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/TripleDesImplementation.Windows.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/TripleDesImplementation.Windows.cs index a62fa61af61137..9543b485ae4fee 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/TripleDesImplementation.Windows.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/TripleDesImplementation.Windows.cs @@ -1,11 +1,10 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; -using System.Security.Cryptography; +using Internal.Cryptography; using Internal.NativeCrypto; -namespace Internal.Cryptography +namespace System.Security.Cryptography { internal sealed partial class TripleDesImplementation { diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/TripleDesImplementation.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/TripleDesImplementation.cs similarity index 99% rename from src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/TripleDesImplementation.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/TripleDesImplementation.cs index efc9c9fc6f9b1f..dfb681dc42519b 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/TripleDesImplementation.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/TripleDesImplementation.cs @@ -1,10 +1,9 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; -using System.Security.Cryptography; +using Internal.Cryptography; -namespace Internal.Cryptography +namespace System.Security.Cryptography { [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA5350", Justification = "We are providing the implementation for TripleDES, not consuming it.")] internal sealed partial class TripleDesImplementation : TripleDES diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/XmlKeyHelper.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/XmlKeyHelper.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/XmlKeyHelper.cs rename to src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/XmlKeyHelper.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/AesCcmTests.cs b/src/libraries/System.Security.Cryptography/tests/AesCcmTests.cs similarity index 99% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/AesCcmTests.cs rename to src/libraries/System.Security.Cryptography/tests/AesCcmTests.cs index eeb1f7edac2dcc..1d662f9a085c85 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/AesCcmTests.cs +++ b/src/libraries/System.Security.Cryptography/tests/AesCcmTests.cs @@ -6,7 +6,7 @@ using Test.Cryptography; using Xunit; -namespace System.Security.Cryptography.Algorithms.Tests +namespace System.Security.Cryptography.Tests { [ConditionalClass(typeof(AesCcm), nameof(AesCcm.IsSupported))] public class AesCcmTests : CommonAEADTests diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/AesGcmTests.cs b/src/libraries/System.Security.Cryptography/tests/AesGcmTests.cs similarity index 99% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/AesGcmTests.cs rename to src/libraries/System.Security.Cryptography/tests/AesGcmTests.cs index 0322e37aac23ca..1a41a2beb3f83d 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/AesGcmTests.cs +++ b/src/libraries/System.Security.Cryptography/tests/AesGcmTests.cs @@ -6,7 +6,7 @@ using Test.Cryptography; using Xunit; -namespace System.Security.Cryptography.Algorithms.Tests +namespace System.Security.Cryptography.Tests { [ConditionalClass(typeof(AesGcm), nameof(AesGcm.IsSupported))] public class AesGcmTests : CommonAEADTests diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/AesManagedTests.cs b/src/libraries/System.Security.Cryptography/tests/AesManagedTests.cs similarity index 98% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/AesManagedTests.cs rename to src/libraries/System.Security.Cryptography/tests/AesManagedTests.cs index 343db25c2e6a07..2db62616df8a5b 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/AesManagedTests.cs +++ b/src/libraries/System.Security.Cryptography/tests/AesManagedTests.cs @@ -6,7 +6,7 @@ using Test.Cryptography; using Xunit; -namespace System.Security.Cryptography.Encryption.Aes.Tests +namespace System.Security.Cryptography.Tests { /// /// Since AesManaged wraps Aes, we only test minimally here. diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/AesProvider.cs b/src/libraries/System.Security.Cryptography/tests/AesProvider.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/AesProvider.cs rename to src/libraries/System.Security.Cryptography/tests/AesProvider.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/AesTests.cs b/src/libraries/System.Security.Cryptography/tests/AesTests.cs similarity index 98% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/AesTests.cs rename to src/libraries/System.Security.Cryptography/tests/AesTests.cs index ab562651375901..815014cc908b76 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/AesTests.cs +++ b/src/libraries/System.Security.Cryptography/tests/AesTests.cs @@ -3,7 +3,7 @@ using Xunit; -namespace System.Security.Cryptography.Algorithms.Tests +namespace System.Security.Cryptography.Tests { [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] public partial class AesTests diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/AsymmetricSignatureFormatterTests.cs b/src/libraries/System.Security.Cryptography/tests/AsymmetricSignatureFormatterTests.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/AsymmetricSignatureFormatterTests.cs rename to src/libraries/System.Security.Cryptography/tests/AsymmetricSignatureFormatterTests.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/BlockSizeValueTests.cs b/src/libraries/System.Security.Cryptography/tests/BlockSizeValueTests.cs similarity index 95% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/BlockSizeValueTests.cs rename to src/libraries/System.Security.Cryptography/tests/BlockSizeValueTests.cs index 2f2756ec4c2904..2ea65c6d32951d 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/BlockSizeValueTests.cs +++ b/src/libraries/System.Security.Cryptography/tests/BlockSizeValueTests.cs @@ -1,10 +1,9 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Collections.Generic; using Xunit; -namespace System.Security.Cryptography.Hashing.Algorithms.Tests +namespace System.Security.Cryptography.Tests { [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] public class BlockSizeValueTests diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/ChaCha20Poly1305Tests.cs b/src/libraries/System.Security.Cryptography/tests/ChaCha20Poly1305Tests.cs similarity index 99% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/ChaCha20Poly1305Tests.cs rename to src/libraries/System.Security.Cryptography/tests/ChaCha20Poly1305Tests.cs index a6949919686b5a..7d39b45922fb32 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/ChaCha20Poly1305Tests.cs +++ b/src/libraries/System.Security.Cryptography/tests/ChaCha20Poly1305Tests.cs @@ -2,12 +2,11 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Collections.Generic; -using System.Diagnostics; using System.Linq; using Test.Cryptography; using Xunit; -namespace System.Security.Cryptography.Algorithms.Tests +namespace System.Security.Cryptography.Tests { [ConditionalClass(typeof(ChaCha20Poly1305), nameof(ChaCha20Poly1305.IsSupported))] public class ChaCha20Poly1305Tests : CommonAEADTests diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/CngUtility.cs b/src/libraries/System.Security.Cryptography/tests/CngUtility.cs similarity index 97% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/CngUtility.cs rename to src/libraries/System.Security.Cryptography/tests/CngUtility.cs index e22d6ae8e78717..9d23acdf063fa2 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/CngUtility.cs +++ b/src/libraries/System.Security.Cryptography/tests/CngUtility.cs @@ -4,7 +4,7 @@ using System.Runtime.InteropServices; using Xunit; -namespace System.Security.Cryptography.Algorithms.Tests +namespace System.Security.Cryptography.Tests { internal static class CngUtility { diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/CommonAEADTests.cs b/src/libraries/System.Security.Cryptography/tests/CommonAEADTests.cs similarity index 98% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/CommonAEADTests.cs rename to src/libraries/System.Security.Cryptography/tests/CommonAEADTests.cs index eb774ecd879b84..758f5f391481c6 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/CommonAEADTests.cs +++ b/src/libraries/System.Security.Cryptography/tests/CommonAEADTests.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; -namespace System.Security.Cryptography.Algorithms.Tests +namespace System.Security.Cryptography.Tests { public abstract class CommonAEADTests { diff --git a/src/libraries/System.Security.Cryptography/tests/CryptoConfigTests.cs b/src/libraries/System.Security.Cryptography/tests/CryptoConfigTests.cs index 1f11199b013991..3ccc914ffb7825 100644 --- a/src/libraries/System.Security.Cryptography/tests/CryptoConfigTests.cs +++ b/src/libraries/System.Security.Cryptography/tests/CryptoConfigTests.cs @@ -1,6 +1,9 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Collections.Generic; +using System.Reflection; +using System.Text; using Test.Cryptography; using Xunit; @@ -184,5 +187,437 @@ public static void NamedCreate_Unknown() Assert.Null(HMAC.Create(UnknownAlgorithmName)); Assert.Null(SymmetricAlgorithm.Create(UnknownAlgorithmName)); } + + [Fact] + public static void AllowOnlyFipsAlgorithms() + { + Assert.False(CryptoConfig.AllowOnlyFipsAlgorithms); + } + + [Fact] + [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] + public static void AddOID_MapNameToOID_ReturnsMapped() + { + CryptoConfig.AddOID("1.3.14.3.2.28", "SHAFancy"); + Assert.Equal("1.3.14.3.2.28", CryptoConfig.MapNameToOID("SHAFancy")); + } + + [Fact] + [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] + public static void AddOID_EmptyString_Throws() + { + AssertExtensions.Throws(null, () => CryptoConfig.AddOID(string.Empty, string.Empty)); + } + + [Fact] + [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] + public static void AddOID_EmptyNamesArray() + { + CryptoConfig.AddOID("1.3.14.3.2.28", new string[0]); + // There is no verifiable behavior in this case. We only check that we don't throw. + } + + [Fact] + [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] + public static void AddOID_NullOid_Throws() + { + AssertExtensions.Throws("oid", () => CryptoConfig.AddOID(null, string.Empty)); + } + + [Fact] + [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] + public static void AddOID_NullNames_Throws() + { + AssertExtensions.Throws("names", () => CryptoConfig.AddOID(string.Empty, null)); + } + + [Fact] + [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] + public static void AddAlgorithm_CreateFromName_ReturnsMapped() + { + CryptoConfig.AddAlgorithm(typeof(AesCryptoServiceProvider), "AESFancy"); + Assert.Equal(typeof(AesCryptoServiceProvider).FullName, CryptoConfig.CreateFromName("AESFancy").GetType().FullName); + } + + [Fact] + [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] + public static void AddAlgorithm_NonVisibleType() + { + AssertExtensions.Throws("algorithm", () => CryptoConfig.AddAlgorithm(typeof(AESFancy), "AESFancy")); + } + + private class AESFancy + { + } + + [Fact] + [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] + public static void AddAlgorithm_EmptyString_Throws() + { + AssertExtensions.Throws(null, () => CryptoConfig.AddAlgorithm(typeof(CryptoConfigTests), string.Empty)); + } + + [Fact] + [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] + public static void AddAlgorithm_EmptyNamesArray() + { + CryptoConfig.AddAlgorithm(typeof(AesCryptoServiceProvider), new string[0]); + // There is no verifiable behavior in this case. We only check that we don't throw. + } + + [Fact] + [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] + public static void AddAlgorithm_NullAlgorithm_Throws() + { + AssertExtensions.Throws("algorithm", () => CryptoConfig.AddAlgorithm(null, string.Empty)); + } + + [Fact] + [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] + public static void AddAlgorithm_NullNames_Throws() + { + AssertExtensions.Throws("names", () => CryptoConfig.AddAlgorithm(typeof(CryptoConfigTests), null)); + } + + [Fact] + [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] + public static void StaticCreateMethods() + { + // Ensure static create methods exist and don't throw + + // Some do not have public concrete types (in Algorithms assembly) so in those cases we only check for null\failure. + VerifyStaticCreateResult(Aes.Create(typeof(AesManaged).FullName), typeof(AesManaged)); + Assert.Null(DES.Create(string.Empty)); + Assert.Null(DSA.Create(string.Empty)); + Assert.Null(ECDsa.Create(string.Empty)); + Assert.Null(MD5.Create(string.Empty)); + Assert.Null(RandomNumberGenerator.Create(string.Empty)); + Assert.Null(RC2.Create(string.Empty)); +#pragma warning disable SYSLIB0022 // Rijndael types are obsolete + VerifyStaticCreateResult(Rijndael.Create(typeof(RijndaelManaged).FullName), typeof(RijndaelManaged)); + Assert.Null(RSA.Create(string.Empty)); + Assert.Null(SHA1.Create(string.Empty)); + VerifyStaticCreateResult(SHA256.Create(typeof(SHA256Managed).FullName), typeof(SHA256Managed)); + VerifyStaticCreateResult(SHA384.Create(typeof(SHA384Managed).FullName), typeof(SHA384Managed)); + VerifyStaticCreateResult(SHA512.Create(typeof(SHA512Managed).FullName), typeof(SHA512Managed)); +#pragma warning restore SYSLIB0022 // Rijndael types are obsolete + } + + private static void VerifyStaticCreateResult(object obj, Type expectedType) + { + Assert.NotNull(obj); + Assert.IsType(expectedType, obj); + } + + [Fact] + [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] + public static void MapNameToOID() + { + Assert.Throws(() => CryptoConfig.MapNameToOID(null)); + + // Test some oids unique to CryptoConfig + Assert.Equal("1.3.14.3.2.26", CryptoConfig.MapNameToOID("SHA")); + Assert.Equal("1.3.14.3.2.26", CryptoConfig.MapNameToOID("sha")); + Assert.Equal("1.2.840.113549.3.7", CryptoConfig.MapNameToOID("TripleDES")); + + // Test fallback to Oid class + Assert.Equal("1.3.36.3.3.2.8.1.1.8", CryptoConfig.MapNameToOID("brainpoolP256t1")); + + // Invalid oid + Assert.Null(CryptoConfig.MapNameToOID("NOT_A_VALID_OID")); + } + + [Fact] + [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] + public static void CreateFromName_validation() + { + Assert.Throws(() => CryptoConfig.CreateFromName(null)); + Assert.Throws(() => CryptoConfig.CreateFromName(null, null)); + Assert.Throws(() => CryptoConfig.CreateFromName(null, string.Empty)); + Assert.Null(CryptoConfig.CreateFromName(string.Empty, null)); + Assert.Null(CryptoConfig.CreateFromName("SHA", 1, 2)); + } + + public static IEnumerable AllValidNames + { + get + { + if (PlatformDetection.IsBrowser) + { + // Hash functions + yield return new object[] { "SHA", typeof(SHA1Managed).FullName, true }; + yield return new object[] { "SHA1", typeof(SHA1Managed).FullName, true }; + yield return new object[] { "System.Security.Cryptography.SHA1", typeof(SHA1Managed).FullName, true }; + yield return new object[] { "SHA256", typeof(SHA256Managed).FullName, true }; + yield return new object[] { "SHA-256", typeof(SHA256Managed).FullName, true }; + yield return new object[] { "System.Security.Cryptography.SHA256", typeof(SHA256Managed).FullName, true }; + yield return new object[] { "SHA384", typeof(SHA384Managed).FullName, true }; + yield return new object[] { "SHA-384", typeof(SHA384Managed).FullName, true }; + yield return new object[] { "System.Security.Cryptography.SHA384", typeof(SHA384Managed).FullName, true }; + yield return new object[] { "SHA512", typeof(SHA512Managed).FullName, true }; + yield return new object[] { "SHA-512", typeof(SHA512Managed).FullName, true }; + yield return new object[] { "System.Security.Cryptography.SHA512", typeof(SHA512Managed).FullName, true }; + } + else + { + // Random number generator + yield return new object[] { "RandomNumberGenerator", "System.Security.Cryptography.RNGCryptoServiceProvider", true }; + yield return new object[] { "System.Security.Cryptography.RandomNumberGenerator", "System.Security.Cryptography.RNGCryptoServiceProvider", true }; + + // Hash functions + yield return new object[] { "SHA", "System.Security.Cryptography.SHA1CryptoServiceProvider", true }; + yield return new object[] { "SHA1", "System.Security.Cryptography.SHA1CryptoServiceProvider", true }; + yield return new object[] { "System.Security.Cryptography.SHA1", "System.Security.Cryptography.SHA1CryptoServiceProvider", true }; + yield return new object[] { "System.Security.Cryptography.HashAlgorithm", "System.Security.Cryptography.SHA1CryptoServiceProvider", true }; + yield return new object[] { "MD5", "System.Security.Cryptography.MD5CryptoServiceProvider", true }; + yield return new object[] { "System.Security.Cryptography.MD5", "System.Security.Cryptography.MD5CryptoServiceProvider", true }; + yield return new object[] { "SHA256", typeof(SHA256Managed).FullName, true }; + yield return new object[] { "SHA-256", typeof(SHA256Managed).FullName, true }; + yield return new object[] { "System.Security.Cryptography.SHA256", typeof(SHA256Managed).FullName, true }; + yield return new object[] { "SHA384", typeof(SHA384Managed).FullName, true }; + yield return new object[] { "SHA-384", typeof(SHA384Managed).FullName, true }; + yield return new object[] { "System.Security.Cryptography.SHA384", typeof(SHA384Managed).FullName, true }; + yield return new object[] { "SHA512", typeof(SHA512Managed).FullName, true }; + yield return new object[] { "SHA-512", typeof(SHA512Managed).FullName, true }; + yield return new object[] { "System.Security.Cryptography.SHA512", typeof(SHA512Managed).FullName, true }; + + // Keyed Hash Algorithms + yield return new object[] { "System.Security.Cryptography.HMAC", "System.Security.Cryptography.HMACSHA1", true }; + yield return new object[] { "System.Security.Cryptography.KeyedHashAlgorithm", "System.Security.Cryptography.HMACSHA1", true }; + yield return new object[] { "HMACMD5", "System.Security.Cryptography.HMACMD5", true }; + yield return new object[] { "System.Security.Cryptography.HMACMD5", null, true }; + yield return new object[] { "HMACSHA1", "System.Security.Cryptography.HMACSHA1", true }; + yield return new object[] { "System.Security.Cryptography.HMACSHA1", null, true }; + yield return new object[] { "HMACSHA256", "System.Security.Cryptography.HMACSHA256", true }; + yield return new object[] { "System.Security.Cryptography.HMACSHA256", null, true }; + yield return new object[] { "HMACSHA384", "System.Security.Cryptography.HMACSHA384", true }; + yield return new object[] { "System.Security.Cryptography.HMACSHA384", null, true }; + yield return new object[] { "HMACSHA512", "System.Security.Cryptography.HMACSHA512", true }; + yield return new object[] { "System.Security.Cryptography.HMACSHA512", null, true }; + + // Asymmetric algorithms + yield return new object[] { "RSA", "System.Security.Cryptography.RSACryptoServiceProvider", true }; + yield return new object[] { "System.Security.Cryptography.RSA", "System.Security.Cryptography.RSACryptoServiceProvider", true }; + yield return new object[] { "System.Security.Cryptography.AsymmetricAlgorithm", "System.Security.Cryptography.RSACryptoServiceProvider", true }; + if (!PlatformDetection.UsesMobileAppleCrypto) + { + yield return new object[] { "DSA", "System.Security.Cryptography.DSACryptoServiceProvider", true }; + yield return new object[] { "System.Security.Cryptography.DSA", "System.Security.Cryptography.DSACryptoServiceProvider", true }; + } + yield return new object[] { "ECDsa", "System.Security.Cryptography.ECDsaCng", true }; + yield return new object[] { "ECDsaCng", "System.Security.Cryptography.ECDsaCng", false }; + yield return new object[] { "System.Security.Cryptography.ECDsaCng", null, false }; + yield return new object[] { "DES", "System.Security.Cryptography.DESCryptoServiceProvider", true }; + yield return new object[] { "System.Security.Cryptography.DES", "System.Security.Cryptography.DESCryptoServiceProvider", true }; + yield return new object[] { "3DES", "System.Security.Cryptography.TripleDESCryptoServiceProvider", true }; + yield return new object[] { "TripleDES", "System.Security.Cryptography.TripleDESCryptoServiceProvider", true }; + yield return new object[] { "Triple DES", "System.Security.Cryptography.TripleDESCryptoServiceProvider", true }; + yield return new object[] { "System.Security.Cryptography.TripleDES", "System.Security.Cryptography.TripleDESCryptoServiceProvider", true }; + yield return new object[] { "RC2", "System.Security.Cryptography.RC2CryptoServiceProvider", true }; + yield return new object[] { "System.Security.Cryptography.RC2", "System.Security.Cryptography.RC2CryptoServiceProvider", true }; +#pragma warning disable SYSLIB0022 // Rijndael types are obsolete + yield return new object[] { "Rijndael", typeof(RijndaelManaged).FullName, true }; + yield return new object[] { "System.Security.Cryptography.Rijndael", typeof(RijndaelManaged).FullName, true }; + yield return new object[] { "System.Security.Cryptography.SymmetricAlgorithm", typeof(RijndaelManaged).FullName, true }; +#pragma warning restore SYSLIB0022 // Rijndael types are obsolete + yield return new object[] { "AES", "System.Security.Cryptography.AesCryptoServiceProvider", true }; + yield return new object[] { "AesCryptoServiceProvider", "System.Security.Cryptography.AesCryptoServiceProvider", true }; + yield return new object[] { "System.Security.Cryptography.AesCryptoServiceProvider", "System.Security.Cryptography.AesCryptoServiceProvider", true }; + yield return new object[] { "AesManaged", typeof(AesManaged).FullName, true }; + yield return new object[] { "System.Security.Cryptography.AesManaged", typeof(AesManaged).FullName, true }; + + // Xml Dsig/ Enc Hash algorithms + yield return new object[] { "http://www.w3.org/2000/09/xmldsig#sha1", "System.Security.Cryptography.SHA1CryptoServiceProvider", true }; + yield return new object[] { "http://www.w3.org/2001/04/xmlenc#sha256", typeof(SHA256Managed).FullName, true }; + yield return new object[] { "http://www.w3.org/2001/04/xmlenc#sha512", typeof(SHA512Managed).FullName, true }; + + // Xml Encryption symmetric keys + yield return new object[] { "http://www.w3.org/2001/04/xmlenc#des-cbc", "System.Security.Cryptography.DESCryptoServiceProvider", true }; + yield return new object[] { "http://www.w3.org/2001/04/xmlenc#tripledes-cbc", "System.Security.Cryptography.TripleDESCryptoServiceProvider", true }; + yield return new object[] { "http://www.w3.org/2001/04/xmlenc#kw-tripledes", "System.Security.Cryptography.TripleDESCryptoServiceProvider", true }; +#pragma warning disable SYSLIB0022 // Rijndael types are obsolete + yield return new object[] { "http://www.w3.org/2001/04/xmlenc#aes128-cbc", typeof(RijndaelManaged).FullName, true }; + yield return new object[] { "http://www.w3.org/2001/04/xmlenc#kw-aes128", typeof(RijndaelManaged).FullName, true }; + yield return new object[] { "http://www.w3.org/2001/04/xmlenc#aes192-cbc", typeof(RijndaelManaged).FullName, true }; + yield return new object[] { "http://www.w3.org/2001/04/xmlenc#kw-aes192", typeof(RijndaelManaged).FullName, true }; + yield return new object[] { "http://www.w3.org/2001/04/xmlenc#aes256-cbc", typeof(RijndaelManaged).FullName, true }; + yield return new object[] { "http://www.w3.org/2001/04/xmlenc#kw-aes256", typeof(RijndaelManaged).FullName, true }; +#pragma warning restore SYSLIB0022 // Rijndael types are obsolete + + // Xml Dsig HMAC URIs from http://www.w3.org/TR/xmldsig-core/ + yield return new object[] { "http://www.w3.org/2000/09/xmldsig#hmac-sha1", typeof(HMACSHA1).FullName, true }; + yield return new object[] { "http://www.w3.org/2001/04/xmldsig-more#sha384", typeof(SHA384Managed).FullName, true }; + yield return new object[] { "http://www.w3.org/2001/04/xmldsig-more#hmac-md5", typeof(HMACMD5).FullName, true }; + yield return new object[] { "http://www.w3.org/2001/04/xmldsig-more#hmac-sha256", typeof(HMACSHA256).FullName, true }; + yield return new object[] { "http://www.w3.org/2001/04/xmldsig-more#hmac-sha384", typeof(HMACSHA384).FullName, true }; + yield return new object[] { "http://www.w3.org/2001/04/xmldsig-more#hmac-sha512", typeof(HMACSHA512).FullName, true }; + + // X509 + yield return new object[] { "2.5.29.10", "System.Security.Cryptography.X509Certificates.X509BasicConstraintsExtension", true }; + yield return new object[] { "2.5.29.19", "System.Security.Cryptography.X509Certificates.X509BasicConstraintsExtension", true }; + yield return new object[] { "2.5.29.14", "System.Security.Cryptography.X509Certificates.X509SubjectKeyIdentifierExtension", true }; + yield return new object[] { "2.5.29.15", "System.Security.Cryptography.X509Certificates.X509KeyUsageExtension", true }; + yield return new object[] { "2.5.29.37", "System.Security.Cryptography.X509Certificates.X509EnhancedKeyUsageExtension", true }; + yield return new object[] { "X509Chain", "System.Security.Cryptography.X509Certificates.X509Chain", true }; + + // PKCS9 attributes + yield return new object[] { "1.2.840.113549.1.9.3", "System.Security.Cryptography.Pkcs.Pkcs9ContentType", true }; + yield return new object[] { "1.2.840.113549.1.9.4", "System.Security.Cryptography.Pkcs.Pkcs9MessageDigest", true }; + yield return new object[] { "1.2.840.113549.1.9.5", "System.Security.Cryptography.Pkcs.Pkcs9SigningTime", true }; + yield return new object[] { "1.3.6.1.4.1.311.88.2.1", "System.Security.Cryptography.Pkcs.Pkcs9DocumentName", true }; + yield return new object[] { "1.3.6.1.4.1.311.88.2.2", "System.Security.Cryptography.Pkcs.Pkcs9DocumentDescription", true }; + } + } + } + + [Theory, MemberData(nameof(AllValidNames))] + public static void CreateFromName_AllValidNames(string name, string typeName, bool supportsUnixMac) + { + bool isWindows = OperatingSystem.IsWindows(); + + if (supportsUnixMac || isWindows) + { + object obj = CryptoConfig.CreateFromName(name); + Assert.NotNull(obj); + + if (typeName == null) + { + typeName = name; + } + + // ECDsa is special on non-Windows + if (isWindows || name != "ECDsa") + { + Assert.Equal(typeName, obj.GetType().FullName); + } + else + { + Assert.NotEqual(typeName, obj.GetType().FullName); + } + + if (obj is IDisposable) + { + ((IDisposable)obj).Dispose(); + } + } + else + { + // These will be the Csp types, which currently aren't supported on Mac\Unix + Assert.Throws (() => CryptoConfig.CreateFromName(name)); + } + } + + [Fact] + [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] + public static void CreateFromName_CtorArguments() + { + string className = typeof(ClassWithCtorArguments).FullName + ", System.Security.Cryptography.Tests"; + + // Pass int instead of string + Assert.Throws(() => CryptoConfig.CreateFromName(className, 1)); + + // Valid case + object obj = CryptoConfig.CreateFromName(className, "Hello"); + Assert.NotNull(obj); + Assert.IsType(obj); + + ClassWithCtorArguments ctorObj = (ClassWithCtorArguments)obj; + Assert.Equal("Hello", ctorObj.MyString); + } + + [Fact] + [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] + public static void EncodeOID_Validation() + { +#pragma warning disable SYSLIB0031 // EncodeOID is obsolete + Assert.Throws(() => CryptoConfig.EncodeOID(null)); + Assert.Throws(() => CryptoConfig.EncodeOID(string.Empty)); + Assert.Throws(() => CryptoConfig.EncodeOID("BAD.OID")); + Assert.Throws(() => CryptoConfig.EncodeOID("1.2.BAD.OID")); + Assert.Throws(() => CryptoConfig.EncodeOID("1." + uint.MaxValue)); +#pragma warning restore SYSLIB0031 + } + + [Fact] + [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] + public static void EncodeOID_Compat() + { +#pragma warning disable SYSLIB0031 // EncodeOID is obsolete + string actual = CryptoConfig.EncodeOID("-1.2.-3").ByteArrayToHex(); + Assert.Equal("0602DAFD", actual); // Negative values not checked +#pragma warning restore SYSLIB0031 + } + + [Fact] + [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] + public static void EncodeOID_Length_Boundary() + { +#pragma warning disable SYSLIB0031 // EncodeOID is obsolete + string valueToRepeat = "1.1"; + + // Build a string like 1.11.11.11. ... .11.1, which has 0x80 separators. + // The BER/DER encoding of an OID has a minimum number of bytes as the number of separator characters, + // so this would produce an OID with a length segment of more than one byte, which EncodeOID can't handle. + string s = new StringBuilder(valueToRepeat.Length * 0x80).Insert(0, valueToRepeat, 0x80).ToString(); + Assert.Throws(() => CryptoConfig.EncodeOID(s)); + + // Try again with one less separator for the boundary case, but the particular output is really long + // and would just clutter up this test, so only verify it doesn't throw. + s = new StringBuilder(valueToRepeat.Length * 0x7f).Insert(0, valueToRepeat, 0x7f).ToString(); + CryptoConfig.EncodeOID(s); +#pragma warning restore SYSLIB0031 + } + + [Theory] + [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] + [InlineData(0x4000, "0603818028")] + [InlineData(0x200000, "060481808028")] + [InlineData(0x10000000, "06058180808028")] + [InlineData(0x10000001, "06058180808029")] + [InlineData(int.MaxValue, "060127")] + public static void EncodeOID_Value_Boundary_And_Compat(uint elementValue, string expectedEncoding) + { + // Boundary cases in EncodeOID; output may produce the wrong value mathematically due to encoding + // algorithm semantics but included here for compat reasons. +#pragma warning disable SYSLIB0031 // EncodeOID is obsolete + byte[] actual = CryptoConfig.EncodeOID("1." + elementValue.ToString()); + byte[] expected = expectedEncoding.HexToByteArray(); + Assert.Equal(expected, actual); +#pragma warning restore SYSLIB0031 + } + + [Theory] + [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] + [InlineData("SHA1", "1.3.14.3.2.26", "06052B0E03021A")] + [InlineData("DES", "1.3.14.3.2.7", "06052B0E030207")] + [InlineData("MD5", "1.2.840.113549.2.5", "06082A864886F70D0205")] + public static void MapAndEncodeOID(string alg, string expectedOid, string expectedEncoding) + { +#pragma warning disable SYSLIB0031 // EncodeOID is obsolete + string oid = CryptoConfig.MapNameToOID(alg); + Assert.Equal(expectedOid, oid); + + byte[] actual = CryptoConfig.EncodeOID(oid); + byte[] expected = expectedEncoding.HexToByteArray(); + Assert.Equal(expected, actual); +#pragma warning restore SYSLIB0031 + } + + private static void VerifyCreateFromName(string name) + { + object obj = CryptoConfig.CreateFromName(name); + Assert.NotNull(obj); + Assert.IsType(obj); + } + + public class ClassWithCtorArguments + { + public ClassWithCtorArguments(string s) + { + MyString = s; + } + + public string MyString; + } } } diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/DESProvider.cs b/src/libraries/System.Security.Cryptography/tests/DESProvider.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/DESProvider.cs rename to src/libraries/System.Security.Cryptography/tests/DESProvider.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/DESTests.cs b/src/libraries/System.Security.Cryptography/tests/DESTests.cs similarity index 98% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/DESTests.cs rename to src/libraries/System.Security.Cryptography/tests/DESTests.cs index 3c83deeb8d826b..edf123bfe78b0c 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/DESTests.cs +++ b/src/libraries/System.Security.Cryptography/tests/DESTests.cs @@ -3,7 +3,7 @@ using Xunit; -namespace System.Security.Cryptography.Encryption.Des.Tests +namespace System.Security.Cryptography.Tests { public static partial class DesTests { diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/DSACreateTests.cs b/src/libraries/System.Security.Cryptography/tests/DSACreateTests.cs similarity index 98% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/DSACreateTests.cs rename to src/libraries/System.Security.Cryptography/tests/DSACreateTests.cs index e84da84a446f8e..b69a62808148c4 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/DSACreateTests.cs +++ b/src/libraries/System.Security.Cryptography/tests/DSACreateTests.cs @@ -4,7 +4,7 @@ using System.Security.Cryptography.Dsa.Tests; using Xunit; -namespace System.Security.Cryptography.Algorithms.Tests +namespace System.Security.Cryptography.Tests { [SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst, "Not supported on Browser/iOS/tvOS/MacCatalyst")] public static class DSACreateTests diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/DSASignatureFormatterTests.cs b/src/libraries/System.Security.Cryptography/tests/DSASignatureFormatterTests.cs similarity index 86% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/DSASignatureFormatterTests.cs rename to src/libraries/System.Security.Cryptography/tests/DSASignatureFormatterTests.cs index 2af8aaabd7e2f8..666029cef3be89 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/DSASignatureFormatterTests.cs +++ b/src/libraries/System.Security.Cryptography/tests/DSASignatureFormatterTests.cs @@ -1,10 +1,9 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Security.Cryptography.Tests; using Xunit; -namespace System.Security.Cryptography.Dsa.Tests +namespace System.Security.Cryptography.Tests { public partial class DSASignatureFormatterTests : AsymmetricSignatureFormatterTests { diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/DSATests.cs b/src/libraries/System.Security.Cryptography/tests/DSATests.cs similarity index 99% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/DSATests.cs rename to src/libraries/System.Security.Cryptography/tests/DSATests.cs index 8b51d34c8b5633..66a25990bc2f86 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/DSATests.cs +++ b/src/libraries/System.Security.Cryptography/tests/DSATests.cs @@ -6,7 +6,7 @@ using System.Security.Cryptography.Dsa.Tests; using Xunit; -namespace System.Security.Cryptography.Algorithms.Tests +namespace System.Security.Cryptography.Tests { [SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst, "Not supported on Browser/iOS/tvOS/MacCatalyst")] public class DSATests diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/DefaultDSAProvider.cs b/src/libraries/System.Security.Cryptography/tests/DefaultDSAProvider.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/DefaultDSAProvider.cs rename to src/libraries/System.Security.Cryptography/tests/DefaultDSAProvider.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/DefaultECDiffieHellmanProvider.Android.cs b/src/libraries/System.Security.Cryptography/tests/DefaultECDiffieHellmanProvider.Android.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/DefaultECDiffieHellmanProvider.Android.cs rename to src/libraries/System.Security.Cryptography/tests/DefaultECDiffieHellmanProvider.Android.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/DefaultECDiffieHellmanProvider.Unix.cs b/src/libraries/System.Security.Cryptography/tests/DefaultECDiffieHellmanProvider.Unix.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/DefaultECDiffieHellmanProvider.Unix.cs rename to src/libraries/System.Security.Cryptography/tests/DefaultECDiffieHellmanProvider.Unix.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/DefaultECDiffieHellmanProvider.Windows.cs b/src/libraries/System.Security.Cryptography/tests/DefaultECDiffieHellmanProvider.Windows.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/DefaultECDiffieHellmanProvider.Windows.cs rename to src/libraries/System.Security.Cryptography/tests/DefaultECDiffieHellmanProvider.Windows.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/DefaultECDiffieHellmanProvider.cs b/src/libraries/System.Security.Cryptography/tests/DefaultECDiffieHellmanProvider.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/DefaultECDiffieHellmanProvider.cs rename to src/libraries/System.Security.Cryptography/tests/DefaultECDiffieHellmanProvider.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/DefaultECDsaProvider.Android.cs b/src/libraries/System.Security.Cryptography/tests/DefaultECDsaProvider.Android.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/DefaultECDsaProvider.Android.cs rename to src/libraries/System.Security.Cryptography/tests/DefaultECDsaProvider.Android.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/DefaultECDsaProvider.Unix.cs b/src/libraries/System.Security.Cryptography/tests/DefaultECDsaProvider.Unix.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/DefaultECDsaProvider.Unix.cs rename to src/libraries/System.Security.Cryptography/tests/DefaultECDsaProvider.Unix.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/DefaultECDsaProvider.Windows.cs b/src/libraries/System.Security.Cryptography/tests/DefaultECDsaProvider.Windows.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/DefaultECDsaProvider.Windows.cs rename to src/libraries/System.Security.Cryptography/tests/DefaultECDsaProvider.Windows.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/DefaultECDsaProvider.cs b/src/libraries/System.Security.Cryptography/tests/DefaultECDsaProvider.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/DefaultECDsaProvider.cs rename to src/libraries/System.Security.Cryptography/tests/DefaultECDsaProvider.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/DefaultRSAProvider.cs b/src/libraries/System.Security.Cryptography/tests/DefaultRSAProvider.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/DefaultRSAProvider.cs rename to src/libraries/System.Security.Cryptography/tests/DefaultRSAProvider.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/ECDiffieHellmanPublicKeyTests.cs b/src/libraries/System.Security.Cryptography/tests/ECDiffieHellmanPublicKeyTests.cs similarity index 94% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/ECDiffieHellmanPublicKeyTests.cs rename to src/libraries/System.Security.Cryptography/tests/ECDiffieHellmanPublicKeyTests.cs index 81c87279f0e3ba..addc21718f57d9 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/ECDiffieHellmanPublicKeyTests.cs +++ b/src/libraries/System.Security.Cryptography/tests/ECDiffieHellmanPublicKeyTests.cs @@ -3,7 +3,7 @@ using Xunit; -namespace System.Security.Cryptography.EcDiffieHellman.Tests +namespace System.Security.Cryptography.Tests { [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] public class ECDiffieHellmanPublicKeyTests diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/ECDiffieHellmanTests.cs b/src/libraries/System.Security.Cryptography/tests/ECDiffieHellmanTests.cs similarity index 91% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/ECDiffieHellmanTests.cs rename to src/libraries/System.Security.Cryptography/tests/ECDiffieHellmanTests.cs index b0c7d4540ede6c..809930bc68d89e 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/ECDiffieHellmanTests.cs +++ b/src/libraries/System.Security.Cryptography/tests/ECDiffieHellmanTests.cs @@ -1,15 +1,12 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Collections.Generic; -using System.Security.Cryptography; -using System.Security.Cryptography.Tests; -using System.Text; -using Test.Cryptography; +using System.Security.Cryptography.EcDiffieHellman.Tests; using Xunit; -namespace System.Security.Cryptography.EcDiffieHellman.Tests +namespace System.Security.Cryptography.Tests { + [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] public partial class ECDiffieHellmanTests { [Fact] diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/ECDsaTests.cs b/src/libraries/System.Security.Cryptography/tests/ECDsaTests.cs similarity index 99% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/ECDsaTests.cs rename to src/libraries/System.Security.Cryptography/tests/ECDsaTests.cs index 44bed901a6704c..0abd2570bd9548 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/ECDsaTests.cs +++ b/src/libraries/System.Security.Cryptography/tests/ECDsaTests.cs @@ -6,7 +6,7 @@ using System.Security.Cryptography.EcDsa.Tests; using Xunit; -namespace System.Security.Cryptography.Algorithms.Tests +namespace System.Security.Cryptography.Tests { [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] public class ECDsaTests diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/HKDFTests.cs b/src/libraries/System.Security.Cryptography/tests/HKDFTests.cs similarity index 99% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/HKDFTests.cs rename to src/libraries/System.Security.Cryptography/tests/HKDFTests.cs index 49d270f60b1fdb..e1d0d59423a0f2 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/HKDFTests.cs +++ b/src/libraries/System.Security.Cryptography/tests/HKDFTests.cs @@ -3,11 +3,10 @@ using System.Collections.Generic; using System.Linq; -using Microsoft.DotNet.XUnitExtensions; using Test.Cryptography; using Xunit; -namespace System.Security.Cryptography.Algorithms.Tests +namespace System.Security.Cryptography.Tests { [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] public abstract class HKDFTests diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/HashAlgorithmTest.cs b/src/libraries/System.Security.Cryptography/tests/HashAlgorithmTestDriver.cs similarity index 99% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/HashAlgorithmTest.cs rename to src/libraries/System.Security.Cryptography/tests/HashAlgorithmTestDriver.cs index dc5738441db564..07f72debe15862 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/HashAlgorithmTest.cs +++ b/src/libraries/System.Security.Cryptography/tests/HashAlgorithmTestDriver.cs @@ -6,9 +6,9 @@ using Test.Cryptography; using Xunit; -namespace System.Security.Cryptography.Hashing.Algorithms.Tests +namespace System.Security.Cryptography.Tests { - public abstract class HashAlgorithmTest + public abstract class HashAlgorithmTestDriver { protected abstract HashAlgorithm Create(); protected abstract bool TryHashData(ReadOnlySpan source, Span destination, out int bytesWritten); diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/HashDerivedTests.cs b/src/libraries/System.Security.Cryptography/tests/HashDerivedTests.cs similarity index 97% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/HashDerivedTests.cs rename to src/libraries/System.Security.Cryptography/tests/HashDerivedTests.cs index bbd011a7612f13..6734bca6bb5a53 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/HashDerivedTests.cs +++ b/src/libraries/System.Security.Cryptography/tests/HashDerivedTests.cs @@ -3,7 +3,7 @@ using Xunit; -namespace System.Security.Cryptography.Hashing.Algorithms.Tests +namespace System.Security.Cryptography.Tests { public static class HashDerivedTests { diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/HmacMD5Tests.cs b/src/libraries/System.Security.Cryptography/tests/HmacMD5Tests.cs similarity index 98% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/HmacMD5Tests.cs rename to src/libraries/System.Security.Cryptography/tests/HmacMD5Tests.cs index 0c6cb580d09da4..5890252e8dfa8a 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/HmacMD5Tests.cs +++ b/src/libraries/System.Security.Cryptography/tests/HmacMD5Tests.cs @@ -4,7 +4,7 @@ using Test.Cryptography; using Xunit; -namespace System.Security.Cryptography.Hashing.Algorithms.Tests +namespace System.Security.Cryptography.Tests { [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] public class HmacMD5Tests : Rfc2202HmacTests diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/HmacSha1Tests.cs b/src/libraries/System.Security.Cryptography/tests/HmacSha1Tests.cs similarity index 98% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/HmacSha1Tests.cs rename to src/libraries/System.Security.Cryptography/tests/HmacSha1Tests.cs index 83dbf48b1baa24..dadae08fea1886 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/HmacSha1Tests.cs +++ b/src/libraries/System.Security.Cryptography/tests/HmacSha1Tests.cs @@ -4,7 +4,7 @@ using Test.Cryptography; using Xunit; -namespace System.Security.Cryptography.Hashing.Algorithms.Tests +namespace System.Security.Cryptography.Tests { [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] public class HmacSha1Tests : Rfc2202HmacTests diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/HmacSha256Tests.cs b/src/libraries/System.Security.Cryptography/tests/HmacSha256Tests.cs similarity index 98% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/HmacSha256Tests.cs rename to src/libraries/System.Security.Cryptography/tests/HmacSha256Tests.cs index ae9004e12f5aff..303c248d5ee3de 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/HmacSha256Tests.cs +++ b/src/libraries/System.Security.Cryptography/tests/HmacSha256Tests.cs @@ -4,7 +4,7 @@ using Test.Cryptography; using Xunit; -namespace System.Security.Cryptography.Hashing.Algorithms.Tests +namespace System.Security.Cryptography.Tests { [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] public class HmacSha256Tests : Rfc4231HmacTests diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/HmacSha384Tests.cs b/src/libraries/System.Security.Cryptography/tests/HmacSha384Tests.cs similarity index 98% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/HmacSha384Tests.cs rename to src/libraries/System.Security.Cryptography/tests/HmacSha384Tests.cs index 53d0dece6d3b98..abaeab4dbc6fe1 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/HmacSha384Tests.cs +++ b/src/libraries/System.Security.Cryptography/tests/HmacSha384Tests.cs @@ -4,7 +4,7 @@ using Test.Cryptography; using Xunit; -namespace System.Security.Cryptography.Hashing.Algorithms.Tests +namespace System.Security.Cryptography.Tests { [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] public class HmacSha384Tests : Rfc4231HmacTests diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/HmacSha512Tests.cs b/src/libraries/System.Security.Cryptography/tests/HmacSha512Tests.cs similarity index 98% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/HmacSha512Tests.cs rename to src/libraries/System.Security.Cryptography/tests/HmacSha512Tests.cs index c9f52a982c0ddd..fa83bd45e2183c 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/HmacSha512Tests.cs +++ b/src/libraries/System.Security.Cryptography/tests/HmacSha512Tests.cs @@ -4,7 +4,7 @@ using Test.Cryptography; using Xunit; -namespace System.Security.Cryptography.Hashing.Algorithms.Tests +namespace System.Security.Cryptography.Tests { [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] public class HmacSha512Tests : Rfc4231HmacTests diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/HmacTests.cs b/src/libraries/System.Security.Cryptography/tests/HmacTests.cs similarity index 99% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/HmacTests.cs rename to src/libraries/System.Security.Cryptography/tests/HmacTests.cs index 510f58d88ee7d8..ca266b43921fe4 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/HmacTests.cs +++ b/src/libraries/System.Security.Cryptography/tests/HmacTests.cs @@ -5,7 +5,7 @@ using Test.Cryptography; using Xunit; -namespace System.Security.Cryptography.Hashing.Algorithms.Tests +namespace System.Security.Cryptography.Tests { [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] public abstract class HmacTests diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/IncrementalHashTests.cs b/src/libraries/System.Security.Cryptography/tests/IncrementalHashTests.cs similarity index 99% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/IncrementalHashTests.cs rename to src/libraries/System.Security.Cryptography/tests/IncrementalHashTests.cs index 2a0f551c279038..d5acc5b27aa435 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/IncrementalHashTests.cs +++ b/src/libraries/System.Security.Cryptography/tests/IncrementalHashTests.cs @@ -5,7 +5,7 @@ using Test.Cryptography; using Xunit; -namespace System.Security.Cryptography.Algorithms.Tests +namespace System.Security.Cryptography.Tests { public class IncrementalHashTests { diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/InvalidUsageTests.cs b/src/libraries/System.Security.Cryptography/tests/InvalidUsageTests.cs similarity index 98% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/InvalidUsageTests.cs rename to src/libraries/System.Security.Cryptography/tests/InvalidUsageTests.cs index 0adfe66cef73e7..4114d97167e952 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/InvalidUsageTests.cs +++ b/src/libraries/System.Security.Cryptography/tests/InvalidUsageTests.cs @@ -4,7 +4,7 @@ using System.IO; using Xunit; -namespace System.Security.Cryptography.Hashing.Algorithms.Tests +namespace System.Security.Cryptography.Tests { public class InvalidUsageTests { diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/MD5Tests.cs b/src/libraries/System.Security.Cryptography/tests/MD5Tests.cs similarity index 95% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/MD5Tests.cs rename to src/libraries/System.Security.Cryptography/tests/MD5Tests.cs index fb84183609dcca..e301eae2fc3001 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/MD5Tests.cs +++ b/src/libraries/System.Security.Cryptography/tests/MD5Tests.cs @@ -3,10 +3,10 @@ using Xunit; -namespace System.Security.Cryptography.Hashing.Algorithms.Tests +namespace System.Security.Cryptography.Tests { [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] - public class MD5Tests : HashAlgorithmTest + public class MD5Tests : HashAlgorithmTestDriver { protected override HashAlgorithm Create() { diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/PKCS1MaskGenerationMethodTest.cs b/src/libraries/System.Security.Cryptography/tests/PKCS1MaskGenerationMethodTest.cs similarity index 98% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/PKCS1MaskGenerationMethodTest.cs rename to src/libraries/System.Security.Cryptography/tests/PKCS1MaskGenerationMethodTest.cs index bc0d9b9a3669a2..c388dc8c110f3c 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/PKCS1MaskGenerationMethodTest.cs +++ b/src/libraries/System.Security.Cryptography/tests/PKCS1MaskGenerationMethodTest.cs @@ -23,11 +23,9 @@ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -using System; -using System.Security.Cryptography; using Xunit; -namespace System.Security.Cryptography.Algorithms.Tests +namespace System.Security.Cryptography.Tests { [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] public class PKCS1MaskGenerationMethodTest diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/PaddingModeTests.cs b/src/libraries/System.Security.Cryptography/tests/PaddingModeTests.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/PaddingModeTests.cs rename to src/libraries/System.Security.Cryptography/tests/PaddingModeTests.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/RC2Provider.cs b/src/libraries/System.Security.Cryptography/tests/RC2Provider.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/RC2Provider.cs rename to src/libraries/System.Security.Cryptography/tests/RC2Provider.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/RC2Tests.cs b/src/libraries/System.Security.Cryptography/tests/RC2Tests.cs similarity index 97% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/RC2Tests.cs rename to src/libraries/System.Security.Cryptography/tests/RC2Tests.cs index 008b3c9cea53fc..ab6f0ba2dc4114 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/RC2Tests.cs +++ b/src/libraries/System.Security.Cryptography/tests/RC2Tests.cs @@ -3,10 +3,8 @@ using Xunit; -namespace System.Security.Cryptography.Encryption.RC2.Tests +namespace System.Security.Cryptography.Tests { - using RC2 = System.Security.Cryptography.RC2; - public static partial class RC2Tests { [Fact] diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/RSACreateTests.cs b/src/libraries/System.Security.Cryptography/tests/RSACreateTests.cs similarity index 97% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/RSACreateTests.cs rename to src/libraries/System.Security.Cryptography/tests/RSACreateTests.cs index 6ccc7e6489c0c7..8847051e6998d9 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/RSACreateTests.cs +++ b/src/libraries/System.Security.Cryptography/tests/RSACreateTests.cs @@ -4,7 +4,7 @@ using System.Security.Cryptography.Rsa.Tests; using Xunit; -namespace System.Security.Cryptography.Algorithms.Tests +namespace System.Security.Cryptography.Tests { [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] public static class RSACreateTests diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/RSAKeyExchangeFormatterTests.cs b/src/libraries/System.Security.Cryptography/tests/RSAKeyExchangeFormatterTests.cs similarity index 90% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/RSAKeyExchangeFormatterTests.cs rename to src/libraries/System.Security.Cryptography/tests/RSAKeyExchangeFormatterTests.cs index 41f616fae0285a..f0a0bca594b43a 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/RSAKeyExchangeFormatterTests.cs +++ b/src/libraries/System.Security.Cryptography/tests/RSAKeyExchangeFormatterTests.cs @@ -3,7 +3,7 @@ using Xunit; -namespace System.Security.Cryptography.Rsa.Tests +namespace System.Security.Cryptography.Tests { public partial class RSAKeyExchangeFormatterTests { @@ -32,6 +32,7 @@ public static void RSAPKCS1DeformatterArguments() } [Fact] + [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] public static void RSAOAEPFormatterRng() { using (RSA key = RSA.Create()) @@ -44,6 +45,7 @@ public static void RSAOAEPFormatterRng() } [Fact] + [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] public static void RSAPKCS1FormatterRng() { using (RSA key = RSA.Create()) @@ -56,6 +58,7 @@ public static void RSAPKCS1FormatterRng() } [Fact] + [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] public static void RSAPKCS1DeformatterRng() { using (RSA key = RSA.Create()) diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/RSASignatureFormatterTests.cs b/src/libraries/System.Security.Cryptography/tests/RSASignatureFormatterTests.cs similarity index 86% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/RSASignatureFormatterTests.cs rename to src/libraries/System.Security.Cryptography/tests/RSASignatureFormatterTests.cs index d35e0c0fa87661..a6f0d4909344e7 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/RSASignatureFormatterTests.cs +++ b/src/libraries/System.Security.Cryptography/tests/RSASignatureFormatterTests.cs @@ -1,10 +1,9 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Security.Cryptography.Tests; using Xunit; -namespace System.Security.Cryptography.Rsa.Tests +namespace System.Security.Cryptography.Tests { public partial class RSASignatureFormatterTests : AsymmetricSignatureFormatterTests { diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/RSATests.cs b/src/libraries/System.Security.Cryptography/tests/RSATests.cs similarity index 99% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/RSATests.cs rename to src/libraries/System.Security.Cryptography/tests/RSATests.cs index 0e63e04b0859ad..27b3831c53b4c9 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/RSATests.cs +++ b/src/libraries/System.Security.Cryptography/tests/RSATests.cs @@ -5,7 +5,7 @@ using System.Linq; using Xunit; -namespace System.Security.Cryptography.Algorithms.Tests +namespace System.Security.Cryptography.Tests { [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] public class RSATests diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/RandomNumberGeneratorTests.cs b/src/libraries/System.Security.Cryptography/tests/RandomNumberGeneratorTests.cs similarity index 99% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/RandomNumberGeneratorTests.cs rename to src/libraries/System.Security.Cryptography/tests/RandomNumberGeneratorTests.cs index d0f2ad8e3e9ff5..1fbbe86e471d5b 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/RandomNumberGeneratorTests.cs +++ b/src/libraries/System.Security.Cryptography/tests/RandomNumberGeneratorTests.cs @@ -8,7 +8,7 @@ using System.Threading.Tasks; using Xunit; -namespace System.Security.Cryptography.RNG.Tests +namespace System.Security.Cryptography.Tests { public class RandomNumberGeneratorTests { diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/ReusabilityTests.cs b/src/libraries/System.Security.Cryptography/tests/ReusabilityTests.cs similarity index 95% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/ReusabilityTests.cs rename to src/libraries/System.Security.Cryptography/tests/ReusabilityTests.cs index a9909edd133fcf..998890765df40a 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/ReusabilityTests.cs +++ b/src/libraries/System.Security.Cryptography/tests/ReusabilityTests.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using Xunit; -namespace System.Security.Cryptography.Hashing.Algorithms.Tests +namespace System.Security.Cryptography.Tests { [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] public class ReusabilityTests diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/Rfc2202HmacTests.cs b/src/libraries/System.Security.Cryptography/tests/Rfc2202HmacTests.cs similarity index 95% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/Rfc2202HmacTests.cs rename to src/libraries/System.Security.Cryptography/tests/Rfc2202HmacTests.cs index 84864861c92d9f..892d1d9748d286 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/Rfc2202HmacTests.cs +++ b/src/libraries/System.Security.Cryptography/tests/Rfc2202HmacTests.cs @@ -4,7 +4,7 @@ using Test.Cryptography; using Xunit; -namespace System.Security.Cryptography.Hashing.Algorithms.Tests +namespace System.Security.Cryptography.Tests { [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] public abstract class Rfc2202HmacTests : HmacTests diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/Rfc2898OneShotTests.cs b/src/libraries/System.Security.Cryptography/tests/Rfc2898OneShotTests.cs similarity index 99% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/Rfc2898OneShotTests.cs rename to src/libraries/System.Security.Cryptography/tests/Rfc2898OneShotTests.cs index eb634e112f240a..3376d711779bf2 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/Rfc2898OneShotTests.cs +++ b/src/libraries/System.Security.Cryptography/tests/Rfc2898OneShotTests.cs @@ -6,7 +6,7 @@ using Xunit; using Test.Cryptography; -namespace System.Security.Cryptography.DeriveBytesTests +namespace System.Security.Cryptography { [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] public static class Rfc2898OneShotTests diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/Rfc2898Tests.cs b/src/libraries/System.Security.Cryptography/tests/Rfc2898Tests.cs similarity index 99% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/Rfc2898Tests.cs rename to src/libraries/System.Security.Cryptography/tests/Rfc2898Tests.cs index 85b273ba28e8c3..fa7cfabca93260 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/Rfc2898Tests.cs +++ b/src/libraries/System.Security.Cryptography/tests/Rfc2898Tests.cs @@ -7,7 +7,7 @@ using Test.Cryptography; using Xunit; -namespace System.Security.Cryptography.DeriveBytesTests +namespace System.Security.Cryptography { [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] public class Rfc2898Tests diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/Rfc4231HmacTests.cs b/src/libraries/System.Security.Cryptography/tests/Rfc4231HmacTests.cs similarity index 96% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/Rfc4231HmacTests.cs rename to src/libraries/System.Security.Cryptography/tests/Rfc4231HmacTests.cs index 771973a029328f..45070c834eed2e 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/Rfc4231HmacTests.cs +++ b/src/libraries/System.Security.Cryptography/tests/Rfc4231HmacTests.cs @@ -4,7 +4,7 @@ using Test.Cryptography; using Xunit; -namespace System.Security.Cryptography.Hashing.Algorithms.Tests +namespace System.Security.Cryptography.Tests { [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] public abstract class Rfc4231HmacTests : HmacTests diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/RijndaelTests.cs b/src/libraries/System.Security.Cryptography/tests/RijndaelTests.cs similarity index 99% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/RijndaelTests.cs rename to src/libraries/System.Security.Cryptography/tests/RijndaelTests.cs index 5613b7b7c48d6e..d8e9f975cae498 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/RijndaelTests.cs +++ b/src/libraries/System.Security.Cryptography/tests/RijndaelTests.cs @@ -7,10 +7,8 @@ #pragma warning disable SYSLIB0022 // Rijndael types are obsolete -namespace System.Security.Cryptography.Encryption.Rijndael.Tests +namespace System.Security.Cryptography.Tests { - using Rijndael = System.Security.Cryptography.Rijndael; - /// /// Since RijndaelImplementation (from Rijndael.Create()) and RijndaelManaged classes wrap Aes, /// we only test minimally here. diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/Sha1ManagedTests.cs b/src/libraries/System.Security.Cryptography/tests/Sha1ManagedTests.cs similarity index 86% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/Sha1ManagedTests.cs rename to src/libraries/System.Security.Cryptography/tests/Sha1ManagedTests.cs index 5139841dcf8294..54e7476f544719 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/Sha1ManagedTests.cs +++ b/src/libraries/System.Security.Cryptography/tests/Sha1ManagedTests.cs @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -namespace System.Security.Cryptography.Hashing.Algorithms.Tests +namespace System.Security.Cryptography.Tests { /// /// Sha1Managed has a copy of the same implementation as SHA1 diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/Sha1Tests.cs b/src/libraries/System.Security.Cryptography/tests/Sha1Tests.cs similarity index 94% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/Sha1Tests.cs rename to src/libraries/System.Security.Cryptography/tests/Sha1Tests.cs index 646d2dbb798018..45d0315852cbe5 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/Sha1Tests.cs +++ b/src/libraries/System.Security.Cryptography/tests/Sha1Tests.cs @@ -3,9 +3,9 @@ using Xunit; -namespace System.Security.Cryptography.Hashing.Algorithms.Tests +namespace System.Security.Cryptography.Tests { - public class Sha1Tests : HashAlgorithmTest + public class Sha1Tests : HashAlgorithmTestDriver { protected override HashAlgorithm Create() { diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/Sha256ManagedTests.cs b/src/libraries/System.Security.Cryptography/tests/Sha256ManagedTests.cs similarity index 86% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/Sha256ManagedTests.cs rename to src/libraries/System.Security.Cryptography/tests/Sha256ManagedTests.cs index b1a0422272e86b..2f153da87a60ff 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/Sha256ManagedTests.cs +++ b/src/libraries/System.Security.Cryptography/tests/Sha256ManagedTests.cs @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -namespace System.Security.Cryptography.Hashing.Algorithms.Tests +namespace System.Security.Cryptography.Tests { /// /// Sha256Managed has a copy of the same implementation as SHA256 diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/Sha256Tests.cs b/src/libraries/System.Security.Cryptography/tests/Sha256Tests.cs similarity index 95% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/Sha256Tests.cs rename to src/libraries/System.Security.Cryptography/tests/Sha256Tests.cs index c53a7e83f299ed..e85dddc08d7971 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/Sha256Tests.cs +++ b/src/libraries/System.Security.Cryptography/tests/Sha256Tests.cs @@ -3,9 +3,9 @@ using Xunit; -namespace System.Security.Cryptography.Hashing.Algorithms.Tests +namespace System.Security.Cryptography.Tests { - public class Sha256Tests : HashAlgorithmTest + public class Sha256Tests : HashAlgorithmTestDriver { protected override HashAlgorithm Create() { diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/Sha384ManagedTests.cs b/src/libraries/System.Security.Cryptography/tests/Sha384ManagedTests.cs similarity index 86% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/Sha384ManagedTests.cs rename to src/libraries/System.Security.Cryptography/tests/Sha384ManagedTests.cs index 42b13c63cd122e..88166dbf0496a5 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/Sha384ManagedTests.cs +++ b/src/libraries/System.Security.Cryptography/tests/Sha384ManagedTests.cs @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -namespace System.Security.Cryptography.Hashing.Algorithms.Tests +namespace System.Security.Cryptography.Tests { /// /// Sha384Managed has a copy of the same implementation as SHA384 diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/Sha384Tests.cs b/src/libraries/System.Security.Cryptography/tests/Sha384Tests.cs similarity index 95% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/Sha384Tests.cs rename to src/libraries/System.Security.Cryptography/tests/Sha384Tests.cs index a0beb5d5faf1bc..5ef3ebcb4e039e 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/Sha384Tests.cs +++ b/src/libraries/System.Security.Cryptography/tests/Sha384Tests.cs @@ -3,9 +3,9 @@ using Xunit; -namespace System.Security.Cryptography.Hashing.Algorithms.Tests +namespace System.Security.Cryptography.Tests { - public class Sha384Tests : HashAlgorithmTest + public class Sha384Tests : HashAlgorithmTestDriver { protected override HashAlgorithm Create() { diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/Sha512ManagedTests.cs b/src/libraries/System.Security.Cryptography/tests/Sha512ManagedTests.cs similarity index 86% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/Sha512ManagedTests.cs rename to src/libraries/System.Security.Cryptography/tests/Sha512ManagedTests.cs index b3fae310692c06..e616e4fea13e00 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/Sha512ManagedTests.cs +++ b/src/libraries/System.Security.Cryptography/tests/Sha512ManagedTests.cs @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -namespace System.Security.Cryptography.Hashing.Algorithms.Tests +namespace System.Security.Cryptography.Tests { /// /// Sha512Managed has a copy of the same implementation as SHA512 diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/Sha512Tests.cs b/src/libraries/System.Security.Cryptography/tests/Sha512Tests.cs similarity index 95% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/Sha512Tests.cs rename to src/libraries/System.Security.Cryptography/tests/Sha512Tests.cs index ef1d02fc818f7e..4586a08d846b07 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/Sha512Tests.cs +++ b/src/libraries/System.Security.Cryptography/tests/Sha512Tests.cs @@ -3,9 +3,9 @@ using Xunit; -namespace System.Security.Cryptography.Hashing.Algorithms.Tests +namespace System.Security.Cryptography.Tests { - public class Sha512Tests : HashAlgorithmTest + public class Sha512Tests : HashAlgorithmTestDriver { protected override HashAlgorithm Create() { diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/SignatureDescriptionTests.cs b/src/libraries/System.Security.Cryptography/tests/SignatureDescriptionTests.cs similarity index 99% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/SignatureDescriptionTests.cs rename to src/libraries/System.Security.Cryptography/tests/SignatureDescriptionTests.cs index 257d5abde8f333..2d222ea5f92a69 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/SignatureDescriptionTests.cs +++ b/src/libraries/System.Security.Cryptography/tests/SignatureDescriptionTests.cs @@ -6,7 +6,7 @@ using Xunit; -namespace System.Security.Cryptography.Algorithms.Tests +namespace System.Security.Cryptography.Tests { [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] public class SignatureDescriptionTests diff --git a/src/libraries/System.Security.Cryptography/tests/System.Security.Cryptography.Tests.csproj b/src/libraries/System.Security.Cryptography/tests/System.Security.Cryptography.Tests.csproj index fce17560950c60..7b7211285d8478 100644 --- a/src/libraries/System.Security.Cryptography/tests/System.Security.Cryptography.Tests.csproj +++ b/src/libraries/System.Security.Cryptography/tests/System.Security.Cryptography.Tests.csproj @@ -1,54 +1,296 @@ - $(NetCoreAppCurrent) + $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Android;$(NetCoreAppCurrent)-Browser true + $(NoWarn);SYSLIB0021 + true + true - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/TrimmingTests/RSAXmlTest.cs b/src/libraries/System.Security.Cryptography/tests/TrimmingTests/RSAXmlTest.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/TrimmingTests/RSAXmlTest.cs rename to src/libraries/System.Security.Cryptography/tests/TrimmingTests/RSAXmlTest.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/TrimmingTests/System.Security.Cryptography.Algorithms.TrimmingTests.proj b/src/libraries/System.Security.Cryptography/tests/TrimmingTests/System.Security.Cryptography.TrimmingTests.proj similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/TrimmingTests/System.Security.Cryptography.Algorithms.TrimmingTests.proj rename to src/libraries/System.Security.Cryptography/tests/TrimmingTests/System.Security.Cryptography.TrimmingTests.proj diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/TripleDesProvider.cs b/src/libraries/System.Security.Cryptography/tests/TripleDesProvider.cs similarity index 100% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/TripleDesProvider.cs rename to src/libraries/System.Security.Cryptography/tests/TripleDesProvider.cs diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/TripleDesTests.cs b/src/libraries/System.Security.Cryptography/tests/TripleDesTests.cs similarity index 99% rename from src/libraries/System.Security.Cryptography.Algorithms/tests/TripleDesTests.cs rename to src/libraries/System.Security.Cryptography/tests/TripleDesTests.cs index 0a7b2b8e854e1e..64b9c402a5da85 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/TripleDesTests.cs +++ b/src/libraries/System.Security.Cryptography/tests/TripleDesTests.cs @@ -7,7 +7,7 @@ using Test.Cryptography; using Xunit; -namespace System.Security.Cryptography.Encryption.TripleDes.Tests +namespace System.Security.Cryptography.Tests { [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] public static partial class TripleDesTests diff --git a/src/libraries/shims/ApiCompatBaseline.PreviousNetCoreApp.txt b/src/libraries/shims/ApiCompatBaseline.PreviousNetCoreApp.txt index aaf4b8a58aed46..32beb555e41775 100644 --- a/src/libraries/shims/ApiCompatBaseline.PreviousNetCoreApp.txt +++ b/src/libraries/shims/ApiCompatBaseline.PreviousNetCoreApp.txt @@ -37,7 +37,31 @@ CannotChangeAttribute : Attribute 'System.Diagnostics.CodeAnalysis.DynamicallyAc CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.SupportedOSPlatformAttribute' exists on 'System.Runtime.InteropServices.Marshal.AddRef(System.IntPtr)' in the contract but not the implementation. CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.SupportedOSPlatformAttribute' exists on 'System.Runtime.InteropServices.Marshal.QueryInterface(System.IntPtr, System.Guid, System.IntPtr)' in the contract but not the implementation. CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.SupportedOSPlatformAttribute' exists on 'System.Runtime.InteropServices.Marshal.Release(System.IntPtr)' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.Aes' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.AsymmetricKeyExchangeDeformatter' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.AsymmetricKeyExchangeFormatter' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.AsymmetricSignatureDeformatter' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.AsymmetricSignatureFormatter' in the contract but not the implementation. CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.CryptoConfig' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.DeriveBytes' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.DES' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.DSA' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.DSASignatureDeformatter' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.DSASignatureFormatter' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.MaskGenerationMethod' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.PKCS1MaskGenerationMethod' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.RandomNumberGenerator.Create(System.String)' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.RC2' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.Rijndael' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.RSA' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.RSAEncryptionPadding' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.RSAOAEPKeyExchangeDeformatter' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.RSAOAEPKeyExchangeFormatter' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.RSAPKCS1KeyExchangeDeformatter' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.RSAPKCS1KeyExchangeFormatter' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.RSASignaturePadding' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.SignatureDescription' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.TripleDES' in the contract but not the implementation. Compat issues with assembly netstandard: CannotChangeAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' on 'System.Console.Beep()' changed from '[UnsupportedOSPlatformAttribute("browser")]' in the contract to '[UnsupportedOSPlatformAttribute("android")]' in the implementation. CannotChangeAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' on 'System.Console.BufferHeight.get()' changed from '[UnsupportedOSPlatformAttribute("browser")]' in the contract to '[UnsupportedOSPlatformAttribute("android")]' in the implementation. @@ -75,6 +99,19 @@ CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatfo CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Net.HttpListenerResponse.Abort()' in the contract but not the implementation. CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Net.HttpListenerResponse.Close()' in the contract but not the implementation. CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Net.HttpListenerResponse.Close(System.Byte[], System.Boolean)' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector.CopyTo(System.Span)' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector.CopyTo(System.Span)' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector.CopyTo(T[])' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector.CopyTo(T[], System.Int32)' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector.Equals(System.Numerics.Vector)' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector.Equals(System.Object)' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector.GetHashCode()' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector.Item.get(System.Int32)' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector.ToString()' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector.ToString(System.String)' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector.ToString(System.String, System.IFormatProvider)' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector.TryCopyTo(System.Span)' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector.TryCopyTo(System.Span)' in the contract but not the implementation. CannotChangeAttribute : Attribute 'System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute' on 'System.Reflection.IReflect.GetMember(System.String, System.Reflection.BindingFlags)' changed from '[DynamicallyAccessedMembersAttribute(DynamicallyAccessedMemberTypes.All)]' in the contract to '[DynamicallyAccessedMembersAttribute(DynamicallyAccessedMemberTypes.NonPublicConstructors | DynamicallyAccessedMemberTypes.NonPublicEvents | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.NonPublicMethods | DynamicallyAccessedMemberTypes.NonPublicNestedTypes | DynamicallyAccessedMemberTypes.NonPublicProperties | DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.PublicEvents | DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.PublicNestedTypes | DynamicallyAccessedMemberTypes.PublicProperties)]' in the implementation. CannotChangeAttribute : Attribute 'System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute' on 'System.Reflection.IReflect.GetMembers(System.Reflection.BindingFlags)' changed from '[DynamicallyAccessedMembersAttribute(DynamicallyAccessedMemberTypes.All)]' in the contract to '[DynamicallyAccessedMembersAttribute(DynamicallyAccessedMemberTypes.NonPublicConstructors | DynamicallyAccessedMemberTypes.NonPublicEvents | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.NonPublicMethods | DynamicallyAccessedMemberTypes.NonPublicNestedTypes | DynamicallyAccessedMemberTypes.NonPublicProperties | DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.PublicEvents | DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.PublicNestedTypes | DynamicallyAccessedMemberTypes.PublicProperties)]' in the implementation. CannotChangeAttribute : Attribute 'System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute' on 'System.Reflection.TypeDelegator.GetMember(System.String, System.Reflection.MemberTypes, System.Reflection.BindingFlags)' changed from '[DynamicallyAccessedMembersAttribute(DynamicallyAccessedMemberTypes.All)]' in the contract to '[DynamicallyAccessedMembersAttribute(DynamicallyAccessedMemberTypes.NonPublicConstructors | DynamicallyAccessedMemberTypes.NonPublicEvents | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.NonPublicMethods | DynamicallyAccessedMemberTypes.NonPublicNestedTypes | DynamicallyAccessedMemberTypes.NonPublicProperties | DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.PublicEvents | DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.PublicNestedTypes | DynamicallyAccessedMemberTypes.PublicProperties)]' in the implementation. @@ -89,9 +126,37 @@ CannotChangeAttribute : Attribute 'System.AttributeUsageAttribute' on 'System.Ru CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.SupportedOSPlatformAttribute' exists on 'System.Runtime.InteropServices.Marshal.AddRef(System.IntPtr)' in the contract but not the implementation. CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.SupportedOSPlatformAttribute' exists on 'System.Runtime.InteropServices.Marshal.QueryInterface(System.IntPtr, System.Guid, System.IntPtr)' in the contract but not the implementation. CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.SupportedOSPlatformAttribute' exists on 'System.Runtime.InteropServices.Marshal.Release(System.IntPtr)' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.Aes' in the contract but not the implementation. CannotChangeAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' on 'System.Security.Cryptography.AesCcm' changed from '[UnsupportedOSPlatformAttribute("browser")]' in the contract to '[UnsupportedOSPlatformAttribute("browser")]' in the implementation. CannotChangeAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' on 'System.Security.Cryptography.AesGcm' changed from '[UnsupportedOSPlatformAttribute("browser")]' in the contract to '[UnsupportedOSPlatformAttribute("browser")]' in the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.AsymmetricKeyExchangeDeformatter' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.AsymmetricKeyExchangeFormatter' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.AsymmetricSignatureDeformatter' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.AsymmetricSignatureFormatter' in the contract but not the implementation. CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.CryptoConfig' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.DeriveBytes' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.DES' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.DSA' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.DSASignatureDeformatter' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.DSASignatureFormatter' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.ECCurve' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.ECDiffieHellman' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.ECDsa' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.ECParameters' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.MaskGenerationMethod' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.PKCS1MaskGenerationMethod' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.RandomNumberGenerator.Create(System.String)' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.RC2' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.Rijndael' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.RSA' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.RSAEncryptionPadding' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.RSAOAEPKeyExchangeDeformatter' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.RSAOAEPKeyExchangeFormatter' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.RSAPKCS1KeyExchangeDeformatter' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.RSAPKCS1KeyExchangeFormatter' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.RSASignaturePadding' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.SignatureDescription' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.TripleDES' in the contract but not the implementation. Compat issues with assembly System: CannotChangeAttribute : Attribute 'System.ComponentModel.DesignerAttribute' on 'System.ComponentModel.IComponent' changed from '[DesignerAttribute("System.ComponentModel.Design.ComponentDesigner, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]' in the contract to '[DesignerAttribute("System.ComponentModel.Design.ComponentDesigner, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]' in the implementation. CannotRemoveAttribute : Attribute 'System.ComponentModel.DesignerAttribute' exists on 'System.ComponentModel.MarshalByValueComponent' in the contract but not the implementation. @@ -129,6 +194,12 @@ CannotChangeAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatfo CannotChangeAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' on 'System.Console.Title.set(System.String)' changed from '[UnsupportedOSPlatformAttribute("browser")]' in the contract to '[UnsupportedOSPlatformAttribute("android")]' in the implementation. CannotChangeAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' on 'System.Console.WindowHeight.get()' changed from '[UnsupportedOSPlatformAttribute("browser")]' in the contract to '[UnsupportedOSPlatformAttribute("android")]' in the implementation. CannotChangeAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' on 'System.Console.WindowWidth.get()' changed from '[UnsupportedOSPlatformAttribute("browser")]' in the contract to '[UnsupportedOSPlatformAttribute("android")]' in the implementation. +Compat issues with assembly System.Core: +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.Aes' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.ECCurve' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.ECDiffieHellman' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.ECDsa' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.ECParameters' in the contract but not the implementation. Compat issues with assembly System.Diagnostics.Process: CannotChangeAttribute : Attribute 'System.Runtime.Versioning.SupportedOSPlatformAttribute' on 'System.Diagnostics.Process.MaxWorkingSet.set(System.IntPtr)' changed from '[SupportedOSPlatformAttribute("windows")]' in the contract to '[SupportedOSPlatformAttribute("freebsd")]' in the implementation. CannotChangeAttribute : Attribute 'System.Runtime.Versioning.SupportedOSPlatformAttribute' on 'System.Diagnostics.Process.MinWorkingSet.set(System.IntPtr)' changed from '[SupportedOSPlatformAttribute("windows")]' in the contract to '[SupportedOSPlatformAttribute("freebsd")]' in the implementation. @@ -141,6 +212,20 @@ CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatfo CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Net.HttpListenerResponse.Close(System.Byte[], System.Boolean)' in the contract but not the implementation. Compat issues with assembly System.Net.Primitives: CannotRemoveAttribute : Attribute 'System.Diagnostics.CodeAnalysis.AllowNullAttribute' exists on parameter 'value' on member 'System.Net.Cookie.Name.set(System.String)' in the contract but not the implementation. +Compat issues with assembly System.Numerics.Vectors: +CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector.CopyTo(System.Span)' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector.CopyTo(System.Span)' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector.CopyTo(T[])' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector.CopyTo(T[], System.Int32)' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector.Equals(System.Numerics.Vector)' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector.Equals(System.Object)' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector.GetHashCode()' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector.Item.get(System.Int32)' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector.ToString()' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector.ToString(System.String)' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector.ToString(System.String, System.IFormatProvider)' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector.TryCopyTo(System.Span)' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector.TryCopyTo(System.Span)' in the contract but not the implementation. Compat issues with assembly System.Reflection.Emit: CannotChangeAttribute : Attribute 'System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute' on 'System.Reflection.Emit.EnumBuilder.GetMember(System.String, System.Reflection.MemberTypes, System.Reflection.BindingFlags)' changed from '[DynamicallyAccessedMembersAttribute(DynamicallyAccessedMemberTypes.All)]' in the contract to '[DynamicallyAccessedMembersAttribute(DynamicallyAccessedMemberTypes.NonPublicConstructors | DynamicallyAccessedMemberTypes.NonPublicEvents | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.NonPublicMethods | DynamicallyAccessedMemberTypes.NonPublicNestedTypes | DynamicallyAccessedMemberTypes.NonPublicProperties | DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.PublicEvents | DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.PublicNestedTypes | DynamicallyAccessedMemberTypes.PublicProperties)]' in the implementation. CannotChangeAttribute : Attribute 'System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute' on 'System.Reflection.Emit.EnumBuilder.GetMembers(System.Reflection.BindingFlags)' changed from '[DynamicallyAccessedMembersAttribute(DynamicallyAccessedMemberTypes.All)]' in the contract to '[DynamicallyAccessedMembersAttribute(DynamicallyAccessedMemberTypes.NonPublicConstructors | DynamicallyAccessedMemberTypes.NonPublicEvents | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.NonPublicMethods | DynamicallyAccessedMemberTypes.NonPublicNestedTypes | DynamicallyAccessedMemberTypes.NonPublicProperties | DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.PublicEvents | DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.PublicNestedTypes | DynamicallyAccessedMemberTypes.PublicProperties)]' in the implementation. @@ -170,10 +255,42 @@ CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.SupportedOSPlatform CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.SupportedOSPlatformAttribute' exists on 'System.Runtime.InteropServices.Marshal.AddRef(System.IntPtr)' in the contract but not the implementation. CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.SupportedOSPlatformAttribute' exists on 'System.Runtime.InteropServices.Marshal.QueryInterface(System.IntPtr, System.Guid, System.IntPtr)' in the contract but not the implementation. CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.SupportedOSPlatformAttribute' exists on 'System.Runtime.InteropServices.Marshal.Release(System.IntPtr)' in the contract but not the implementation. +Compat issues with assembly System.Runtime.Intrinsics: +MembersMustExist : Member 'public System.Runtime.Intrinsics.Vector128 System.Runtime.Intrinsics.Vector128.As(System.Runtime.Intrinsics.Vector128)' does not exist in the implementation but it does exist in the contract. +MembersMustExist : Member 'public System.Runtime.Intrinsics.Vector256 System.Runtime.Intrinsics.Vector256.As(System.Runtime.Intrinsics.Vector256)' does not exist in the implementation but it does exist in the contract. +MembersMustExist : Member 'public System.Runtime.Intrinsics.Vector64 System.Runtime.Intrinsics.Vector64.As(System.Runtime.Intrinsics.Vector64)' does not exist in the implementation but it does exist in the contract. Compat issues with assembly System.Security.Cryptography.Algorithms: +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.Aes' in the contract but not the implementation. CannotChangeAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' on 'System.Security.Cryptography.AesCcm' changed from '[UnsupportedOSPlatformAttribute("browser")]' in the contract to '[UnsupportedOSPlatformAttribute("browser")]' in the implementation. CannotChangeAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' on 'System.Security.Cryptography.AesGcm' changed from '[UnsupportedOSPlatformAttribute("browser")]' in the contract to '[UnsupportedOSPlatformAttribute("browser")]' in the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.AsymmetricKeyExchangeDeformatter' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.AsymmetricKeyExchangeFormatter' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.AsymmetricSignatureDeformatter' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.AsymmetricSignatureFormatter' in the contract but not the implementation. CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.CryptoConfig' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.DeriveBytes' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.DES' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.DSA' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.DSASignatureDeformatter' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.DSASignatureFormatter' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.ECCurve' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.ECDiffieHellman' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.ECDsa' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.ECParameters' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.MaskGenerationMethod' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.PKCS1MaskGenerationMethod' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.RandomNumberGenerator.Create(System.String)' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.RC2' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.Rijndael' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.RSA' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.RSAEncryptionPadding' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.RSAOAEPKeyExchangeDeformatter' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.RSAOAEPKeyExchangeFormatter' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.RSAPKCS1KeyExchangeDeformatter' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.RSAPKCS1KeyExchangeFormatter' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.RSASignaturePadding' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.SignatureDescription' in the contract but not the implementation. +CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Security.Cryptography.TripleDES' in the contract but not the implementation. Compat issues with assembly System.Text.Json: CannotRemoveAttribute : Attribute 'System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute' exists on parameter 'returnType' on member 'System.Text.Json.JsonSerializer.Deserialize(System.ReadOnlySpan, System.Type, System.Text.Json.JsonSerializerOptions)' in the contract but not the implementation. CannotRemoveAttribute : Attribute 'System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute' exists on parameter 'returnType' on member 'System.Text.Json.JsonSerializer.Deserialize(System.String, System.Type, System.Text.Json.JsonSerializerOptions)' in the contract but not the implementation. @@ -186,37 +303,4 @@ CannotRemoveAttribute : Attribute 'System.Diagnostics.CodeAnalysis.DynamicallyAc CannotChangeAttribute : Attribute 'System.AttributeUsageAttribute' on 'System.Text.Json.Serialization.JsonConverterAttribute' changed from '[AttributeUsageAttribute(AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Struct, AllowMultiple=false)]' in the contract to '[AttributeUsageAttribute(AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Field | AttributeTargets.Interface | AttributeTargets.Property | AttributeTargets.Struct, AllowMultiple=false)]' in the implementation. Compat issues with assembly System.Threading.Tasks.Extensions: CannotChangeAttribute : Attribute 'System.AttributeUsageAttribute' on 'System.Runtime.CompilerServices.AsyncMethodBuilderAttribute' changed from '[AttributeUsageAttribute(AttributeTargets.Class | AttributeTargets.Delegate | AttributeTargets.Enum | AttributeTargets.Interface | AttributeTargets.Struct, Inherited=false, AllowMultiple=false)]' in the contract to '[AttributeUsageAttribute(AttributeTargets.Class | AttributeTargets.Delegate | AttributeTargets.Enum | AttributeTargets.Interface | AttributeTargets.Method | AttributeTargets.Struct, Inherited=false, AllowMultiple=false)]' in the implementation. -CannotChangeAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' on 'System.Security.Cryptography.AesCcm' changed from '[UnsupportedOSPlatformAttribute("browser")]' in the contract to '[UnsupportedOSPlatformAttribute("browser")]' in the implementation. -CannotChangeAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' on 'System.Security.Cryptography.AesGcm' changed from '[UnsupportedOSPlatformAttribute("browser")]' in the contract to '[UnsupportedOSPlatformAttribute("browser")]' in the implementation. -CannotChangeAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' on 'System.Security.Cryptography.AesCcm' changed from '[UnsupportedOSPlatformAttribute("browser")]' in the contract to '[UnsupportedOSPlatformAttribute("browser")]' in the implementation. -CannotChangeAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' on 'System.Security.Cryptography.AesGcm' changed from '[UnsupportedOSPlatformAttribute("browser")]' in the contract to '[UnsupportedOSPlatformAttribute("browser")]' in the implementation. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector.CopyTo(System.Span)' in the contract but not the implementation. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector.CopyTo(System.Span)' in the contract but not the implementation. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector.CopyTo(T[])' in the contract but not the implementation. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector.CopyTo(T[], System.Int32)' in the contract but not the implementation. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector.Equals(System.Numerics.Vector)' in the contract but not the implementation. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector.Equals(System.Object)' in the contract but not the implementation. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector.GetHashCode()' in the contract but not the implementation. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector.Item.get(System.Int32)' in the contract but not the implementation. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector.ToString()' in the contract but not the implementation. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector.ToString(System.String)' in the contract but not the implementation. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector.ToString(System.String, System.IFormatProvider)' in the contract but not the implementation. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector.TryCopyTo(System.Span)' in the contract but not the implementation. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector.TryCopyTo(System.Span)' in the contract but not the implementation. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector.CopyTo(System.Span)' in the contract but not the implementation. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector.CopyTo(System.Span)' in the contract but not the implementation. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector.CopyTo(T[])' in the contract but not the implementation. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector.CopyTo(T[], System.Int32)' in the contract but not the implementation. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector.Equals(System.Numerics.Vector)' in the contract but not the implementation. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector.Equals(System.Object)' in the contract but not the implementation. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector.GetHashCode()' in the contract but not the implementation. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector.Item.get(System.Int32)' in the contract but not the implementation. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector.ToString()' in the contract but not the implementation. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector.ToString(System.String)' in the contract but not the implementation. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector.ToString(System.String, System.IFormatProvider)' in the contract but not the implementation. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector.TryCopyTo(System.Span)' in the contract but not the implementation. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector.TryCopyTo(System.Span)' in the contract but not the implementation. -MembersMustExist : Member 'public System.Runtime.Intrinsics.Vector128 System.Runtime.Intrinsics.Vector128.As(System.Runtime.Intrinsics.Vector128)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'public System.Runtime.Intrinsics.Vector256 System.Runtime.Intrinsics.Vector256.As(System.Runtime.Intrinsics.Vector256)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'public System.Runtime.Intrinsics.Vector64 System.Runtime.Intrinsics.Vector64.As(System.Runtime.Intrinsics.Vector64)' does not exist in the implementation but it does exist in the contract. -Total Issues: 195 +Total Issues: 286