Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/date/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql数据加密_Mysql_Date_Encryption - Fatal编程技术网

Mysql数据加密

Mysql数据加密,mysql,date,encryption,Mysql,Date,Encryption,我正在使用AES_ENCRYPT方法加密Mysql数据,但当我尝试对Mysql日期类型字段进行加密时,该方法不起作用。如何使用AES_encrypt加密Mysql日期字段?我已经用谷歌搜索过了,但到目前为止运气不好 来自mysql手册: AES_ENCRYPT() encrypts a string and returns a binary string. AES_DECRYPT() decrypts the encrypted string and returns the original

我正在使用AES_ENCRYPT方法加密Mysql数据,但当我尝试对Mysql日期类型字段进行加密时,该方法不起作用。如何使用AES_encrypt加密Mysql日期字段?我已经用谷歌搜索过了,但到目前为止运气不好

来自mysql手册:

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. 

这意味着您需要将加密数据存储在varchar或text类型的列中。

您需要将字符串传递给AES_ENCRYPT。将日期转换为字符串,您应该会得到答案。您的意思是日期字段应该创建为字符串字段吗?嗯,那么mysql加密功能将无助于像DOB一样加密日期字段?或者是否有任何自定义方法?对于日期类型的每个日期列“mydate”,您将创建字符串类型的列“mydate_enc”。如果您使用的是对象关系映射器,这当然会弄乱日期映射。