Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark System.Security.Cryptography.Algorithms as unsupported on Browser WASM #42010

Merged
merged 8 commits into from
Sep 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
<Import Project="..\Directory.Build.props" />
<PropertyGroup>
<StrongNameKeyId>Microsoft</StrongNameKeyId>
<IncludePlatformAttributes>true</IncludePlatformAttributes>
</PropertyGroup>
</Project>

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,6 @@
<Compile Include="Internal\Cryptography\SHAHashProvider.Browser.cs" />
<Compile Include="System\Security\Cryptography\RandomNumberGenerator.cs" />
<Compile Include="System\Security\Cryptography\IncrementalHash.cs" />
<Compile Include="System\Security\Cryptography\MD5.cs" />
<Compile Include="System\Security\Cryptography\SHA1.cs" />
<Compile Include="System\Security\Cryptography\SHA1Managed.cs" />
<Compile Include="System\Security\Cryptography\SHA256.cs" />
Expand Down
Original file line number Diff line number Diff line change
@@ -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()
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
@@ -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() { }
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
bartonjs marked this conversation as resolved.
Show resolved Hide resolved

namespace System.Security.Cryptography
{
[UnsupportedOSPlatform("browser")]
public abstract class AsymmetricKeyExchangeFormatter
{
protected AsymmetricKeyExchangeFormatter() { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
@@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
bartonjs marked this conversation as resolved.
Show resolved Hide resolved

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).
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -13,6 +14,7 @@ namespace System.Security.Cryptography
/// which is either a prime curve or a characteristic-2 curve.
/// </remarks>
[DebuggerDisplay("ECCurve: {Oid}")]
[UnsupportedOSPlatform("browser")]
public partial struct ECCurve
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
/// <summary>
/// Abstract base class for implementations of elliptic curve Diffie-Hellman to derive from
/// </summary>
[UnsupportedOSPlatform("browser")]
public abstract partial class ECDiffieHellman : AsymmetricAlgorithm
{
private static readonly string[] s_validOids =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@

using System.Buffers;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security.Cryptography.Asn1;

namespace System.Security.Cryptography
{
/// <summary>
/// Represents the public and private key of the specified elliptic curve.
/// </summary>
[UnsupportedOSPlatform("browser")]
public struct ECParameters
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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 <a href="https://tools.ietf.org/html/rfc5869">RFC5869</a> for more information.
/// </remarks>
[UnsupportedOSPlatform("browser")]
public static class HKDF
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using Internal.Cryptography;
using System.ComponentModel;
using System.Runtime.Versioning;

namespace System.Security.Cryptography
{
Expand All @@ -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")]
bartonjs marked this conversation as resolved.
Show resolved Hide resolved
public class HMACSHA1 : HMAC
{
public HMACSHA1()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

using System;
using System.Diagnostics;
using System.Runtime.Versioning;
using System.Security.Cryptography;

using Internal.Cryptography;

namespace System.Security.Cryptography
Expand All @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

using System;
using System.Diagnostics;
using System.Runtime.Versioning;
using System.Security.Cryptography;

using Internal.Cryptography;

namespace System.Security.Cryptography
Expand All @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

using System;
using System.Diagnostics;
using System.Runtime.Versioning;
using System.Security.Cryptography;

using Internal.Cryptography;

namespace System.Security.Cryptography
Expand All @@ -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()
Expand Down
Original file line number Diff line number Diff line change
@@ -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
{
Expand Down Expand Up @@ -346,6 +347,7 @@ public static IncrementalHash CreateHash(HashAlgorithmName hashAlgorithm)
/// the empty string.
/// </exception>
/// <exception cref="CryptographicException"><paramref name="hashAlgorithm"/> is not a known hash algorithm.</exception>
[UnsupportedOSPlatform("browser")]
public static IncrementalHash CreateHMAC(HashAlgorithmName hashAlgorithm, byte[] key)
{
if (key == null)
Expand Down Expand Up @@ -376,6 +378,7 @@ public static IncrementalHash CreateHMAC(HashAlgorithmName hashAlgorithm, byte[]
/// the empty string.
/// </exception>
/// <exception cref="CryptographicException"><paramref name="hashAlgorithm"/> is not a known hash algorithm.</exception>
[UnsupportedOSPlatform("browser")]
public static IncrementalHash CreateHMAC(HashAlgorithmName hashAlgorithm, ReadOnlySpan<byte> key)
{
if (string.IsNullOrEmpty(hashAlgorithm.Name))
Expand Down
Loading