diff --git a/src/libraries/System.Security.Cryptography.Algorithms/Directory.Build.props b/src/libraries/System.Security.Cryptography.Algorithms/Directory.Build.props
index 63f02a0f817ef..d68d22c1b917f 100644
--- a/src/libraries/System.Security.Cryptography.Algorithms/Directory.Build.props
+++ b/src/libraries/System.Security.Cryptography.Algorithms/Directory.Build.props
@@ -2,5 +2,6 @@
Microsoft
+ true
\ No newline at end of file
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
index caa58cf6bc0b0..e5b2651a5d6be 100644
--- 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
@@ -6,12 +6,14 @@
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; }
public static new System.Security.Cryptography.Aes? Create(string algorithmName) { throw null; }
}
+ [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public sealed partial class AesCcm : System.IDisposable
{
public AesCcm(byte[] key) { }
@@ -24,6 +26,7 @@ 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")]
public sealed partial class AesGcm : System.IDisposable
{
public AesGcm(byte[] key) { }
@@ -37,6 +40,7 @@ public void Encrypt(byte[] nonce, byte[] plaintext, byte[] ciphertext, byte[] ta
public void Encrypt(System.ReadOnlySpan nonce, System.ReadOnlySpan plaintext, System.Span ciphertext, System.Span tag, System.ReadOnlySpan associatedData = default(System.ReadOnlySpan)) { }
}
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public sealed partial class AesManaged : System.Security.Cryptography.Aes
{
public AesManaged() { }
@@ -57,6 +61,7 @@ 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() { }
@@ -64,6 +69,7 @@ protected AsymmetricKeyExchangeDeformatter() { }
public abstract byte[] DecryptKeyExchange(byte[] rgb);
public abstract void SetKey(System.Security.Cryptography.AsymmetricAlgorithm key);
}
+ [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public abstract partial class AsymmetricKeyExchangeFormatter
{
protected AsymmetricKeyExchangeFormatter() { }
@@ -72,6 +78,7 @@ protected AsymmetricKeyExchangeFormatter() { }
public abstract byte[] CreateKeyExchange(byte[] data, System.Type? symAlgType);
public abstract void SetKey(System.Security.Cryptography.AsymmetricAlgorithm key);
}
+ [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public abstract partial class AsymmetricSignatureDeformatter
{
protected AsymmetricSignatureDeformatter() { }
@@ -80,6 +87,7 @@ protected AsymmetricSignatureDeformatter() { }
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() { }
@@ -88,6 +96,7 @@ protected AsymmetricSignatureFormatter() { }
public abstract void SetHashAlgorithm(string strName);
public abstract void SetKey(System.Security.Cryptography.AsymmetricAlgorithm key);
}
+ [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public partial class CryptoConfig
{
public CryptoConfig() { }
@@ -101,6 +110,7 @@ public static void AddOID(string oid, params string[] names) { }
public static byte[] EncodeOID(string str) { throw null; }
public static string? MapNameToOID(string name) { throw null; }
}
+ [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public abstract partial class DeriveBytes : System.IDisposable
{
protected DeriveBytes() { }
@@ -110,6 +120,7 @@ protected virtual void Dispose(bool disposing) { }
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() { }
@@ -119,6 +130,7 @@ protected DES() { }
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() { }
@@ -189,6 +201,7 @@ public partial struct DSAParameters
public byte[]? X;
public byte[]? Y;
}
+ [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public partial class DSASignatureDeformatter : System.Security.Cryptography.AsymmetricSignatureDeformatter
{
public DSASignatureDeformatter() { }
@@ -202,6 +215,7 @@ public enum DSASignatureFormat
IeeeP1363FixedFieldConcatenation = 0,
Rfc3279DerSequence = 1,
}
+ [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public partial class DSASignatureFormatter : System.Security.Cryptography.AsymmetricSignatureFormatter
{
public DSASignatureFormatter() { }
@@ -210,6 +224,7 @@ public DSASignatureFormatter(System.Security.Cryptography.AsymmetricAlgorithm ke
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;
@@ -263,6 +278,7 @@ public static partial class NamedCurves
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() { }
@@ -311,6 +327,7 @@ protected virtual void Dispose(bool disposing) { }
public virtual byte[] ToByteArray() { throw null; }
public virtual string ToXmlString() { throw null; }
}
+ [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public abstract partial class ECDsa : System.Security.Cryptography.AsymmetricAlgorithm
{
protected ECDsa() { }
@@ -377,6 +394,7 @@ public virtual void ImportParameters(System.Security.Cryptography.ECParameters p
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;
@@ -389,6 +407,7 @@ 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; }
@@ -398,6 +417,7 @@ public static void Expand(System.Security.Cryptography.HashAlgorithmName hashAlg
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() { }
@@ -410,6 +430,7 @@ 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 HMACSHA1 : System.Security.Cryptography.HMAC
{
public HMACSHA1() { }
@@ -424,6 +445,7 @@ 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 HMACSHA256 : System.Security.Cryptography.HMAC
{
public HMACSHA256() { }
@@ -436,6 +458,7 @@ 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 HMACSHA384 : System.Security.Cryptography.HMAC
{
public HMACSHA384() { }
@@ -449,6 +472,7 @@ 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 HMACSHA512 : System.Security.Cryptography.HMAC
{
public HMACSHA512() { }
@@ -471,7 +495,9 @@ 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; }
@@ -481,11 +507,13 @@ public void Dispose() { }
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() { }
@@ -496,6 +524,7 @@ protected MD5() { }
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
{
public PKCS1MaskGenerationMethod() { }
@@ -506,6 +535,7 @@ public abstract partial class RandomNumberGenerator : System.IDisposable
{
protected RandomNumberGenerator() { }
public static System.Security.Cryptography.RandomNumberGenerator Create() { throw null; }
+ [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) { }
@@ -519,6 +549,7 @@ 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;
@@ -528,6 +559,7 @@ protected RC2() { }
public static new System.Security.Cryptography.RC2 Create() { throw null; }
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) { }
@@ -547,6 +579,7 @@ protected override void Dispose(bool disposing) { }
public override void Reset() { }
}
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public abstract partial class Rijndael : System.Security.Cryptography.SymmetricAlgorithm
{
protected Rijndael() { }
@@ -554,6 +587,7 @@ protected Rijndael() { }
public static new System.Security.Cryptography.Rijndael? Create(string algName) { throw null; }
}
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public sealed partial class RijndaelManaged : System.Security.Cryptography.Rijndael
{
public RijndaelManaged() { }
@@ -572,6 +606,7 @@ 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() { }
@@ -624,6 +659,7 @@ public override void ImportFromPem(System.ReadOnlySpan input) { }
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() { }
@@ -647,6 +683,7 @@ public enum RSAEncryptionPaddingMode
Pkcs1 = 0,
Oaep = 1,
}
+ [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public partial class RSAOAEPKeyExchangeDeformatter : System.Security.Cryptography.AsymmetricKeyExchangeDeformatter
{
public RSAOAEPKeyExchangeDeformatter() { }
@@ -655,6 +692,7 @@ public RSAOAEPKeyExchangeDeformatter(System.Security.Cryptography.AsymmetricAlgo
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() { }
@@ -677,6 +715,7 @@ public partial struct RSAParameters
public byte[]? P;
public byte[]? Q;
}
+ [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public partial class RSAPKCS1KeyExchangeDeformatter : System.Security.Cryptography.AsymmetricKeyExchangeDeformatter
{
public RSAPKCS1KeyExchangeDeformatter() { }
@@ -686,6 +725,7 @@ public RSAPKCS1KeyExchangeDeformatter(System.Security.Cryptography.AsymmetricAlg
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() { }
@@ -696,6 +736,7 @@ public RSAPKCS1KeyExchangeFormatter(System.Security.Cryptography.AsymmetricAlgor
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() { }
@@ -704,6 +745,7 @@ 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() { }
@@ -712,6 +754,7 @@ public RSAPKCS1SignatureFormatter(System.Security.Cryptography.AsymmetricAlgorit
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() { }
@@ -814,6 +857,7 @@ protected sealed override void HashCore(System.ReadOnlySpan source) { }
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() { }
@@ -826,6 +870,7 @@ public SignatureDescription(System.Security.SecurityElement el) { }
public virtual System.Security.Cryptography.HashAlgorithm? CreateDigest() { throw null; }
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() { }
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
index 4e34ea903904b..48bb26d7cd2c6 100644
--- a/src/libraries/System.Security.Cryptography.Algorithms/src/ExcludeApiList.PNSE.Browser.txt
+++ b/src/libraries/System.Security.Cryptography.Algorithms/src/ExcludeApiList.PNSE.Browser.txt
@@ -1,6 +1,5 @@
T:System.Security.Cryptography.RandomNumberGenerator
T:System.Security.Cryptography.IncrementalHash
-T:System.Security.Cryptography.MD5
T:System.Security.Cryptography.SHA1
T:System.Security.Cryptography.SHA256
T:System.Security.Cryptography.SHA384
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 5fa08189319c7..d70d7393479bc 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
@@ -595,7 +595,6 @@
-
diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/Aes.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/Aes.cs
index d384b55b5dc0e..09a84f3b568fd 100644
--- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/Aes.cs
+++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/Aes.cs
@@ -1,10 +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.Runtime.Versioning;
using Internal.Cryptography;
namespace System.Security.Cryptography
{
+ [UnsupportedOSPlatform("browser")]
public abstract class Aes : SymmetricAlgorithm
{
protected Aes()
diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AesCcm.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AesCcm.cs
index 385a7a2eaa1c4..1e1f32adc8746 100644
--- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AesCcm.cs
+++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AesCcm.cs
@@ -1,10 +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.Runtime.Versioning;
using Internal.Cryptography;
namespace System.Security.Cryptography
{
+ [UnsupportedOSPlatform("browser")]
public sealed partial class AesCcm : IDisposable
{
public static KeySizes NonceByteSizes { get; } = new KeySizes(7, 13, 1);
diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AesGcm.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AesGcm.cs
index e870cd58841c0..07bbb6daa0eb3 100644
--- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AesGcm.cs
+++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AesGcm.cs
@@ -1,10 +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.Runtime.Versioning;
using Internal.Cryptography;
namespace System.Security.Cryptography
{
+ [UnsupportedOSPlatform("browser")]
public sealed partial class AesGcm : IDisposable
{
private const int NonceSize = 12;
diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AesManaged.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AesManaged.cs
index 21295fd4e3513..8501efa52a253 100644
--- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AesManaged.cs
+++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AesManaged.cs
@@ -2,9 +2,11 @@
// The .NET Foundation licenses this file to you under the MIT license.
using System.ComponentModel;
+using System.Runtime.Versioning;
namespace System.Security.Cryptography
{
+ [UnsupportedOSPlatform("browser")]
[EditorBrowsable(EditorBrowsableState.Never)]
public sealed class AesManaged : Aes
{
diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AsymmetricKeyExchangeDeformatter.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AsymmetricKeyExchangeDeformatter.cs
index 21836c6d9ce24..5065ae0a7c5df 100644
--- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AsymmetricKeyExchangeDeformatter.cs
+++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AsymmetricKeyExchangeDeformatter.cs
@@ -1,8 +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.Runtime.Versioning;
+
namespace System.Security.Cryptography
{
+ [UnsupportedOSPlatform("browser")]
public abstract class AsymmetricKeyExchangeDeformatter
{
protected AsymmetricKeyExchangeDeformatter() { }
diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AsymmetricKeyExchangeFormatter.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AsymmetricKeyExchangeFormatter.cs
index 73750b20bfbce..8d883bc5aee80 100644
--- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AsymmetricKeyExchangeFormatter.cs
+++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AsymmetricKeyExchangeFormatter.cs
@@ -1,8 +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.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.Algorithms/src/System/Security/Cryptography/AsymmetricSignatureDeformatter.cs
index a5985c4a57eca..1783303ea8d52 100644
--- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AsymmetricSignatureDeformatter.cs
+++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AsymmetricSignatureDeformatter.cs
@@ -2,10 +2,12 @@
// 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.Algorithms/src/System/Security/Cryptography/AsymmetricSignatureFormatter.cs
index c2cec2146800d..95d0a92c763e3 100644
--- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AsymmetricSignatureFormatter.cs
+++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AsymmetricSignatureFormatter.cs
@@ -2,10 +2,12 @@
// 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/CryptoConfig.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/CryptoConfig.cs
index a1aea6e932dd9..10ada27158268 100644
--- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/CryptoConfig.cs
+++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/CryptoConfig.cs
@@ -8,9 +8,11 @@
using System.Globalization;
using System.Reflection;
using System.Runtime.InteropServices;
+using System.Runtime.Versioning;
namespace System.Security.Cryptography
{
+ [UnsupportedOSPlatform("browser")]
public class CryptoConfig
{
private const string AssemblyName_Cng = "System.Security.Cryptography.Cng";
diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DES.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DES.cs
index fef95f07764de..e9383f6ba4f5d 100644
--- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DES.cs
+++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DES.cs
@@ -1,12 +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 Internal.Cryptography;
-using System.ComponentModel;
using System.Buffers.Binary;
+using System.ComponentModel;
+using System.Runtime.Versioning;
+using Internal.Cryptography;
namespace System.Security.Cryptography
{
+ [UnsupportedOSPlatform("browser")]
[EditorBrowsable(EditorBrowsableState.Never)]
public abstract class DES : SymmetricAlgorithm
{
diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSA.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSA.cs
index a087087afd0f5..e4fccad9ec08d 100644
--- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSA.cs
+++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSA.cs
@@ -5,11 +5,13 @@
using System.Diagnostics;
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).
diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSASignatureDeformatter.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSASignatureDeformatter.cs
index b42a93e04cf8d..b2fb1ee1da41b 100644
--- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSASignatureDeformatter.cs
+++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSASignatureDeformatter.cs
@@ -1,10 +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.Runtime.Versioning;
using Internal.Cryptography;
namespace System.Security.Cryptography
{
+ [UnsupportedOSPlatform("browser")]
public class DSASignatureDeformatter : AsymmetricSignatureDeformatter
{
private DSA? _dsaKey;
diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSASignatureFormatter.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSASignatureFormatter.cs
index 7c5754834605d..f6f5bf3f4283a 100644
--- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSASignatureFormatter.cs
+++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSASignatureFormatter.cs
@@ -1,10 +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.Runtime.Versioning;
using Internal.Cryptography;
namespace System.Security.Cryptography
{
+ [UnsupportedOSPlatform("browser")]
public class DSASignatureFormatter : AsymmetricSignatureFormatter
{
private DSA? _dsaKey;
diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DeriveBytes.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DeriveBytes.cs
index a75a250f32ecf..f1036945dc5e8 100644
--- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DeriveBytes.cs
+++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DeriveBytes.cs
@@ -1,8 +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.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/System/Security/Cryptography/ECCurve.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECCurve.cs
index 201afacc0085a..11de2e1cfd62a 100644
--- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECCurve.cs
+++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECCurve.cs
@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
using System.Diagnostics;
+using System.Runtime.Versioning;
namespace System.Security.Cryptography
{
@@ -13,6 +14,7 @@ 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.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDiffieHellman.cs
index c3fc14eab67ae..de14abd8089bf 100644
--- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDiffieHellman.cs
+++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDiffieHellman.cs
@@ -2,14 +2,16 @@
// The .NET Foundation licenses this file to you under the MIT license.
using System.Formats.Asn1;
-using Internal.Cryptography;
+using System.Runtime.Versioning;
using System.Security.Cryptography.Asn1;
+using Internal.Cryptography;
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 =
diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDsa.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDsa.cs
index df537c5f34515..2ca1f5c288e2f 100644
--- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDsa.cs
+++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDsa.cs
@@ -6,10 +6,12 @@
using System.Diagnostics;
using System.Formats.Asn1;
using System.IO;
+using System.Runtime.Versioning;
using System.Security.Cryptography.Asn1;
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
diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECParameters.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECParameters.cs
index 9534a1e3f281a..5aec01dd373ec 100644
--- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECParameters.cs
+++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECParameters.cs
@@ -3,6 +3,7 @@
using System.Buffers;
using System.Runtime.InteropServices;
+using System.Runtime.Versioning;
using System.Security.Cryptography.Asn1;
namespace System.Security.Cryptography
@@ -10,6 +11,7 @@ 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/HKDF.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HKDF.cs
index ecc10c635d810..0a6335c2ce623 100644
--- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HKDF.cs
+++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HKDF.cs
@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
using System.Diagnostics;
+using System.Runtime.Versioning;
namespace System.Security.Cryptography
{
@@ -13,6 +14,7 @@ namespace System.Security.Cryptography
/// phase to be skipped, and the master key to be used directly as the pseudorandom key.
/// See RFC5869 for more information.
///
+ [UnsupportedOSPlatform("browser")]
public static class HKDF
{
///
diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HMACMD5.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HMACMD5.cs
index 88ed7177d41df..e99f90d401970 100644
--- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HMACMD5.cs
+++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HMACMD5.cs
@@ -1,6 +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.Runtime.Versioning;
using Internal.Cryptography;
namespace System.Security.Cryptography
@@ -10,6 +11,7 @@ namespace System.Security.Cryptography
// preexisting contract from the .NET Framework locks all of these into deriving directly from HMAC, it can't be helped.
//
+ [UnsupportedOSPlatform("browser")]
public class HMACMD5 : HMAC
{
public HMACMD5()
diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HMACSHA1.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HMACSHA1.cs
index 21f62f2b213b5..756b49094c631 100644
--- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HMACSHA1.cs
+++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HMACSHA1.cs
@@ -3,6 +3,7 @@
using Internal.Cryptography;
using System.ComponentModel;
+using System.Runtime.Versioning;
namespace System.Security.Cryptography
{
@@ -11,6 +12,7 @@ namespace System.Security.Cryptography
// preexisting contract from the .NET Framework locks all of these into deriving directly from HMAC, it can't be helped.
//
+ [UnsupportedOSPlatform("browser")]
public class HMACSHA1 : HMAC
{
public HMACSHA1()
diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HMACSHA256.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HMACSHA256.cs
index b90d9d1937980..d65a3759038ab 100644
--- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HMACSHA256.cs
+++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HMACSHA256.cs
@@ -3,8 +3,8 @@
using System;
using System.Diagnostics;
+using System.Runtime.Versioning;
using System.Security.Cryptography;
-
using Internal.Cryptography;
namespace System.Security.Cryptography
@@ -14,6 +14,7 @@ namespace System.Security.Cryptography
// preexisting contract from the .NET Framework locks all of these into deriving directly from HMAC, it can't be helped.
//
+ [UnsupportedOSPlatform("browser")]
public class HMACSHA256 : HMAC
{
public HMACSHA256()
diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HMACSHA384.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HMACSHA384.cs
index 7ca4d75601efe..56bf4b81ad727 100644
--- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HMACSHA384.cs
+++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HMACSHA384.cs
@@ -3,8 +3,8 @@
using System;
using System.Diagnostics;
+using System.Runtime.Versioning;
using System.Security.Cryptography;
-
using Internal.Cryptography;
namespace System.Security.Cryptography
@@ -14,6 +14,7 @@ namespace System.Security.Cryptography
// preexisting contract from the .NET Framework locks all of these into deriving directly from HMAC, it can't be helped.
//
+ [UnsupportedOSPlatform("browser")]
public class HMACSHA384 : HMAC
{
public HMACSHA384()
diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HMACSHA512.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HMACSHA512.cs
index 0ad28bb0053a2..f03d31d21a75d 100644
--- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HMACSHA512.cs
+++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HMACSHA512.cs
@@ -3,8 +3,8 @@
using System;
using System.Diagnostics;
+using System.Runtime.Versioning;
using System.Security.Cryptography;
-
using Internal.Cryptography;
namespace System.Security.Cryptography
@@ -14,6 +14,7 @@ namespace System.Security.Cryptography
// preexisting contract from the .NET Framework locks all of these into deriving directly from HMAC, it can't be helped.
//
+ [UnsupportedOSPlatform("browser")]
public class HMACSHA512 : HMAC
{
public HMACSHA512()
diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/IncrementalHash.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/IncrementalHash.cs
index acf433ef75b15..55d4ee2f8294d 100644
--- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/IncrementalHash.cs
+++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/IncrementalHash.cs
@@ -1,8 +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.Diagnostics;
using Internal.Cryptography;
+using System.Diagnostics;
+using System.Runtime.Versioning;
namespace System.Security.Cryptography
{
@@ -346,6 +347,7 @@ public static IncrementalHash CreateHash(HashAlgorithmName hashAlgorithm)
/// the empty string.
///
/// is not a known hash algorithm.
+ [UnsupportedOSPlatform("browser")]
public static IncrementalHash CreateHMAC(HashAlgorithmName hashAlgorithm, byte[] key)
{
if (key == null)
@@ -376,6 +378,7 @@ public static IncrementalHash CreateHMAC(HashAlgorithmName hashAlgorithm, byte[]
/// the empty string.
///
/// is not a known hash algorithm.
+ [UnsupportedOSPlatform("browser")]
public static IncrementalHash CreateHMAC(HashAlgorithmName hashAlgorithm, ReadOnlySpan key)
{
if (string.IsNullOrEmpty(hashAlgorithm.Name))
diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/MD5.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/MD5.cs
index 09254f92e30f8..c9623eb1b4ec4 100644
--- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/MD5.cs
+++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/MD5.cs
@@ -1,8 +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 Internal.Cryptography;
using System.Diagnostics;
+using System.Runtime.Versioning;
+using Internal.Cryptography;
namespace System.Security.Cryptography
{
@@ -12,6 +13,7 @@ namespace System.Security.Cryptography
// it can't be helped.
//
+ [UnsupportedOSPlatform("browser")]
public abstract class MD5 : HashAlgorithm
{
private const int HashSizeBits = 128;
diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/MaskGenerationMethod.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/MaskGenerationMethod.cs
index 701fb6c06a79d..d737a491fc692 100644
--- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/MaskGenerationMethod.cs
+++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/MaskGenerationMethod.cs
@@ -1,8 +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.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/System/Security/Cryptography/PKCS1MaskGenerationMethod.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/PKCS1MaskGenerationMethod.cs
index 4e24f7eae2cfc..376a039d7901e 100644
--- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/PKCS1MaskGenerationMethod.cs
+++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/PKCS1MaskGenerationMethod.cs
@@ -3,10 +3,12 @@
using System.Buffers.Binary;
using System.Diagnostics;
+using System.Runtime.Versioning;
using Internal.Cryptography;
namespace System.Security.Cryptography
{
+ [UnsupportedOSPlatform("browser")]
public class PKCS1MaskGenerationMethod : MaskGenerationMethod
{
private string _hashNameValue;
diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RC2.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RC2.cs
index 0cf5acfcb897a..826836e7be695 100644
--- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RC2.cs
+++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RC2.cs
@@ -1,12 +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 Internal.Cryptography;
using System.ComponentModel;
+using System.Runtime.Versioning;
+using Internal.Cryptography;
namespace System.Security.Cryptography
{
[EditorBrowsable(EditorBrowsableState.Never)]
+ [UnsupportedOSPlatform("browser")]
public abstract class RC2 : SymmetricAlgorithm
{
protected int EffectiveKeySizeValue;
diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSA.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSA.cs
index 52b12eca81011..d488b01600321 100644
--- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSA.cs
+++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSA.cs
@@ -5,11 +5,13 @@
using System.Formats.Asn1;
using System.IO;
using System.Runtime.InteropServices;
+using System.Runtime.Versioning;
using System.Security.Cryptography.Asn1;
using Internal.Cryptography;
namespace System.Security.Cryptography
{
+ [UnsupportedOSPlatform("browser")]
public abstract partial class RSA : AsymmetricAlgorithm
{
public static new RSA? Create(string algName)
diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAEncryptionPadding.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAEncryptionPadding.cs
index a2b653383503b..3b796281f5090 100644
--- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAEncryptionPadding.cs
+++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAEncryptionPadding.cs
@@ -1,11 +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.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/RSAOAEPKeyExchangeDeformatter.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAOAEPKeyExchangeDeformatter.cs
index 152f85999b142..0c2b3ba17ddae 100644
--- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAOAEPKeyExchangeDeformatter.cs
+++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAOAEPKeyExchangeDeformatter.cs
@@ -1,8 +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.Runtime.Versioning;
+
namespace System.Security.Cryptography
{
+ [UnsupportedOSPlatform("browser")]
public class RSAOAEPKeyExchangeDeformatter : AsymmetricKeyExchangeDeformatter
{
private RSA? _rsaKey;
diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAOAEPKeyExchangeFormatter.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAOAEPKeyExchangeFormatter.cs
index e44ac9ef3129a..e6eceeaca7086 100644
--- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAOAEPKeyExchangeFormatter.cs
+++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAOAEPKeyExchangeFormatter.cs
@@ -1,8 +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.Runtime.Versioning;
+
namespace System.Security.Cryptography
{
+ [UnsupportedOSPlatform("browser")]
public class RSAOAEPKeyExchangeFormatter : AsymmetricKeyExchangeFormatter
{
private byte[]? ParameterValue;
diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAPKCS1KeyExchangeDeformatter.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAPKCS1KeyExchangeDeformatter.cs
index 0e65d54b28e7e..8270bcb7427dd 100644
--- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAPKCS1KeyExchangeDeformatter.cs
+++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAPKCS1KeyExchangeDeformatter.cs
@@ -1,8 +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.Runtime.Versioning;
+
namespace System.Security.Cryptography
{
+ [UnsupportedOSPlatform("browser")]
public class RSAPKCS1KeyExchangeDeformatter : AsymmetricKeyExchangeDeformatter
{
private RSA? _rsaKey;
diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAPKCS1KeyExchangeFormatter.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAPKCS1KeyExchangeFormatter.cs
index 4b40e7ffe855b..9251511ae1535 100644
--- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAPKCS1KeyExchangeFormatter.cs
+++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAPKCS1KeyExchangeFormatter.cs
@@ -1,8 +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.Runtime.Versioning;
+
namespace System.Security.Cryptography
{
+ [UnsupportedOSPlatform("browser")]
public class RSAPKCS1KeyExchangeFormatter : AsymmetricKeyExchangeFormatter
{
private RSA? _rsaKey;
diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAPKCS1SignatureDeformatter.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAPKCS1SignatureDeformatter.cs
index da602de0da666..81feeca7e8977 100644
--- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAPKCS1SignatureDeformatter.cs
+++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAPKCS1SignatureDeformatter.cs
@@ -1,10 +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.Runtime.Versioning;
using Internal.Cryptography;
namespace System.Security.Cryptography
{
+ [UnsupportedOSPlatform("browser")]
public class RSAPKCS1SignatureDeformatter : AsymmetricSignatureDeformatter
{
private RSA? _rsaKey;
diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAPKCS1SignatureFormatter.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAPKCS1SignatureFormatter.cs
index 6f92c746b7873..dcd7139c2a5a8 100644
--- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAPKCS1SignatureFormatter.cs
+++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAPKCS1SignatureFormatter.cs
@@ -1,10 +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.Runtime.Versioning;
using Internal.Cryptography;
namespace System.Security.Cryptography
{
+ [UnsupportedOSPlatform("browser")]
public class RSAPKCS1SignatureFormatter : AsymmetricSignatureFormatter
{
private RSA? _rsaKey;
diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSASignaturePadding.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSASignaturePadding.cs
index 53e70d92eac52..b69062b8f54cd 100644
--- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSASignaturePadding.cs
+++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSASignaturePadding.cs
@@ -1,6 +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
{
// NOTE: This is *currently* 1:1 with the enum, but it exists to reserve room for more options
@@ -10,6 +12,7 @@ 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/RandomNumberGenerator.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RandomNumberGenerator.cs
index 758bf15b31a62..9aa0bc4e06873 100644
--- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RandomNumberGenerator.cs
+++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RandomNumberGenerator.cs
@@ -3,6 +3,7 @@
using System.Buffers;
using System.Runtime.InteropServices;
+using System.Runtime.Versioning;
namespace System.Security.Cryptography
{
@@ -15,6 +16,7 @@ public static RandomNumberGenerator Create()
return new RandomNumberGeneratorImplementation();
}
+ [UnsupportedOSPlatform("browser")]
public static RandomNumberGenerator? Create(string rngName)
{
return (RandomNumberGenerator?)CryptoConfig.CreateFromName(rngName);
diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/Rfc2898DeriveBytes.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/Rfc2898DeriveBytes.cs
index 8c833183f4cc6..395a42352f88c 100644
--- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/Rfc2898DeriveBytes.cs
+++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/Rfc2898DeriveBytes.cs
@@ -5,12 +5,13 @@
using System.Buffers.Binary;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
+using System.Runtime.Versioning;
using System.Text;
-
using Internal.Cryptography;
namespace System.Security.Cryptography
{
+ [UnsupportedOSPlatform("browser")]
public class Rfc2898DeriveBytes : DeriveBytes
{
private const int MinimumSaltSize = 8;
diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/Rijndael.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/Rijndael.cs
index 2c3d04658649b..74bf5f1d7d048 100644
--- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/Rijndael.cs
+++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/Rijndael.cs
@@ -1,12 +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 Internal.Cryptography;
using System.ComponentModel;
+using System.Runtime.Versioning;
+using Internal.Cryptography;
namespace System.Security.Cryptography
{
[EditorBrowsable(EditorBrowsableState.Never)]
+ [UnsupportedOSPlatform("browser")]
public abstract class Rijndael : SymmetricAlgorithm
{
public static new Rijndael Create()
diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RijndaelManaged.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RijndaelManaged.cs
index ed078f4823234..876d17503b9ef 100644
--- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RijndaelManaged.cs
+++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RijndaelManaged.cs
@@ -3,10 +3,12 @@
using System.ComponentModel;
using System.Diagnostics;
+using System.Runtime.Versioning;
namespace System.Security.Cryptography
{
[EditorBrowsable(EditorBrowsableState.Never)]
+ [UnsupportedOSPlatform("browser")]
public sealed class RijndaelManaged : Rijndael
{
private readonly Aes _impl;
diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SignatureDescription.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SignatureDescription.cs
index 3ac8e8cf67bcf..80ce519390924 100644
--- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SignatureDescription.cs
+++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SignatureDescription.cs
@@ -2,9 +2,11 @@
// The .NET Foundation licenses this file to you under the MIT license.
using System.Diagnostics;
+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.Algorithms/src/System/Security/Cryptography/TripleDES.cs
index d5248c45f46c9..82589b6636fe5 100644
--- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/TripleDES.cs
+++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/TripleDES.cs
@@ -2,12 +2,13 @@
// 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
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA5350", Justification = "We are providing the implementation for TripleDES, not consuming it.")]
+ [UnsupportedOSPlatform("browser")]
public abstract class TripleDES : SymmetricAlgorithm
{
protected TripleDES()
diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/HashDerivedTests.cs b/src/libraries/System.Security.Cryptography.Algorithms/tests/HashDerivedTests.cs
index 398568f283889..bbd011a7612f1 100644
--- a/src/libraries/System.Security.Cryptography.Algorithms/tests/HashDerivedTests.cs
+++ b/src/libraries/System.Security.Cryptography.Algorithms/tests/HashDerivedTests.cs
@@ -36,6 +36,7 @@ public static void HashSize_SetForDerived_SHA512()
}
[Fact]
+ [SkipOnMono("Not supported on Browser")]
public static void HashSize_SetForDerived_MD5()
{
using DerivedMD5 sha = new DerivedMD5();