ERROR: Corrupt ascii-armor

Started by VENKTESH GUTTEDARover 11 years ago2 messagesgeneral
Jump to latest
#1VENKTESH GUTTEDAR
venkteshguttedar@gmail.com

Hello,

I am running PostgreSQL 9.3.5 on Ubuntu 14.04. i want to encrpty data
while storing and decrypt while retrieving it. so i am using pgcrypto to
achieve it. i have genrated the keys using gpg --gen-key.
and i have exported them to also.

I have created the table this way :

CREATE TABLE testuserscards(card_id SERIAL PRIMARY KEY, username
varchar(100), cc bytea);

and when i am trying to insert data :

INSERT INTO testuserscards(username, cc)SELECT robotccs.username,
pgp_pub_encrypt(robotccs.cc, keys.pubkey) As cc
FROM (VALUES ('robby', '41111111111111111'),
('artoo', '41111111111111112') ) As robotccs(username, cc)
CROSS JOIN (SELECT dearmor('-----BEGIN PGP PUBLIC KEY BLOCK-----
super publickey goobly gook goes here
-----END PGP PUBLIC KEY BLOCK-----') As pubkey) As keys;

i am getting the error as ERROR: Corrupt ascii-armor.

please help me to encrypt data..

or is there any other way to achieve safe encryption and decryption.?

--
Regards :
Venktesh Guttedar.

#2Jeff Janes
jeff.janes@gmail.com
In reply to: VENKTESH GUTTEDAR (#1)
Re: ERROR: Corrupt ascii-armor

On Mon, Nov 17, 2014 at 3:00 AM, VENKTESH GUTTEDAR <
venkteshguttedar@gmail.com> wrote:

INSERT INTO testuserscards(username, cc)SELECT robotccs.username,
pgp_pub_encrypt(robotccs.cc, keys.pubkey) As cc
FROM (VALUES ('robby', '41111111111111111'),
('artoo', '41111111111111112') ) As robotccs(username, cc)
CROSS JOIN (SELECT dearmor('-----BEGIN PGP PUBLIC KEY BLOCK-----
super publickey goobly gook goes here
-----END PGP PUBLIC KEY BLOCK-----') As pubkey) As keys;

Can you simplify that to the simplest case which shows the problem?
Probably just the 'select dearmor(...)'.

It doesn't like something about your public key. Since you censored that
data, there isn't much we can say about what specifically it did not like.

Cheers,

Jeff