1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

mysql des-key-file の設定方法

Last updated at Posted at 2015-11-25

DBダンプされても暗号化したカラムが読めないようにする為に調査。
AESで暗号化したかったけど、外部キーが設定出来ないのでdesで暗号化することにした。
des_decrypt,des_encrptは外部ファイルにキーが置けるので暗号強度は置いといて
こっちの設定を調査した。
確認したのは、centos6 mysql 5.1.73

des-key-fileの設定方法

暗号キーファイルを用意する

今回は /etc/deskey.txt で説明

/etc/deskey.txt
0 hoge

mysqlの設定

/etc/my.cnf
の[mysqld]の下に←ここが重要
最終行に追加してハマった

/etc/my.cnf
# des key file
des-key-file=/etc/deskey.txt

を追加

確認方法

sql
select convert(des_decrypt(des_encrypt('au'),'hoge') using utf8)

誰か教えて

設定ファイルが変更になり、暗号化キーが変わっているのは確認できたんだけど
数字を引数にすると複合化できない...なんでだろう
その内調べる予定

sql
select convert(des_decrypt(des_encrypt('au',0),'hoge') using utf8)

↑これはOK

sql
select convert(des_decrypt(des_encrypt('au',0),0) using utf8)

↑これはNG
んんんんんん、誰か知ってたら教えて

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?