Skip to content

RSACertificateExtensions.GetRSAPrivateKey() fails on UWP #17257

Closed

Description

@awcullen

Since 4.2.0-rc3-24105-00, in UWP, calling RSACertificateExtensions.GetRSAPrivateKey() results in:

System.TypeLoadException occurred
Message=Could not load type 'System.Security.Cryptography.ECDsa' from assembly 'System.Security.Cryptography.Algorithms, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Source=System.Security.Cryptography.X509Certificates

I see in the package that the runtime changed from netstandard1.4 to 1.6.

4.1.0-rc3-24104 works fine.

Activity

  1. bartonjs commented on May 12, 2016

    @bartonjs
    Member

    Could you share your whole project.json so I can try to get into the same state?

  2. self-assigned this
    on May 12, 2016
  3. awcullen commented on May 12, 2016

    @awcullen
    Author

    My library that is calling GetRSAPrivateKey has

    {
      "supports": {},
      "dependencies": {
        "MetroLog": "1.0.1",
        "NETStandard.Library": "1.5.0-rc3-24104-00", // last release that works
        "StyleCop.Analyzers": "1.0.0",
        "System.Threading.Tasks.Dataflow": "4.6.0-rc3-24104-00"
      },
      "frameworks": {
        "netstandard1.4": {
          "imports": ".NETPlatform5.0" // to support metrolog
        }
      }
    }
    
  4. awcullen commented on May 12, 2016

    @awcullen
    Author

    I found in ".nuget\packages\System.Security.Cryptography.Algorithms\4.2.0-rc3-24111-00\ref\netstandard1.4"
    "System.Security.Cryptography.Algorithms.dll" has the ECDsa type.
    So it compiles.
    But there is no "\lib\netstandard1.4" or "\runtimes\win\lib\netstandard1.4" so it fails at runtime.

    Thanks

  5. ericstj commented on May 12, 2016

    @ericstj
    Member

    So netstandard1.4 isn't a runnable TFM. It's an abstract/portable TFM that represents the surface area of many app models / concrete TFMs. The concrete TFM here you'd be using would be from the UWP application referencing this, which should use

      "frameworks": {
        "uap10.0": {}
      },
    

    Here is an example of a project that works fine for me with UWP and the latest Algorithms:

    {
      "dependencies": {
        "Microsoft.ApplicationInsights": "1.0.0",
        "Microsoft.ApplicationInsights.PersistenceChannel": "1.0.0",
        "Microsoft.ApplicationInsights.WindowsApps": "1.0.0",
        "Microsoft.NETCore.UniversalWindowsPlatform": "5.2.0-rc3-24112-00",
        "System.Security.Cryptography.Algorithms": "4.2.0-rc3-24112-00"
      },
      "frameworks": {
        "uap10.0": {}
      },
      "runtimes": {
        "win10-arm": {},
        "win10-arm-aot": {},
        "win10-x86": {},
        "win10-x86-aot": {},
        "win10-x64": {},
        "win10-x64-aot": {}
      }
    }
    
  6. bartonjs commented on May 12, 2016

    @bartonjs
    Member

    Okay, after chatting with Eric some more we figured it out. The ECDsa class got excluded from the netcore50 library during a recent change; and so that's causing this error. I've reproed it locally with Eric's project.json and my test app.

  7. awcullen commented on May 12, 2016

    @awcullen
    Author

    Awesome. Thanks guys.

  8. bartonjs commented on May 13, 2016

    @bartonjs
    Member

    @awcullen It looks happy to me with the 24113 packages, mind giving it a go?

  9. awcullen commented on May 13, 2016

    @awcullen
    Author

    Good to go. Thanks again.

  10. removed their assignment
    on Nov 15, 2016
  11. transferred this issue fromdotnet/corefxon Jan 31, 2020
  12. added this to the 1.0.0-rtm milestone on Jan 31, 2020
  13. ghost locked as resolved and limited conversation to collaborators on Dec 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions