In our database, credit card number is encrypted, to store encrypted data in postgresql database we are doing following way.
\set pubkey '''' `sed -e "s/'/''/g" -e 's/\\n/\\r\\n/g' -e 's/\\/\\\\/g' < /home/vinit/fnpub.key` ''''
\set pvtkey '''' `sed -e "s/'/''/g" -e 's/\\n/\\r\\n/g' -e 's/\\/\\\\/g' < /home/vinit/fnpvt.key` ''''
select pgp_pub_decrypt(number, dearmor(:pvtkey),'testypassword' ) from payment_detail limit 2;
Application is using hibernate, how to insert data with encryption and read decrypted data using hibernate?
Thanks!!