suculent / thinx-aes-lib

AES wrapper for ESP8266/ESP32/Arduino/nRF5x
Other
118 stars 37 forks source link

Example "Simple" does not / can not work. #74

Open JaBa1202 opened 1 year ago

JaBa1202 commented 1 year ago

Running the example will ALWAYS report success but it is a false success report. Even if you change the line decLen = decrypt(...) to decLen = 0, it will report a successful decrypt though it didn't even decrypt it. Actually, I don't think it could ever work. The library indicates that encrypt and decrypt DO NOT use Base64 encoding but the example "simple" does a base64 encode before calling decrypt.

adriancs2 commented 1 year ago

I have used this library and built a working example. You can have a look a my demo project: https://github.com/adriancs2/arduino.aes.asp.net

I wrote an article about the step by step implementation of this in my blog:

https://adriancs.com/c-sharp/1081/aes-encrypted-http-request-between-arduino-esp32-and-c-asp-net/

I also shared this article with codeproject:

https://www.codeproject.com/Articles/5365769/AES-Encrypted-Data-Transmission-Between-Arduino-ES

The article also show the coding in C#, but however, if C# is not relevant to you, you can skipped the C# part, only go for the C/C++ Arduino codes.

adriancs2 commented 1 year ago

Here, I have just published a simplified version of explanation of how to use this library to do AES encryption locally within the Arduino device. This should work on any Arduino boards. Since it's just pure C/C++, so technically, it should also works on any device that support C++.

Here's the article: https://adriancs.com/arduino/1096/arduino-aes-encryption-128-bits-cbc/