Re: bytea field, a c function and pgcrypto driving me mad

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Glyn Astill <glynastill(at)yahoo(dot)co(dot)uk>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: bytea field, a c function and pgcrypto driving me mad
Date: 2008-10-30 18:22:11
Message-ID: 20081030182211.GA21451@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 it to pass a key into pgp_sym_encrypt/decrypt working on a bytea field in a table. The problem is that once the string I pass to "ftest" is longer than 10 characters it stops working when I use it with the bytea column and pgp_sym_decrypt, but it 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(at)svana(dot)org> http://svana.org/kleptog/
> Please line up in a tree and maintain the heap invariant while
> boarding. Thank you for flying nlogn airlines.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joao Ferreira gmail 2008-10-30 18:25:18 speed up restore from dump
Previous Message WaGathoni 2008-10-30 17:59:28 Re: Group BY and Chart of Accounts