# Crypto Module - Encrypt/Decrypt

**URL:** <https://community.n8n.io/t/crypto-module-encrypt-decrypt/4497>\
**Category:** Questions\
**Created:** [February 25, 2021, 2:45pm UTC](https://community.n8n.io/t/crypto-module-encrypt-decrypt/4497 "2021-02-25T14:45:19Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![pradilla](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/pradilla/32/2247_2.png) [@pradilla](https://community.n8n.io/u/pradilla)\
**Post date:** [February 25, 2021, 2:45pm UTC](https://community.n8n.io/t/crypto-module-encrypt-decrypt/4497/1 "2021-02-25T14:45:20Z")

</div>

Hi,  
I need to be able to send an encrypted string to a third party (or store in an external master data service) and then when received through a webhook or API GET call to that service I need to be able to decrypt the string received to be able to use the original string in the workflow.

Have been trying with the crypto module but cant seem to get it to do what I want. Using n8n cloud.

Any help would be much appreciated  
Thanks

---

<div class="post-metadata">

**Author:** ![Miquel\_Colomer](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/miquel_colomer/32/18606_2.png) [@Miquel\_Colomer](https://community.n8n.io/u/Miquel_Colomer)\
**Post date:** [February 25, 2021, 3:01pm UTC](https://community.n8n.io/t/crypto-module-encrypt-decrypt/4497/2 "2021-02-25T15:01:47Z")

</div>

> [@pradilla](#):
>
> Have been trying with the crypto module but cant seem to get it to do what I want. Using n8n cloud.

If you are running n8n as a docker container, launch it with next environment variable

> NODE\_FUNCTION\_ALLOW\_EXTERNAL=crypto

Let me know if it works.

---

<div class="post-metadata">

**Author:** ![RicardoE105](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/ricardoe105/32/550_2.png) [@RicardoE105](https://community.n8n.io/u/RicardoE105)\
**Post date:** [February 25, 2021, 3:20pm UTC](https://community.n8n.io/t/crypto-module-encrypt-decrypt/4497/3 "2021-02-25T15:20:30Z")

</div>

This will not work because he is using n8n cloud.

---

<div class="post-metadata">

**Author:** ![RicardoE105](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/ricardoe105/32/550_2.png) [@RicardoE105](https://community.n8n.io/u/RicardoE105)\
**Post date:** [February 25, 2021, 3:20pm UTC](https://community.n8n.io/t/crypto-module-encrypt-decrypt/4497/4 "2021-02-25T15:20:40Z")

</div>

@pradilla Can you share the docs of the API you are trying to consume? Perhaps, I can help you out but need more details.

---

<div class="post-metadata">

**Author:** ![Miquel\_Colomer](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/miquel_colomer/32/18606_2.png) [@Miquel\_Colomer](https://community.n8n.io/u/Miquel_Colomer)\
**Post date:** [February 25, 2021, 3:23pm UTC](https://community.n8n.io/t/crypto-module-encrypt-decrypt/4497/5 "2021-02-25T15:23:47Z")

</div>

Oh, ok! ☹

---

<div class="post-metadata">

**Author:** ![RicardoE105](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/ricardoe105/32/550_2.png) [@RicardoE105](https://community.n8n.io/u/RicardoE105)\
**Post date:** [February 25, 2021, 3:25pm UTC](https://community.n8n.io/t/crypto-module-encrypt-decrypt/4497/6 "2021-02-25T15:25:27Z")

</div>

In cloud currently it’s not posible to load external packages. However, this has been discussed and might be included in the future.

---

<div class="post-metadata">

**Author:** ![Miquel\_Colomer](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/miquel_colomer/32/18606_2.png) [@Miquel\_Colomer](https://community.n8n.io/u/Miquel_Colomer)\
**Post date:** [February 25, 2021, 3:27pm UTC](https://community.n8n.io/t/crypto-module-encrypt-decrypt/4497/7 "2021-02-25T15:27:43Z")

</div>

It sounds interesting @RicardoE105 🙂  
Nice job guys!

---

<div class="post-metadata">

**Author:** ![pradilla](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/pradilla/32/2247_2.png) [@pradilla](https://community.n8n.io/u/pradilla)\
**Post date:** [February 25, 2021, 4:15pm UTC](https://community.n8n.io/t/crypto-module-encrypt-decrypt/4497/8 "2021-02-25T16:15:11Z")

</div>

Thanks! Shared details on DM. Will post generic solution here later on so the community can benefit from this. 👍

---

<div class="post-metadata">

**Author:** ![JOSE\_ALEJANDRO\_DIAZ](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jose_alejandro_diaz/32/2477_2.png) [@JOSE\_ALEJANDRO\_DIAZ](https://community.n8n.io/u/JOSE_ALEJANDRO_DIAZ)\
**Post date:** [February 26, 2021, 3:24pm UTC](https://community.n8n.io/t/crypto-module-encrypt-decrypt/4497/9 "2021-02-26T15:24:52Z")

</div>

The NodeJS Crypto Ciper and Deciper would solve the @pradilla 's problem and for sure would be an important security feature for all n8n and cloud users.

[https://nodejs.org/api/crypto.html#crypto\_class\_cipher](https://nodejs.org/api/crypto.html#crypto_class_cipher)

The NodeJS Crypto Ciper is based on AES standard allows that to encript and decript a string using a password and the number of bytes of the algorithm

This could be used to send sensitive body data to databases or other parties. The party need to know the password and the algorithm to decript the string.

Nice implementations of Crypto Ciper can be found in links above.

I found this can help to find a way to do it possible.

> **[Implementing AES Encryption in Node.js and C# from Scratch](https://levelup.gitconnected.com/implementing-aes-encryption-in-node-js-and-c-from-scratch-6ee7b47ae6d4)**
>
> A simple guide on implementing AES Encryption in Node and C#

> <https://gist.github.com/siwalikm/8311cf0a287b98ef67c73c1b03b47154>

---

<div class="post-metadata">

**Author:** ![RicardoE105](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/ricardoe105/32/550_2.png) [@RicardoE105](https://community.n8n.io/u/RicardoE105)\
**Post date:** [February 27, 2021, 3:24am UTC](https://community.n8n.io/t/crypto-module-encrypt-decrypt/4497/10 "2021-02-27T03:24:25Z")

</div>

The Crypto node uses the crypto library, so this functionality should not be difficult to add.

---

<div class="post-metadata">

**Author:** ![pradilla](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/pradilla/32/2247_2.png) [@pradilla](https://community.n8n.io/u/pradilla)\
**Post date:** [April 6, 2021, 1:25pm UTC](https://community.n8n.io/t/crypto-module-encrypt-decrypt/4497/11 "2021-04-06T13:25:22Z")

</div>

Hi @RicardoE105, hope all is well! While you are able to add this functionality to the crypto module is there any way you can think of to enable the external crypto calls inside the function module? @maxT any other idea?

> [@Miquel\_Colomer](#):
>
> > NODE\_FUNCTION\_ALLOW\_EXTERNAL=crypto

Thanks!  
Andres

---

<div class="post-metadata">

**Author:** ![maxT](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/maxt/32/31233_2.png) [@maxT](https://community.n8n.io/u/maxT)\
**Post date:** [April 8, 2021, 11:51am UTC](https://community.n8n.io/t/crypto-module-encrypt-decrypt/4497/12 "2021-04-08T11:51:38Z")

</div>

Hi all 👋

Happy to report that we have a ticket on n8n.cloud immediate backlog to expose various useful modules to be used in Function and Function Item nodes. Initially, these will be a shortlist of modules that n8n core is already utilizing (incl. lodash, moment.js, and now crypto).

We’ll get that launched as soon as we can. For context, adjusting the env vars is trivial but most of the effort will be auditing these libraries to ensure there are no security issues by exposing them to users.

Thanks!

---

<div class="post-metadata">

**Author:** ![RicardoE105](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/ricardoe105/32/550_2.png) [@RicardoE105](https://community.n8n.io/u/RicardoE105)\
**Post date:** [April 9, 2021, 2:17am UTC](https://community.n8n.io/t/crypto-module-encrypt-decrypt/4497/13 "2021-04-09T02:17:09Z")

</div>

@pradilla what max mentioned will allow you to to what @Miquel_Colomer suggested.

---

<div class="post-metadata">

**Author:** ![JOSE\_ALEJANDRO\_DIAZ](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jose_alejandro_diaz/32/2477_2.png) [@JOSE\_ALEJANDRO\_DIAZ](https://community.n8n.io/u/JOSE_ALEJANDRO_DIAZ)\
**Post date:** [April 9, 2021, 1:45pm UTC](https://community.n8n.io/t/crypto-module-encrypt-decrypt/4497/14 "2021-04-09T13:45:40Z")

</div>

Nice news @RicardoE105 @maxT @pradilla  
We essencially need to Encrypt and Decrypt … The options discussed above to implement an AES 256 iv sounds sutable ways.  
The best approach you decide to handle will be more than welcome.  
We will be here to help and to early test it.  
🚀

---

<div class="post-metadata">

**Author:** ![pradilla](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/pradilla/32/2247_2.png) [@pradilla](https://community.n8n.io/u/pradilla)\
**Post date:** [April 15, 2021, 1:55pm UTC](https://community.n8n.io/t/crypto-module-encrypt-decrypt/4497/15 "2021-04-15T13:55:25Z")

</div>

> [@maxT](#):
>
> crypto

Hi Max, hope all is well. Do you have an estimated date for these lib to be available to use in the function node?

Thanks!  
Andres

---

<div class="post-metadata">

**Author:** ![maxT](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/maxt/32/31233_2.png) [@maxT](https://community.n8n.io/u/maxT)\
**Post date:** [April 15, 2021, 3:07pm UTC](https://community.n8n.io/t/crypto-module-encrypt-decrypt/4497/16 "2021-04-15T15:07:14Z")

</div>

Unfortunately I do not have a hard estimate at this time - will reach out directly to see what we can do.

---

<div class="post-metadata">

**Author:** ![maxT](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/maxt/32/31233_2.png) [@maxT](https://community.n8n.io/u/maxT)\
**Post date:** [April 15, 2021, 3:35pm UTC](https://community.n8n.io/t/crypto-module-encrypt-decrypt/4497/17 "2021-04-15T15:35:18Z")

</div>

For visibility, here’s what we’re doing on n8n.cloud to get `crypto` available faster:

Adding `crypto` was originally in a ticket with multiple other libs that required a security audit before being deployed. We’ve now moved `crypto` to it’s own ticket and moved it up the board - so should be out relatively soon.

Thanks!

---

<div class="post-metadata">

**Author:** ![JOSE\_ALEJANDRO\_DIAZ](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jose_alejandro_diaz/32/2477_2.png) [@JOSE\_ALEJANDRO\_DIAZ](https://community.n8n.io/u/JOSE_ALEJANDRO_DIAZ)\
**Post date:** [June 18, 2021, 9:58pm UTC](https://community.n8n.io/t/crypto-module-encrypt-decrypt/4497/18 "2021-06-18T21:58:22Z")

</div>

Can we mark this thread as closed?

---

<div class="post-metadata">

**Author:** ![maxT](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/maxt/32/31233_2.png) [@maxT](https://community.n8n.io/u/maxT)\
**Post date:** [June 21, 2021, 6:37am UTC](https://community.n8n.io/t/crypto-module-encrypt-decrypt/4497/19 "2021-06-21T06:37:14Z")

</div>

@JOSE_ALEJANDRO_DIAZ good call, closing the topic since the functionality is deployed to n8n.cloud. Thanks!

---

<div class="post-metadata">

**Author:** ![maxT](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/maxt/32/31233_2.png) [@maxT](https://community.n8n.io/u/maxT)\
**Post date:** [June 21, 2021, 6:37am UTC](https://community.n8n.io/t/crypto-module-encrypt-decrypt/4497/20 "2021-06-21T06:37:17Z")

</div>

Closed on June 21, 2021, 6:37am UTC


