is there any example code AES128 or AES256 ESP8266 & Javascript to test
Yes, there is.
where is the codes?
Well hidden in the search engines; but can use this verry clever hack to get a glimps of the truth:
I am looking for string AES encryption & decryption (arduino) also with javascript
I did not find an example
Would be helpful if you said that in that your initital posting. I will once again lift the curtains of secret hidden knowledge :
sorry, not found an example of AES arduino & javascript
it is appreciated if someone post an example:
arduino side encrypt & decrypt a string
javascript side encrypt & decrypt a string
What about reading through the first 5 links that the search engine gives you? e.g. link#3: GitHub - ricmoo/aes-js: A pure JavaScript implementation of the AES block cipher and all common modes of operation for node.js or web browsers. .. or link #5: AES (Advanced Encryption Standard) JavaScript implementation in Counter Mode | Movable Type Scripts b... or AES Implementation in JavaScript ยท GitHub or ...
thanks for your effort but till now not find a simple complete example for arduino & javascript encryption & decryption
Did you even look at the links and read the code?
I did javascript part to encrypt test text
var key = CryptoJS.enc.Utf8.parse('aaaa'); // Use Utf8-Encoder.
var iv = CryptoJS.enc.Utf8.parse('bbbb'); // Use Utf8-Encoder
var encryptedCP = CryptoJS.AES.encrypt("test", key, { iv: iv });
result is :
Ciphertext (Base64) : 89YcYC/jZO7HMZbfH3m0Ig==
so next step how to decrypt the result with arduino to get string as test
Oh my, you still have not found out how a search engine works?
I found this code but output data not match CBC 128
output datat on serial monitor : Encrypted Data output: G0mLqei+/SEJWQ1KfvfWxw==
it must be as : Z3w+lafrG3kjdxiHfopsdA==
how to fix this issue?
Did you check whether the library knows what to do with a String?
Strings have no place in Arduino encryption, and should be avoided because they cause memory problems and even program crashes.
as above code filling method as custom zero padding so how to convert filling method to pkcs7padding
When you decode "G0mLqei+/SEJWQ1KfvfWxw==", what is the result?
arduino
So encoding and decoding work as expected ?
Why do you think the encoding should return "Z3w+lafrG3kjdxiHfopsdA==" and not "G0mLqei+/SEJWQ1KfvfWxw==" ?
the result from esp8266 must be as :
Z3w+lafrG3kjdxiHfopsdA==
because other side javascript padding pkcs7 will decode the encrypted data from esp8266
Then what does it decode from "Z3w+lafrG3kjdxiHfopsdA==" and "G0mLqei+/SEJWQ1KfvfWxw==" ?