spaniakos / AES

AES for microcontrollers (Arduino & Raspberry pi)
http://spaniakos.github.io/AES/
GNU Affero General Public License v3.0
126 stars 56 forks source link

do_aes_decrypt() returns plain text which is having more size then the actual plain text used to encrypt. #17

Closed arihantdaga closed 6 years ago

arihantdaga commented 7 years ago

Step 1 . i did do_aes_encrypt(). Step 2. base64 encode the obtained cipher.

Then on the obtained cipher i did base64_decode(). then i did do_aes_decrypt() with the base64 decode cipher and iv obtained in previous steps. the resultint plain text obtained from this is of length 80 while the plain text used before Step 1 was only 76 characters long. this is causing further issues when my decoded string looks like this {"my message"} ????.

spaniakos commented 7 years ago

please sent me the code used so i can test it. you can sent it to my e-mail spaniakos@gmail.com

thank you

On Thu, Jul 20, 2017 at 11:46 PM, arihant daga notifications@github.com wrote:

Step 1 . i did do_aes_encrypt(). Step 2. base64 encode the obtained cipher.

Then on the obtained cipher i did base64_decode(). then i did do_aes_decrypt() with the base64 decode cipher and iv obtained in previous steps. the resultint plain text obtained from this is of length 80 while the plain text used before Step 1 was only 76 characters long.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/spaniakos/AES/issues/17, or mute the thread https://github.com/notifications/unsubscribe-auth/ABnM6sOk8-wvsepRbfQmcOkNsCiS3Azhks5sP7ysgaJpZM4Oepj9 .

arihantdaga commented 7 years ago

There is one more bug now.. Encrypting and decrypting of this message results into this- {"temphumid":"12,12"} -> encrypt -> decrypt again -> {"temphumid":"12,12"?⸮⸮⸮ It also happens if i have 2 consecutive "}}" in the end of the string. I have emailed you @spaniakos

spaniakos commented 7 years ago

iteresting , what board are you using?

On Sat, Jul 29, 2017 at 8:51 AM, arihant daga notifications@github.com wrote:

There is one more bug now.. Encrypting and decrypting of this message results into this- {"temphumid":"12,12"} -> encrypt -> decrypt again -> {"temphumid":"12,12"?⸮⸮⸮ It also happens if i have 2 consecutive "}}" in the end of the string

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/spaniakos/AES/issues/17#issuecomment-318806759, or mute the thread https://github.com/notifications/unsubscribe-auth/ABnM6tWOujUv4l0yPMaANlvPvFuA2rOHks5sSshtgaJpZM4Oepj9 .

arihantdaga commented 7 years ago

ESP8266 12E

spaniakos commented 7 years ago

as expected. there is a bug with ESP8266. I bought mine a couple fo days ago, but i am leaving for vacation in some days.

by the end of august i will fully support ESP8266

On Mon, Jul 31, 2017 at 7:25 AM, arihant daga notifications@github.com wrote:

ESP8266 12E

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/spaniakos/AES/issues/17#issuecomment-318964282, or mute the thread https://github.com/notifications/unsubscribe-auth/ABnM6oAtNXartObRflJlUa4VbkHpOW87ks5sTVdQgaJpZM4Oepj9 .

arihantdaga commented 7 years ago

@spaniakos Any Updates on it bro ?

spaniakos commented 7 years ago

Sunday i finish my vacations. Shortly after i will publish an update.

On Aug 17, 2017 9:51 AM, "arihant daga" notifications@github.com wrote:

@spaniakos https://github.com/spaniakos Any Updates on it bro ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/spaniakos/AES/issues/17#issuecomment-322984466, or mute the thread https://github.com/notifications/unsubscribe-auth/ABnM6tdCu9l-zZq01HhQQ8kaNMRauV4Gks5sY-LrgaJpZM4Oepj9 .

arihantdaga commented 7 years ago

Is there a formula to predict max cipher size for a given length of message ? For example if in the following code i dont have to use buffer of size 1000 instead i can allocate buffer based on the msg size. ?

void encryptMsg(const char* msg, char data_encoded[],char iv_encoded[]){

    char b64data[200];
    byte cipher[1000];
....
...
}
yhua537 commented 7 years ago

AES has the same size of input and output.

Edit: Just to clarify, what I mean is the AES is expected to have the same size of input + padding = output.

arihantdaga commented 7 years ago

@yhua537 What do u mean by size of input and output.. ? Input and out to do_aes_encrypt() or do_aes_decrypt() ? Can u explain ur situation better ?

spaniakos commented 7 years ago

I would need a sample code and output in order to comment on that.

Thank you

On Sep 10, 2017 20:18, "arihant daga" notifications@github.com wrote:

@yhua537 https://github.com/yhua537 What do u mean by size of input and output.. ? Input and out to do_aes_encrypt() or do_aes_decrypt() ? Can u explain ur situation better ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/spaniakos/AES/issues/17#issuecomment-328357360, or mute the thread https://github.com/notifications/unsubscribe-auth/ABnM6jc_iDkLnzaa_-2QeRAY2_h6YwFIks5shBnYgaJpZM4Oepj9 .

arihantdaga commented 6 years ago

Any Update on the this... ? The issue still persists...

arihantdaga commented 6 years ago

I think the issue is somewhat with the code only.. Closing for now..

spaniakos commented 6 years ago

no updates as i am still traveling for some work... There have been some long months, but by the end of the week i return to my base station (Home)! :D thank you for your patience.

On Mon, Dec 4, 2017 at 8:25 PM, arihant daga notifications@github.com wrote:

Closed #17 https://github.com/spaniakos/AES/issues/17.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/spaniakos/AES/issues/17#event-1371198779, or mute the thread https://github.com/notifications/unsubscribe-auth/ABnM6pBvSlpt9x9C-9FRf-yQWp2OovjOks5s9EcigaJpZM4Oepj9 .