Issue Summary:
I’m trying to verify the Fireblocks webhook signature in a .NET (C#) application using the public key provided in the production environment. However, I encounter the following error when using rsa.ImportFromPem()
:
Steps Taken:
- Retrieved the public key from the documentation (starting with
-----BEGIN PUBLIC KEY-----
). - Tried using
rsa.ImportFromPem()
with this key, passed as a string. - Confirmed that the key is correctly formatted and includes line breaks (
\n
).
Code Snippet:
var publicKey = _settings.CurrentValue.PublicKey.Replace("\\n", "\n");
using var rsa = RSA.Create();
rsa.ImportFromPem(publicKey); // Fails here
using var sha512 = SHA512.Create();
byte[] hash = sha512.ComputeHash(Encoding.UTF8.GetBytes(requestBody));
bool isValid = rsa.VerifyHash(hash, receivedSignature, HashAlgorithmName.SHA512, RSASignaturePadding.Pkcs1);
Questions:
Is the public key provided in the documentation fully compatible with .NET RSA format?
Are there any encoding or formatting requirements (e.g., line endings, base64 padding)?
Do you have an officially supported example for .NET/C# signature verification?
Thanks in advance for your support!