# Encrypting communication between 2 RPIs

**URL:** <https://community.zymbit.com/t/encrypting-communication-between-2-rpis/1642>\
**Category:** Uncategorized\
**Created:** [March 14, 2024, 8:12pm UTC](https://community.zymbit.com/t/encrypting-communication-between-2-rpis/1642 "2024-03-14T20:12:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mr123](https://avatars.discourse-cdn.com/v4/letter/m/c2a13f/32.png) [@Mr123](https://community.zymbit.com/u/Mr123)\
**Post date:** [March 14, 2024, 8:12pm UTC](https://community.zymbit.com/t/encrypting-communication-between-2-rpis/1642/1 "2024-03-14T20:12:44Z")

</div>

I have scattered your forums trying to look for an answer but after having read through [Same Encryption key for 2 Zymkeys](https://community.zymbit.com/t/same-encryption-key-for-2-zymkeys/115) I was not able to find an answer.

In essence, what Im trying to do is to set up a client-server communication method where a message that is sent from a client RPI is first encrypted and decrypted when it arrives at the server RPI. Is this at all possible considering that the RPIs have two different ZymKeys installed?

This is a rough sketch of my scripts so far, I hope it gives more insight into what Im trying to do.  
Client-side-script:  
 ![client](https://canada1.discourse-cdn.com/flex027/uploads/zymbit/original/2X/f/f996c48eacb1a6849a2860a37b2f3731694195fc.png)

Server-side-script:  
 ![server](https://canada1.discourse-cdn.com/flex027/uploads/zymbit/original/2X/a/abbf7ed18a5a24de76c7099bbcc72bc261349e3f.png)

When I run these scripts I get the following error:

 ![error](https://canada1.discourse-cdn.com/flex027/uploads/zymbit/original/2X/c/c6ab93b914571df8b6ddf19d652f7de851185612.png)

I am very new to this so any advice would be greatly appreciated. Sorry if my question doesnt make sense:)

---

<div class="post-metadata">

**Author:** ![Mr123](https://avatars.discourse-cdn.com/v4/letter/m/c2a13f/32.png) [@Mr123](https://community.zymbit.com/u/Mr123)\
**Post date:** [March 19, 2024, 10:36am UTC](https://community.zymbit.com/t/encrypting-communication-between-2-rpis/1642/2 "2024-03-19T10:36:57Z")

</div>

Any suggestions? 🙂 I havent found a way to make this work yet.

---

<div class="post-metadata">

**Author:** ![Bob\_of\_Zymbit](https://avatars.discourse-cdn.com/v4/letter/b/82dd89/32.png) [@Bob\_of\_Zymbit](https://community.zymbit.com/u/Bob_of_Zymbit)\
**Post date:** [March 19, 2024, 3:03pm UTC](https://community.zymbit.com/t/encrypting-communication-between-2-rpis/1642/3 "2024-03-19T15:03:18Z")

</div>

@Mr123 This is not possible with a Zymkey. The private keys are unique to each Zymkey. You can only lock/unlock data blobs on the particular Zymkey itself. You would have to leave your data locked until returning to the first Zymkey to unlock.

---

<div class="post-metadata">

**Author:** ![Mr123](https://avatars.discourse-cdn.com/v4/letter/m/c2a13f/32.png) [@Mr123](https://community.zymbit.com/u/Mr123)\
**Post date:** [March 20, 2024, 3:11pm UTC](https://community.zymbit.com/t/encrypting-communication-between-2-rpis/1642/4 "2024-03-20T15:11:08Z")

</div>

So there is no work-around or different way to write these scripts to make communication possible using a ZymKey? Can I not generate a key pair between the client and server and have it so the **client** encrypts the data using the server’s public key, and then the **server** decrypts the data using its private key?
