encryption, block cipher, simple (micro-)pythonic way to access

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
Post Reply
ulno
Posts: 9
Joined: Tue Mar 22, 2016 9:37 am
Contact:

encryption, block cipher, simple (micro-)pythonic way to access

Post by ulno » Fri Sep 15, 2017 4:19 pm

I am working on a replacement for webrepl (based on utelnet) using a symmetric encryption layer. My assumption is that every node I am maintaining has a unique "secret" key used as base for the symmetric encryption. I consider this safer than SSL with non working certificate validation. Most of my nodes will be ESP8266 based - in the future some might be esp32.

I found a couple of pure AES python implementations as well as implementations for speck, simon, and salsa20. I think I could adapt these to micropython. I was considering trying to access AES from axtls - as it is compiled into the firmware, but have no idea how to do so.

Do you have any pointers or suggestions for me how to start, maybe there is even somewhere a simple, secure, and lean symmetric block cipher somewhere available for micropython (however, I did not find it yet) or an easy way to access the block cipher form axtls.

Speed is not too important as it's mainly for communication with the repl - however code size and memory consumption is.


Potential pure implementations which could be converted:

- https://github.com/ricmoo/pyaes
- https://github.com/boppreh/aes
- https://github.com/inmcm/Simon_Speck_Ci ... ter/Python
- http://www.tiac.net/~sw/2010/02/PureSalsa20/index.html

ajie_dirgantara
Posts: 81
Joined: Fri Sep 02, 2016 9:26 am

Re: encryption, block cipher, simple (micro-)pythonic way to access

Post by ajie_dirgantara » Mon Oct 09, 2017 8:53 am

here one quick port of pyaes :

viewtopic.php?f=2&t=3782&p=21951#p21948

ulno
Posts: 9
Joined: Tue Mar 22, 2016 9:37 am
Contact:

Re: encryption, block cipher, simple (micro-)pythonic way to access

Post by ulno » Mon Oct 09, 2017 2:56 pm

Thanks, need to take a closer look - I ported a native chacha implementation now, but as it's native, it's pretty slow of course (but workable for a command prompt):
https://github.com/ulno/ulnoiot/blob/ma ... /chacha.py

If anybody wants to try, you can also use the provided netrepl to do encrypted console access and file updates with upy, but I will post about this here in the forum, after I finish teaching my IoT introduction class this month:
https://github.com/ulno/ulnoiot/tree/master/lib/netrepl

Post Reply