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

Adding assembly level UnsupportedOSPlatform("browser") System.Security.Cryptography.Primitives is not correct, HashAlgorithm supported on browser #43380

Closed
buyaa-n opened this issue Oct 14, 2020 · 7 comments · Fixed by #43387
Assignees
Labels
arch-wasm WebAssembly architecture area-System.Security
Milestone

Comments

@buyaa-n
Copy link
Member

buyaa-n commented Oct 14, 2020

Adding assembly level UnsupportedOSPlatform("browser") System.Security.Cryptography.Primitives is not correct, HashAlgorithm and HashAlgorithmName supported on browser cc @jeffhandley

The issue appears to be that we are generating the attribute for all of System.Security.Cryptography.Primitives which is not correct. Originally posted by @lewing in #43363 (comment)

@jeffhandley jeffhandley added arch-wasm WebAssembly architecture area-System.Security untriaged New issue has not been triaged by the area owner labels Oct 14, 2020
@ghost
Copy link

ghost commented Oct 14, 2020

Tagging subscribers to this area: @bartonjs, @vcsjones, @krwq, @jeffhandley
See info in area-owners.md if you want to be subscribed.

@lewing
Copy link
Member

lewing commented Oct 14, 2020

HashAlgorithm and HashAlgorithmName are currently marked as unsupported on browser but are available for use. Absent a compelling reason I don't think we should annotate the other primitives that don't include any implementation as unsupported either.

/cc @steveisok @marek-safar

@kjpou1
Copy link
Contributor

kjpou1 commented Oct 14, 2020

From my understanding of the Primitives they are there for use of the other Cryptography modules without specific implementations so can be available for use as well.

@lewing lewing added this to the 5.0.0 milestone Oct 14, 2020
@lewing
Copy link
Member

lewing commented Oct 14, 2020

@kjpou1 please review the primitive classes, especially where they are base classes, and correct the platform annotations.

@kjpou1
Copy link
Contributor

kjpou1 commented Oct 14, 2020

This should be only needed to remove the os platform not supported. The classes are abstract and implemented in the other cryptography modules.

@akoeplinger
Copy link
Member

Shouldn't we still mark the static methods on some of these classes as unsupported that we know don't work:

namespace System.Security.Cryptography
{
    public abstract partial class AsymmetricAlgorithm : System.IDisposable
    {
        public static System.Security.Cryptography.AsymmetricAlgorithm Create() { throw null; }
        public static System.Security.Cryptography.AsymmetricAlgorithm? Create(string algName) { throw null; }
    }
    public abstract partial class HMAC : System.Security.Cryptography.KeyedHashAlgorithm
    {
        public static new System.Security.Cryptography.HMAC Create() { throw null; }
        public static new System.Security.Cryptography.HMAC? Create(string algorithmName) { throw null; }
    }
    public abstract partial class KeyedHashAlgorithm : System.Security.Cryptography.HashAlgorithm
    {
        public static new System.Security.Cryptography.KeyedHashAlgorithm Create() { throw null; }
        public static new System.Security.Cryptography.KeyedHashAlgorithm? Create(string algName) { throw null; }
    }
    public abstract partial class SymmetricAlgorithm : System.IDisposable
    {
        public static System.Security.Cryptography.SymmetricAlgorithm Create() { throw null; }
        public static System.Security.Cryptography.SymmetricAlgorithm? Create(string algName) { throw null; }
    }
}

@lewing
Copy link
Member

lewing commented Oct 14, 2020

@akoeplinger that is an interesting question. Create() on all those classes is marked Obsolete and throw PNSE unconditionally on all platforms already

Create(string name) should probably be marked but the code is written such that HashAlgorithm.Create(string name) could try to create a KeyedHashAlgorithm.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture area-System.Security
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants