开发者

AES_Encrypt : Password getting reset automatically

I am using AES_Encrypt('123456',开发者_如何学编程2) to store my password in db in encrypted format.

I have noticed that after some time the password stored in db automatically gets reset to NULL. I have cross checked this by using AES_Decrypt.

I don't know why is this happening. I am not updating my password anywhere in the code. Then I am wondering how come and when is the password getting reset. Does it has anything to do with the AES_Encrypt?


Assuming that you are referring to the MySQL AES_ENCRYPT and AES_DECRYPT routines I will direct you to the reference which states that

AES_ENCRYPT() encrypts a string and returns a binary string. AES_DECRYPT() decrypts the encrypted string and returns the original string. The input arguments may be any length. If either argument is NULL, the result of this function is also NULL.

If AES_DECRYPT() detects invalid data or incorrect padding, it returns NULL. However, it is possible for AES_DECRYPT() to return a non-NULL value (possibly garbage) if the input data or the key is invalid.

Is it possible that either of your functions could be getting supplied with invalid data or incorrect padding?

Additionally, the AES_ENCRYPT function may pad your data out to a specific length. Ensure you are not truncating to fit within your database

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜