1
16 진수로 인코딩 된 비밀번호를 사용하여 암호화 된 테이블에 bytea로 정의 된 열이 있습니다.Npgsql이 pgp_sym_decrypt 쿼리를 처리하지 않습니다. 명령 줄에서 작동합니다.
다음과 같이 나는 퍼티으로부터 데이터를 읽을 수 있습니다
SELECT pgp_sym_decrypt(_encypted_text, E'\\x465af9b6f0ea0207188236e8698c76772f4fedcbc39fabf29c2c4d98b23d4e72') FROM msg;
pgp_sym_decrypt
------------------
This is the text
(1 row)
을 그러나 나는 그것이 예외가 발생 동일한 쿼리 실행 Npgsql를 사용할 때 :
이Npgsql.PostgresException: 39000: Wrong key or corrupt data
내가 사용하고 코드는입니다
// create new connection
con = new NpgsqlConnection(m_ConnectString);
// setup certificate handler
con.UserCertificateValidationCallback = theUserCertificateValidationCallback;
// setup query string
strQuery = "SELECT pgp_sym_decrypt(_encypted_text, E'\\x465af9b6f0ea0207188236e8698c76772f4fedcbc39fabf29c2c4d98b23d4e72') FROM msg ";
// create a new comnmand using the query and connection
cmd = new NpgsqlCommand(strQuery, con);
// open the connection
con.Open();
// execute the query
reader = cmd.ExecuteReader();
마지막 줄에 Exception 처리기가 이동합니다.
두 인터페이스가 다르게 작동하는 이유는 무엇입니까? Npgsql을 통해 어떻게 해독 할 수 있습니까?