{"action":"created","issue":{"url":"https://api.github.com/repos/AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet/issues/179","repository_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet","labels_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet/issues/179/labels{/name}","comments_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet/issues/179/comments","events_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet/issues/179/events","html_url":"https://github.com/AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet/issues/179","id":87998981,"number":179,"title":"RSACryptoServiceProviderProxy crashes on Mono","user":{"login":"PinpointTownes","id":6998306,"avatar_url":"https://avatars.githubusercontent.com/u/6998306?v=3","gravatar_id":"","url":"https://api.github.com/users/PinpointTownes","html_url":"https://github.com/PinpointTownes","followers_url":"https://api.github.com/users/PinpointTownes/followers","following_url":"https://api.github.com/users/PinpointTownes/following{/other_user}","gists_url":"https://api.github.com/users/PinpointTownes/gists{/gist_id}","starred_url":"https://api.github.com/users/PinpointTownes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PinpointTownes/subscriptions","organizations_url":"https://api.github.com/users/PinpointTownes/orgs","repos_url":"https://api.github.com/users/PinpointTownes/repos","events_url":"https://api.github.com/users/PinpointTownes/events{/privacy}","received_events_url":"https://api.github.com/users/PinpointTownes/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet/labels/Fix%205.x","name":"Fix 5.x","color":"207de5"},{"url":"https://api.github.com/repos/AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet/labels/P2","name":"P2","color":"e11d21"},{"url":"https://api.github.com/repos/AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet/labels/User%20reported","name":"User reported","color":"d4c5f9"}],"state":"closed","locked":false,"assignee":{"login":"tushargupta51","id":803796,"avatar_url":"https://avatars.githubusercontent.com/u/803796?v=3","gravatar_id":"","url":"https://api.github.com/users/tushargupta51","html_url":"https://github.com/tushargupta51","followers_url":"https://api.github.com/users/tushargupta51/followers","following_url":"https://api.github.com/users/tushargupta51/following{/other_user}","gists_url":"https://api.github.com/users/tushargupta51/gists{/gist_id}","starred_url":"https://api.github.com/users/tushargupta51/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tushargupta51/subscriptions","organizations_url":"https://api.github.com/users/tushargupta51/orgs","repos_url":"https://api.github.com/users/tushargupta51/repos","events_url":"https://api.github.com/users/tushargupta51/events{/privacy}","received_events_url":"https://api.github.com/users/tushargupta51/received_events","type":"User","site_admin":false},"assignees":[{"login":"tushargupta51","id":803796,"avatar_url":"https://avatars.githubusercontent.com/u/803796?v=3","gravatar_id":"","url":"https://api.github.com/users/tushargupta51","html_url":"https://github.com/tushargupta51","followers_url":"https://api.github.com/users/tushargupta51/followers","following_url":"https://api.github.com/users/tushargupta51/following{/other_user}","gists_url":"https://api.github.com/users/tushargupta51/gists{/gist_id}","starred_url":"https://api.github.com/users/tushargupta51/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tushargupta51/subscriptions","organizations_url":"https://api.github.com/users/tushargupta51/orgs","repos_url":"https://api.github.com/users/tushargupta51/repos","events_url":"https://api.github.com/users/tushargupta51/events{/privacy}","received_events_url":"https://api.github.com/users/tushargupta51/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet/milestones/7","html_url":"https://github.com/AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet/milestones/Backlog","labels_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet/milestones/7/labels","id":1234298,"number":7,"title":"Backlog","description":"","creator":{"login":"brentschmaltz","id":3172421,"avatar_url":"https://avatars.githubusercontent.com/u/3172421?v=3","gravatar_id":"","url":"https://api.github.com/users/brentschmaltz","html_url":"https://github.com/brentschmaltz","followers_url":"https://api.github.com/users/brentschmaltz/followers","following_url":"https://api.github.com/users/brentschmaltz/following{/other_user}","gists_url":"https://api.github.com/users/brentschmaltz/gists{/gist_id}","starred_url":"https://api.github.com/users/brentschmaltz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brentschmaltz/subscriptions","organizations_url":"https://api.github.com/users/brentschmaltz/orgs","repos_url":"https://api.github.com/users/brentschmaltz/repos","events_url":"https://api.github.com/users/brentschmaltz/events{/privacy}","received_events_url":"https://api.github.com/users/brentschmaltz/received_events","type":"User","site_admin":false},"open_issues":11,"closed_issues":5,"state":"open","created_at":"2015-07-30T22:30:03Z","updated_at":"2016-07-14T01:31:20Z","due_on":null,"closed_at":null},"comments":39,"created_at":"2015-06-13T12:40:24Z","updated_at":"2016-08-01T07:16:18Z","closed_at":"2016-05-19T21:59:06Z","body":"```\r\nSystem.Security.Cryptography.CryptographicException: Keyset does not exist\r\n  at System.Security.Cryptography.RSACryptoServiceProvider.Common (System.Security.Cryptography.CspParameters p) [0x00000] in <filename unknown>:0 \r\n  at System.Security.Cryptography.RSACryptoServiceProvider..ctor (Int32 dwKeySize, System.Security.Cryptography.CspParameters parameters) [0x00000] in <filename unknown>:0 \r\n  at System.Security.Cryptography.RSACryptoServiceProvider..ctor (System.Security.Cryptography.CspParameters parameters) [0x00000] in <filename unknown>:0 \r\n  at System.IdentityModel.Tokens.RSACryptoServiceProviderProxy..ctor (System.Security.Cryptography.RSACryptoServiceProvider rsa) [0x00000] in <filename unknown>:0 \r\n  at System.IdentityModel.Tokens.AsymmetricSignatureProvider..ctor (System.IdentityModel.Tokens.AsymmetricSecurityKey key, System.String algorithm, Boolean willCreateSignatures) [0x00000] in <filename unknown>:0 \r\n  at System.IdentityModel.Tokens.SignatureProviderFactory.CreateProvider (System.IdentityModel.Tokens.SecurityKey key, System.String algorithm, Boolean willCreateSignatures) [0x00000] in <filename unknown>:0 \r\n  at System.IdentityModel.Tokens.SignatureProviderFactory.CreateForSigning (System.IdentityModel.Tokens.SecurityKey key, System.String algorithm) [0x00000] in <filename unknown>:0 \r\n  at System.IdentityModel.Tokens.JwtSecurityTokenHandler.CreateSignature (System.String inputString, System.IdentityModel.Tokens.SecurityKey key, System.String algorithm, System.IdentityModel.Tokens.SignatureProvider signatureProvider) [0x00000] in <filename unknown>:0 \r\n  at System.IdentityModel.Tokens.JwtSecurityTokenHandler.CreateToken (System.String issuer, System.String audience, System.Security.Claims.ClaimsIdentity subject, Nullable`1 notBefore, Nullable`1 expires, System.IdentityModel.Tokens.SigningCredentials signingCredentials, System.IdentityModel.Tokens.SignatureProvider signatureProvider) [0x00000] in <filename unknown>:0 \r\n  at AspNet.Security.OpenIdConnect.Server.OpenIdConnectServerHandler+<CreateIdentityTokenAsync>d__21.MoveNext () [0x00000] in <filename unknown>:0 \r\n```\r\n\r\nMono doesn't use CryptoAPI - which is Windows-specific - and always initializes `CspKeyContainerInfo.ProviderType` to `1`, which causes `RSACryptoServiceProviderProxy` to create a proxy around the existing RSA provider. Sadly, it crashes on Mono.\r\n\r\nThe bug disappears when you remove `csp.Flags |= CspProviderFlags.UseExistingKey;` from `RSACryptoServiceProviderProxy`'s constructor.\r\n\r\n/cc @brentschmaltz @tushargupta51 "},"comment":{"url":"https://api.github.com/repos/AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet/issues/comments/236506388","html_url":"https://github.com/AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet/issues/179#issuecomment-236506388","issue_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet/issues/179","id":236506388,"user":{"login":"frodestorhaug","id":15831917,"avatar_url":"https://avatars.githubusercontent.com/u/15831917?v=3","gravatar_id":"","url":"https://api.github.com/users/frodestorhaug","html_url":"https://github.com/frodestorhaug","followers_url":"https://api.github.com/users/frodestorhaug/followers","following_url":"https://api.github.com/users/frodestorhaug/following{/other_user}","gists_url":"https://api.github.com/users/frodestorhaug/gists{/gist_id}","starred_url":"https://api.github.com/users/frodestorhaug/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frodestorhaug/subscriptions","organizations_url":"https://api.github.com/users/frodestorhaug/orgs","repos_url":"https://api.github.com/users/frodestorhaug/repos","events_url":"https://api.github.com/users/frodestorhaug/events{/privacy}","received_events_url":"https://api.github.com/users/frodestorhaug/received_events","type":"User","site_admin":false},"created_at":"2016-08-01T07:16:17Z","updated_at":"2016-08-01T07:16:17Z","body":"Thanks for your answer. Yes, we have something like that running. And everything works great on windows. But we also want this to work on mono. Our setup still uses .net core rc1 and we want this to work on linux/mono for a demo and do not have the time to upgrade to rc2 for now. But as you wrote the AsymmetricSignatureProvider throws an exception on mono. So I wanted to try your workaround, but can not find where I should implement your MonoFriendlyCryptoProviderFactory. Any help would be greatly appreciated."}}
{"actor":{"display_login":"frodestorhaug"}}