Pymesh supports several levels of encryption.
Each node (Lopy/Fipy) initializes Pymesh with a 128 bits Masterkey. This is used in:
End to end encryption is used when Node A wants to communicate securely/secretly with Node B. The data packets will be routed by other nodes, but the actual message can’t be decrypted by any middle Node.
This encryption can be used even for communicating between Nodes that are not in the same mesh, as message is encrypted until destination. For example, in the next picture, Node A can communicate encrypted with Node C.
The challenge is in distributing the keys used for encryption(decryption), this is
Symmetric-key algorithms are algorithms for cryptography that use the same cryptographic keys for both encryption of plaintext and decryption of ciphertext. More info could be checked on Symmetric-key algorithm.
A micropython example script can be seen here using AES 128, 192 or 256 bits keys (crypto.AES
class).
Public-key cryptography, or asymmetric cryptography, is a cryptographic system that uses pairs of keys: public keys which may be disseminated widely, and private keys which are known only to the owner. More info could be checked on Public-key cryptography.
A micropython example script can be seen here using RSA 2048 bits keys (crypto.rsa_encrypt()
method).