问题描述:
报错
openGauss=> select * from creditcard_info where name = ‘joe’;
ERROR(CLIENT): failed to decrypt column encryption key
在创建全密态数据库中,使用国密SM2创建CMK,使用sm4_sm3创建cek
创建表,插入数据,
在进行数据查询时,
报错:无法解密列密钥。
但是
在使用RSA_2048创建cmk,使用AEAD_AES_256_CBC_HMAC_SHA256创建cek后,
查询数据是正常的。
所有的操作是按照官方文档执行的,唯一就是修改:RSA_2048改为sm2,AEAD_AES_256_CBC_HMAC_SHA256改为sm4_sm3
官方文档地址:
https://docs.opengauss.org/zh/docs/5.0.0/docs/BriefTutorial/%E5%85%A8%E5%AF%86%E6%80%81%E6%95%B0%E6%8D%AE%E5%BA%93.html
1、创建cmk和cek
CREATE CLIENT MASTER KEY alice_cmk WITH (KEY_STORE = localkms , KEY_PATH = “key_path_value”, ALGORITHM = sm2);
CREATE COLUMN ENCRYPTION KEY ImgCEK WITH VALUES (CLIENT_MASTER_KEY = alice_cmk, ALGORITHM = SM4_SM3);
2、创建表
CREATE TABLE creditcard_info (id_number int, name text encrypted with (column_encryption_key = ImgCEK, encryption_type = DETERMINISTIC),credit_card varchar(19) encrypted with (column_encryption_key = ImgCEK, encryption_type = DETERMINISTIC));7
3、插入数据
INSERT INTO creditcard_info VALUES (1,‘joe’,‘6217986500001288393’);
INSERT INTO creditcard_info VALUES (2, ‘joy’,‘6219985678349800033’);
4、进行查询
select * from creditcard_info where name = ‘joe’;
报错
openGauss=> select * from creditcard_info where name = ‘joe’;
ERROR(CLIENT): failed to decrypt column encryption key