Open Closed

System.Security.Cryptography.CryptographicException: keyset does not exist during specifically MAUI app login #7259


User avatar
0
ws-rakozy created

Building an app based on abp suite generated template. Login works properly in the webui, both on desktop and mobile emulator. The MAUI app login does not work. If I login using the default LoginService.cs, I will log in successfully, but I will immediately redirect to a page which shows the following exception. I am using an android emulator, after this redirect I am logged in on the emulator's browser, but not on the mobile app.

running the blazor app using kestrel (development environment, debug config)

Provide us with the following info:

  • ABP Framework version: v8.1.1
  • UI Type: Blazor Server
  • Database System: EF Core (MySQL)
  • Tiered (for MVC) or Auth Server Separated (for Angular): no
  • Exception message and full stack trace:

System.Security.Cryptography.CryptographicException: 'Keyset does not exist'

 	System.Security.Cryptography.dll!System.Security.Cryptography.CngKey.Open(string keyName, System.Security.Cryptography.CngProvider provider, System.Security.Cryptography.CngKeyOpenOptions openOptions) Line 47	C#
 	System.Security.Cryptography.dll!System.Security.Cryptography.CngKey.Open(string keyName, System.Security.Cryptography.CngProvider provider) Line 31	C#
 	System.Security.Cryptography.dll!System.Security.Cryptography.X509Certificates.CertificatePal.GetPrivateKey<System.Security.Cryptography.RSA>(System.Func<System.Security.Cryptography.CspParameters, System.Security.Cryptography.RSA> createCsp, System.Func<System.Security.Cryptography.CngKey, System.Security.Cryptography.RSA> createCng) Line 225	C#
 	System.Security.Cryptography.dll!System.Security.Cryptography.X509Certificates.CertificatePal.GetRSAPrivateKey() Line 23	C#
 	System.Security.Cryptography.dll!System.Security.Cryptography.X509Certificates.CertificateExtensionsCommon.GetPrivateKey<System.Security.Cryptography.RSA>(System.Security.Cryptography.X509Certificates.X509Certificate2 certificate, System.Predicate<System.Security.Cryptography.X509Certificates.X509Certificate2> matchesConstraints) Line 61	C#
 	System.Security.Cryptography.dll!System.Security.Cryptography.X509Certificates.RSACertificateExtensions.GetRSAPrivateKey(System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) Line 27	C#
 	Microsoft.IdentityModel.Tokens.dll!Microsoft.IdentityModel.Tokens.X509SecurityKey.PrivateKey.get() Line 82	C#
 	Microsoft.IdentityModel.Tokens.dll!Microsoft.IdentityModel.Tokens.X509SecurityKey.PrivateKeyStatus.get() Line 144	C#
 	Microsoft.IdentityModel.Tokens.dll!Microsoft.IdentityModel.Tokens.AsymmetricSignatureProvider.FoundPrivateKey(Microsoft.IdentityModel.Tokens.SecurityKey key) Line 155	C#
 	Microsoft.IdentityModel.Tokens.dll!Microsoft.IdentityModel.Tokens.AsymmetricSignatureProvider.AsymmetricSignatureProvider(Microsoft.IdentityModel.Tokens.SecurityKey key, string algorithm, bool willCreateSignatures) Line 126	C#
 	Microsoft.IdentityModel.Tokens.dll!Microsoft.IdentityModel.Tokens.AsymmetricSignatureProvider.AsymmetricSignatureProvider(Microsoft.IdentityModel.Tokens.SecurityKey key, string algorithm, bool willCreateSignatures, Microsoft.IdentityModel.Tokens.CryptoProviderFactory cryptoProviderFactory) Line 81	C#
 	Microsoft.IdentityModel.Tokens.dll!Microsoft.IdentityModel.Tokens.CryptoProviderFactory.CreateSignatureProvider(Microsoft.IdentityModel.Tokens.SecurityKey key, string algorithm, bool willCreateSignatures, bool cacheProvider) Line 589	C#
 	Microsoft.IdentityModel.Tokens.dll!Microsoft.IdentityModel.Tokens.CryptoProviderFactory.CreateForSigning(Microsoft.IdentityModel.Tokens.SecurityKey key, string algorithm, bool cacheProvider) Line 273	C#
 	Microsoft.IdentityModel.Tokens.dll!Microsoft.IdentityModel.Tokens.CryptoProviderFactory.CreateForSigning(Microsoft.IdentityModel.Tokens.SecurityKey key, string algorithm) Line 248	C#
>	Microsoft.IdentityModel.JsonWebTokens.dll!Microsoft.IdentityModel.JsonWebTokens.JwtTokenUtilities.CreateSignature(System.ReadOnlySpan<byte> data, System.Span<byte> destination, Microsoft.IdentityModel.Tokens.SigningCredentials signingCredentials, out int bytesWritten) Line 177	C#
 	Microsoft.IdentityModel.JsonWebTokens.dll!Microsoft.IdentityModel.JsonWebTokens.JsonWebTokenHandler.CreateToken(Microsoft.IdentityModel.Tokens.SecurityTokenDescriptor tokenDescriptor, bool setdefaultTimesOnTokenCreation, int tokenLifetimeInMinutes) Line 247	C#
 	Microsoft.IdentityModel.JsonWebTokens.dll!Microsoft.IdentityModel.JsonWebTokens.JsonWebTokenHandler.CreateToken(Microsoft.IdentityModel.Tokens.SecurityTokenDescriptor tokenDescriptor) Line 170	C#
 	OpenIddict.Server.dll!OpenIddict.Server.OpenIddictServerHandlers.Protection.GenerateIdentityModelToken.HandleAsync(OpenIddict.Server.OpenIddictServerEvents.GenerateTokenContext context) Line 1438	C#
 	OpenIddict.Server.dll!OpenIddict.Server.OpenIddictServerDispatcher.DispatchAsync<OpenIddict.Server.OpenIddictServerEvents.GenerateTokenContext>(OpenIddict.Server.OpenIddictServerEvents.GenerateTokenContext context) Line 49	C#

this is only a portion of the call stack, I can post the rest if needed (character limit)

  • Steps to reproduce the issue:

run blazor application, open maui application, attempt to log in as a valid user to the host or tenants in the maui application.


7 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    this is only a portion of the call stack, I can post the rest if needed (character limit)

    Yes, please share the full error logs

  • User Avatar
    0
    ws-rakozy created

    Hi,

    this is only a portion of the call stack, I can post the rest if needed (character limit)

    Yes, please share the full error logs

    It is too large for the character limit. The stack trace alone is far too large. I have the output from blazor saved as a text file. How should I upload this information? Should I send it over email?

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    ok

    my email is shiwei.liang@volosoft.com

  • User Avatar
    0
    ws-rakozy created

    I sent you the error log with #7259 in the subject for the email

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Could you check this ? https://support.abp.io/QA/Questions/7188/Unable-to-login-after-upgrade-to-811

    They are similar problems

  • User Avatar
    0
    ws-rakozy created

    Hi,

    Could you check this ? https://support.abp.io/QA/Questions/7188/Unable-to-login-after-upgrade-to-811

    They are similar problems

    setting a production certificate fixed my issue, but it is troubling that the development certificate is not being loaded properly by my emulator. Regardless, I can debug now, so the fix is appreciated.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    okay

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11