# I'm having trouble signing a SHA1 string encoded in Base64

**URL:** <https://community.n8n.io/t/im-having-trouble-signing-a-sha1-string-encoded-in-base64/34118>\
**Category:** Questions\
**Tags:** crypto\
**Created:** [December 12, 2023, 1:09pm UTC](https://community.n8n.io/t/im-having-trouble-signing-a-sha1-string-encoded-in-base64/34118 "2023-12-12T13:09:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![arthurcorre](https://avatars.discourse-cdn.com/v4/letter/a/7ea924/32.png) [@arthurcorre](https://community.n8n.io/u/arthurcorre)\
**Post date:** [December 12, 2023, 1:09pm UTC](https://community.n8n.io/t/im-having-trouble-signing-a-sha1-string-encoded-in-base64/34118/1 "2023-12-12T13:09:16Z")

</div>

## Describe the problem/error/question

I’m looking to interact with the [Bokun API](https://bokun.dev/booking-api-restful/vU6sCfxwYdJWd1QAcLt12i).

To connect, I need to create a signature called `X-Bokun-Signature` [in their documentation](https://bokun.dev/booking-api-rest/vU6sCfxwYdJWd1QAcLt12i/configuring-the-platform-for-api-usage-and-authentication/sFiGRpo4detkmrZPcWtQPj), which involves concatenating a number of parameters into a string, hashing it with SHA-1 and encoding it in BASE64. This is where I get stuck.

I’ve seen that a “Crypto” node lets me do this, but I’ve tried several times and I get an error message:

> ERROR: error:1E08010C:DECODER routines::unsupported

## What is the error message (if any)?

 ![image](https://europe1.discourse-cdn.com/n8n/original/3X/b/e/be96ee49081b5cceb8b2d8e70cfa3a70395d4498.png)

## Please share your workflow

I’ll share just below the configuration I tried to build. You normally have all the necessary parameters, namely :

- date and time in the right format
- the `Access key` given by Bokun
- the HTTP method used (here GET)
- the path to the web service called (/booking.json/booking/ECO-36152541)

This is the key I need to hash, then encode. You have the `concat` variable in the “Set” node.

The secret key used to hash the string is visible in the “Crypto” node, `Private Key` parameter.

## Share the output returned by the last node

 ![image](https://europe1.discourse-cdn.com/n8n/original/3X/b/e/be96ee49081b5cceb8b2d8e70cfa3a70395d4498.png)

## Information on your n8n setup

- **n8n version:** 1.18.2
- **Running n8n via (Docker, npm, n8n cloud, desktop app):** n8n cloud
- **Operating system:** Mac OS

---

<div class="post-metadata">

**Author:** ![n8n](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/n8n/32/26906_2.png) [@n8n](https://community.n8n.io/u/n8n)\
**Post date:** [December 12, 2023, 1:09pm UTC](https://community.n8n.io/t/im-having-trouble-signing-a-sha1-string-encoded-in-base64/34118/2 "2023-12-12T13:09:17Z")

</div>

It looks like your topic is missing some important information. Could you provide the following if applicable.

- **n8n version:**
- **Database (default: SQLite):**
- **n8n EXECUTIONS\_PROCESS setting (default: own, main):**
- **Running n8n via (Docker, npm, n8n cloud, desktop app):**
- **Operating system:**

---

<div class="post-metadata">

**Author:** ![ihortom](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/ihortom/32/11473_2.png) [@ihortom](https://community.n8n.io/u/ihortom)\
**Post date:** [December 13, 2023, 7:06am UTC](https://community.n8n.io/t/im-having-trouble-signing-a-sha1-string-encoded-in-base64/34118/3 "2023-12-13T07:06:24Z")

</div>

@arthurcorre , I don’t think you follow the documentation to start with. Here’s an extract for Bokun guide:

> Create a signature with the secret key, taking the concatenated string as input, using the “HmacSHA1” algorithm

Note they are talking about “HmacSHA1”. HMAC-SHA1 and SHA1 are not the same thing.

Having said that it does look like there is an issue with the Crypto node. I tried different options and many result in the same error.

---

<div class="post-metadata">

**Author:** ![Jon](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jon/32/40174_2.png) [@Jon](https://community.n8n.io/u/Jon)\
**Post date:** [December 13, 2023, 9:12am UTC](https://community.n8n.io/t/im-having-trouble-signing-a-sha1-string-encoded-in-base64/34118/4 "2023-12-13T09:12:33Z")

</div>

Hey @arthurcorre,

The issue is with decoding the private key, It looks like your private key is not a private key and is just a string. Typically a private key would look something like this…

```auto
-----BEGIN RSA PRIVATE KEY-----
MIICWwIBAAK.....
xxx.....
-----END RSA PRIVATE KEY-----

```

If you do provide a valid private key the node appears to work as expected.

 ![image](https://europe1.discourse-cdn.com/n8n/original/3X/5/a/5a178b4dc84f9d601bd39ccea7d5f90056fb961e.jpeg)

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/system/32/195824_2.png) [@system](https://community.n8n.io/u/system)\
**Post date:** [March 12, 2024, 9:12am UTC](https://community.n8n.io/t/im-having-trouble-signing-a-sha1-string-encoded-in-base64/34118/5 "2024-03-12T09:12:47Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
