# Create flow using aes

**URL:** <https://discourse.nodered.org/t/create-flow-using-aes/22727>\
**Category:** General\
**Created:** [6 March 2020 16:02 UTC](https://discourse.nodered.org/t/create-flow-using-aes/22727 "2020-03-06T16:02:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jabberimaher](https://avatars.discourse-cdn.com/v4/letter/j/b4bc9f/32.png) [@jabberimaher](https://discourse.nodered.org/u/jabberimaher)\
**Post date:** [6 March 2020 16:02 UTC](https://discourse.nodered.org/t/create-flow-using-aes/22727/1 "2020-03-06T16:02:14Z")

</div>

hello,  
please, i need to create flow: sensor node send encrypted data by aes and dat will be decrypted by another sensor node. During the simulation i must recuperate energy consumption and tie execution for both operations encryption and decryption. it's possible, if yes acn you help e please.....i will be very grateful

---

<div class="post-metadata">

**Author:** ![unixneo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/unixneo/32/17441_2.png) [@unixneo](https://discourse.nodered.org/u/unixneo)\
**Post date:** [7 March 2020 04:10 UTC](https://discourse.nodered.org/t/create-flow-using-aes/22727/2 "2020-03-07T04:10:08Z")

</div>

Not fully understanding what you are talking about regarding "simulation" and ""recuperate energy consumption"; but from the sound of your post, it looks like a homework assignment or school project.

As for AES, it is easy to encrypt and decrypt in Node-RED using AES. You don't really need a "third-party contrib node" for it; as you can easily do this with a few lines of Javascript in a function node.

See this post for some working function node node for Node-RED using AES (sample Javascript and PHP code):

> **[Publish and Subscribe to AES-256 Encrypted MQTT Messages to Node-RED from PHP...](https://www.unix.com/programming/283733-publish-subscribe-aes-256-encrypted-mqtt-messages-node-red-php-scripts.html)**
>
> Various Node-Red crypto modules and do not work with PHP, so to send an encrypted message from a PHP script (in this case from a Ubuntu server) to Node-RED we need our own code. After a few hours of searching, testing various libs, more testing and...

You should be able to take those examples and make AES work easily in your flow.

Maybe I simple misunderstood what you are trying to do?

---

<div class="post-metadata">

**Author:** ![jabberimaher](https://avatars.discourse-cdn.com/v4/letter/j/b4bc9f/32.png) [@jabberimaher](https://discourse.nodered.org/u/jabberimaher)\
**Post date:** [9 March 2020 12:27 UTC](https://discourse.nodered.org/t/create-flow-using-aes/22727/3 "2020-03-09T12:27:01Z")

</div>

hello,  
thanks a lot for your reply,

I explain more what i want to do:i try to measure metrics of performances for sensors node connected to gateway, so a sensor node must authenticate on a gateway to send data, the authentication contains hash operations(sha1), encryption operations(aes128) and certification rsa. First, I want create a flow containing sensor node1 send encrypted data (by AES) to sensor node2 wich will decrypt the data sent by sensor1, and i want to recuperate metrics of performances and basically the energy consumption and time execution of sensor node after executing operations encryption/decryption.

best regards.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [8 May 2020 12:27 UTC](https://discourse.nodered.org/t/create-flow-using-aes/22727/4 "2020-05-08T12:27:01Z")

</div>

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