net-core-push-notifications icon indicating copy to clipboard operation
net-core-push-notifications copied to clipboard

Firebase CryptographicException when deployed to production server (NOT Azure)

Open danielgindi opened this issue 1 year ago • 0 comments

This works correctly locally. But when deployed - I received CryptographicException "The system cannot find the file specified.".

at System.Security.Cryptography.CngKey.Import(ReadOnlySpan`1 keyBlob, String curveName, CngKeyBlobFormat format, CngProvider provider)
   at System.Security.Cryptography.CngPkcs8.ImportPkcs8(ReadOnlySpan`1 keyBlob)
   at System.Security.Cryptography.CngPkcs8.ImportPkcs8PrivateKey(ReadOnlySpan`1 source, Int32& bytesRead)
   at System.Security.Cryptography.RSACng.ImportPkcs8PrivateKey(ReadOnlySpan`1 source, Int32& bytesRead)
   at System.Security.Cryptography.PemKeyHelpers.ImportPem(ReadOnlySpan`1 input, FindImportActionFunc callback)
   at CorePush.Firebase.FirebaseSender.GetMasterToken()
   at CorePush.Firebase.FirebaseSender.GetJwtTokenAsync()
   at CorePush.Firebase.FirebaseSender.SendAsync(Object payload, CancellationToken cancellationToken)

Seems like RSACryptoServiceProvider should be used instead.

danielgindi avatar Mar 18 '24 16:03 danielgindi