[general] Error while decrypting using pgp

From: VENKTESH GUTTEDAR <venkteshguttedar(at)gmail(dot)com>
To: PostgreSQL mailing lists <pgsql-general(at)postgresql(dot)org>
Subject: [general] Error while decrypting using pgp
Date: 2014-11-19 10:49:31
Message-ID: CA+iwz4=vGqQL9K5FAMrx2=RkLD5ad-TF4cYA-uihH5ODbfKn+w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello,

I am running postgresql 9.3.5 on Ubuntu14.04.

i have the table two fields of varchar type. while inserting the data
in the following way.

INSERT INTO testusers(username, phone_no)
SELECT pgp_sym_encrypt(test.username, keys.pubkey),
pgp_sym_encrypt(test.phone_no, keys.pubkey) As cc
FROM (VALUES ('abcd', '9876543210')
) As test(username, cc)
CROSS JOIN (SELECT armor('DC35GT67'') As pubkey) As keys;

it is encrypting the data.
when i say SELECT * FROM testusers;
i get these values.

username =
\xc30d04070302624fc5146ba1304a63d2360165b2c8c7e5d48cea7673c66f0ddb5ecef4eafe146797b70f4df028a257847e9de6b1eccaf974639b27a01fbb5b42e24f14fb17eba5
phone_no =
\xc30d0407030284f6b57ae1c2d57369d23701cd705d5c6da32570c3f0ca9aaf2625a5bfbdcb439959674c6c5be879f8c42fd24ac2eba99648b853e6b37977560f52118c9ee7bb0d49

But when i say
SELECT pgp_sym_decrypt(phone_no, keys.privkey),
pgp_sym_decrypt(username, keys.privkey) As Phonedecrypt FROM testusers
CROSS JOIN (SELECT armor('DC35GT67'') As privkey) As keys;

i am getting this error

ERROR: function pgp_sym_decrypt(character varying, text) does not exist
LINE 1: SELECT pgp_sym_decrypt(phone_no, keys.privkey),
pgp_sym_decrypt(us...
^
HINT: No function matches the given name and argument types. You might
need to add explicit type casts.

Can anyone tell me where i am going wrong. and if not then what explicit
type casts i have to add.?

please help thanks in advance.

--
Regards :
Venktesh Guttedar.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ernesto Quiñones 2014-11-19 11:54:46 postgresql for small business
Previous Message Francisco Olarte 2014-11-19 08:24:12 Re: About the tps explanation of pgbench, please help