# Signature Verification Fails - No Supported Key Formats Exception (.NET Integration)

**URL:** <https://community.fireblocks.com/t/signature-verification-fails-no-supported-key-formats-exception-net-integration/2365>\
**Category:** Developer Discussion\
**Tags:** help-center, getting-started\
**Created:** [April 14, 2025, 1:51pm UTC](https://community.fireblocks.com/t/signature-verification-fails-no-supported-key-formats-exception-net-integration/2365 "2025-04-14T13:51:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![osdeniz](https://avatars.discourse-cdn.com/v4/letter/o/67e7ee/32.png) [@osdeniz](https://community.fireblocks.com/u/osdeniz)\
**Post date:** [April 14, 2025, 1:51pm UTC](https://community.fireblocks.com/t/signature-verification-fails-no-supported-key-formats-exception-net-integration/2365/1 "2025-04-14T13:51:32Z")

</div>

**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:**

```csharp

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!
```

---

<div class="post-metadata">

**Author:** ![uwes\_lamprecht](https://avatars.discourse-cdn.com/v4/letter/u/c89c15/32.png) [@uwes\_lamprecht](https://community.fireblocks.com/u/uwes_lamprecht)\
**Post date:** [April 16, 2025, 8:48am UTC](https://community.fireblocks.com/t/signature-verification-fails-no-supported-key-formats-exception-net-integration/2365/2 "2025-04-16T08:48:15Z")

</div>

This worked for us in a DotNet Core APIL

```auto
public async Task<IActionResult> TransactionWebhookAsync([FromBody] object notificationBody, [FromHeader(Name = "Fireblocks-Signature")] string signature)

```

```auto
fireblocksWebhookValidator.ValidateWebhook(JsonSerializer.Serialize(notificationBody), signature)

```

```auto
try
{
    using (var rsa = RSA.Create())
    {
        rsa.ImportFromPem(_fireblocksPublicKey);

        byte[] signatureBytes = Convert.FromBase64String(signature);
        byte[] messageBytes = Encoding.UTF8.GetBytes(notificationBody);
        byte[] hash = SHA512.HashData(messageBytes);
        return rsa.VerifyHash(hash, signatureBytes, HashAlgorithmName.SHA512, RSASignaturePadding.Pkcs1);
    }
}
catch (Exception ex)
{
    logger.Error("Signature verification failed", ex);
    return false;
}

```
