현재 적용중인 모드를 확인한다.
디폴트는 aes-128-ecb이다.
SELECT @@session.block_encryption_mode;
아래 명령어로 모드를 변경할 수 있다.
SET block_encryption_mode = 'aes-128-ecb';
SET block_encryption_mode = 'aes-256-ecb';
변경 후 실행결과를 살펴보자.
SELECT
AES_ENCRYPT('hi', SHA2(CONCAT('key1','key2'), 256)),
TO_BASE64(AES_ENCRYPT('hi', SHA2(CONCAT('key1','key2'), 256)))
;
참고)
https://dev.mysql.com/doc/refman/5.7/en/encryption-functions.html#function_aes-encrypt
MySQL :: MySQL 5.7 Reference Manual :: 12.14 Encryption and Compression Functions
12.14 Encryption and Compression Functions Many encryption and compression functions return strings for which the result might contain arbitrary byte values. If you want to store these results, use a column with a VARBINARY or BLOB binary string data type
dev.mysql.com
'Server > DB' 카테고리의 다른 글
MySQL) M1 macbook MySQL 완전 삭제 (0) | 2023.02.27 |
---|---|
MySQL) 시작하기 (0) | 2023.01.31 |
MySQL) AES128 사용하기 (0) | 2023.01.27 |
MySQL) Union으로 full outer join에서 rownum으로 페이지네이션 구현하기. (0) | 2022.12.21 |
Mysql) USE INDEX로 인덱싱하여 조회하기 (0) | 2022.11.14 |