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

Describe the problem/error/question

I’m looking to interact with the Bokun API.

To connect, I need to create a signature called X-Bokun-Signature in their documentation, 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)?

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

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

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:

@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.

1 Like

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…

-----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.