Closed aimdharma1990 closed 5 years ago
@aimdharma1990 could please elaborate what you mean by "tried with out encryption length to use the code" ? Are you using this repo as it is or have you tweaked the code. In case you have tweaked the code, please share it, I will be happy to discuss. Thanks
@bawejakunal Thanks for the response. I am not changed the code. I have the query on the following statement. decrypt(ciphertext, k, aad, sizeof(aad), tag, key, iv, pt);
Here k is the input for the decrypt function where as its an output of the encrypt function. If want to use only decription in module I can't use this decrypt function as it's required the plain text length. If i am not passed the plain text length then its padding the junk characters also.
This my query.
@aimdharma1990 k
represents the in k = decrypt(ciphertext, k, aad, sizeof(aad), tag, key, iv, pt);
the input value of k
is the length of the ciphertext and the value returned and written back in k
is the length of plain text that is obtained after decryption. Ideally I should have named the variables in a better manner to avoid this confusion.
So without passing k
which is the cipher text length obtained on L169 the ciphertext will not be correctly decrypted because we don't really know the length of the ciphertext and hence the program reads beyond the actual length which ends up as garbage characters at end of plain text that you see.
Then with out knowing the actual plain text length we can't perform the decryption? Actually encryption and decryption should be independent module. But by getting the plain text length both getting linked .. any solution? On 18-Jan-2018 11:42 pm, "Kunal Baweja" notifications@github.com wrote:
@aimdharma1990 https://github.com/aimdharma1990 k represents the in k = decrypt(ciphertext, k, aad, sizeof(aad), tag, key, iv, pt); the input value of k is the length of the ciphertext and the value returned and written back in k is the length of plain text that is obtained after decryption. Ideally I should have named the variables in a better manner to avoid this confusion.
So without passing k which is the cipher text length obtained on L169 https://github.com/bawejakunal/AES-GCM-256/blob/master/AES.c#L169 the ciphertext will not be correctly decrypted because we don't really know the length of the ciphertext and hence the program reads beyond the actual length which ends up as garbage characters at end of plain text that you see.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bawejakunal/AES-GCM-256/issues/1#issuecomment-358732941, or mute the thread https://github.com/notifications/unsubscribe-auth/AIqGF2CO48HtrfKT6NRHRoWJPotjEKYrks5tL4k0gaJpZM4RhAae .
@aimdharma1990 like I said k
is the cipher text length and not the plain text length. The return value of decrypt
function is plain text length.
I have tried with out encryption length to use the code. its adding the junk char . How to resolve this. ?