Encrypting a hex file

Hello,

I have converted my image to hex and I have zymkey 4i on my raspberry pi. Where can I find your python API for encrypting a hex file? I have the general API documentation but I am not sure which part is related to my question. Any help is appreciated. Thanks

The APIs that you are looking for are lock and unlock. For example:

import zymkey
import filecmp

zymkey.client.lock("my_plaintext_file", "my_encrypted_file")
zymkey.client.unlock("my_encrypted_file", "my_decrypted_file")

if filecmp.cmp("my_plaintext_file", "my_decrypted_file"):
   print("PASS: original and decrypted files are the same")
else:
   print("FAIL: original and decrypted files differ")

Note that it doesn’t matter what the file contents are - hex ascii vs. straight binary is all the same for lock/unlock.

1 Like

Thanks Scott I have used those APIs and they work perfectly, however, I was wondering if I encrypt an image and send it to many receivers, if any receiver has a Zymkey4i, can they simply decrypt it back to the original image?
How can I pass a key to make sure only the trusted receiver can decrypt the file?

A file that is locked by a specific zymkey can only be unlocked by that same zymkey. This means that the file could not be decrypted by another zymkey.