質問

I'm using PostgreSQL-11 and I've been given a text string to decrypt as a test. I've got the details of how it was encrypted and its very simple. When I try to decrypt using select pgp_sym_decrypt(text::bytea,'the key','cipher-algo=aes256') I get the error Wrong key or corrupt data. I can't use the decrypt function because I get the error cipher algorithm is not available. What am I doing wrong?

役に立ちましたか?

解決

If you are using the format specified by PGP, then the algo used for encryption is stored in the header, and that of course will be used for decryption. Trying to manually specify a algo to use for decryption is pointless.

Here is a working example of encryption and decryption:

select pgp_sym_decrypt(
    pgp_sym_encrypt('foobar','the key','cipher-algo=aes256'),
    'the key'
);
ライセンス: CC-BY-SA帰属
所属していません dba.stackexchange
scroll top