Skip to content

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

Closed

Description

@buyaa-n

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)

Activity

  1. lewing commented on Oct 14, 2020

    @lewing
    Member

    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

  2. kjpou1 commented on Oct 14, 2020

    @kjpou1
    Contributor

    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.

  3. added this to the 5.0.0 milestone on Oct 14, 2020
  4. lewing commented on Oct 14, 2020

    @lewing
    Member

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

  5. kjpou1 commented on Oct 14, 2020

    @kjpou1
    Contributor

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

  6. removed
    untriagedNew issue has not been triaged by the area owner
    on Oct 14, 2020
  7. akoeplinger commented on Oct 14, 2020

    @akoeplinger
    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; }
        }
    }
  8. lewing commented on Oct 14, 2020

    @lewing
    Member

    @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.

  9. ghost locked as resolved and limited conversation to collaborators on Dec 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions