Re: bytea field, a c function and pgcrypto driving me mad - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: bytea field, a c function and pgcrypto driving me mad
Date
Msg-id 20081030182211.GA21451@svana.org
Whole thread Raw
In response to bytea field, a c function and pgcrypto driving me mad  (Glyn Astill <glynastill@yahoo.co.uk>)
Responses Re: bytea field, a c function and pgcrypto driving me mad  (Glyn Astill <glynastill@yahoo.co.uk>)
List pgsql-general
On Thu, Oct 30, 2008 at 05:27:58PM +0000, Glyn Astill wrote:
> Hi chaps,
>
> I think I'm going to struggle to describe this, but hopefully someone can squint and see where I'm going wrong.
>
> I've got a c function called "ftest", all it does is take some text and prepend "abcdefghijklmnopqr" onto it. I use
itto pass a key into pgp_sym_encrypt/decrypt working on a bytea field in a table. The problem is that once the string I
passto "ftest" is longer than 10 characters it stops working when I use it with the bytea column and pgp_sym_decrypt,
butit appears to work fine on it's own. 
>
> 1) The source is here:
>
> http://privatepaste.com/890Bj3FGW0

ISTM that in this line:

keying = (text *)palloc( keylen + unamelen );

You forgot to include the length of the header VARHDRSZ.

Have  anice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Please line up in a tree and maintain the heap invariant while
> boarding. Thank you for flying nlogn airlines.

Attachment

pgsql-general by date:

Previous
From: Chris Browne
Date:
Subject: Re: Are there plans to add data compression feature to postgresql?
Next
From: Joao Ferreira gmail
Date:
Subject: speed up restore from dump