I have a weird behaviour after upgrading our database server from Postgresql 12 to Postgresql 15. I created all the required extensions with pgcrypto even the same version 1.3. It looks like the pgp decryption function with pgp_pub_decrypt works differently. I am using two functions to encypt and decrypt messages:
encode(pgp_pub_encrypt(toencode, dearmor(PGPPublic)), 'hex');
pgp_pub_decrypt(decode(todecode ,'hex'), dearmor(PGPPrivate), 'banana');
It works for years with Postgresql 12 but now with Postgresql 15 I get the error message: "Wrong key or corrupt data"
I compared the results from decode, dearmor and encode and they all behave the same. The public and private key are also exactly the same on both systems.
I checked the documentation and there are no changes I can see and I can't find any other help.
Just pgp_pub_decrypt(decode(todecode ,'hex'), dearmor(PGPPrivate), 'banana');
causes problems