pgcrypto: Fix RSA password-protected keys

Lists: pgsql-hackers
From: Marko Kreen <markokr(at)gmail(dot)com>
To: Postgres Hackers List <pgsql-hackers(at)postgresql(dot)org>
Subject: pgcrypto: Fix RSA password-protected keys
Date: 2013-05-06 19:39:40
Message-ID: 20130506193940.GA3078@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

RSA secret key extraction code uses wrong variable so
that decryption is skipped and only secret keys without
password work for pgp_pub_decrypt().

Attached patch fixes it and also adds regtest.

Please apply to all branches.

Reported-by: Keith Fiske <keith(at)omniti(dot)com>

--
marko

Attachment Content-Type Size
pgcrypto-rsa-seckey.diff text/x-diff 10.5 KB

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Marko Kreen <markokr(at)gmail(dot)com>
Cc: Postgres Hackers List <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pgcrypto: Fix RSA password-protected keys
Date: 2013-05-10 16:52:55
Message-ID: 10312.1368204775@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Marko Kreen <markokr(at)gmail(dot)com> writes:
> RSA secret key extraction code uses wrong variable so
> that decryption is skipped and only secret keys without
> password work for pgp_pub_decrypt().

> Attached patch fixes it and also adds regtest.

> Please apply to all branches.

Will do, thanks for the fix!

regards, tom lane


From: Marko Kreen <markokr(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Postgres Hackers List <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pgcrypto: Fix RSA password-protected keys
Date: 2013-05-10 18:16:54
Message-ID: 20130510181654.GA28808@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Fri, May 10, 2013 at 12:52:55PM -0400, Tom Lane wrote:
> Marko Kreen <markokr(at)gmail(dot)com> writes:
> > RSA secret key extraction code uses wrong variable so
> > that decryption is skipped and only secret keys without
> > password work for pgp_pub_decrypt().
>
> > Attached patch fixes it and also adds regtest.
>
> > Please apply to all branches.
>
> Will do, thanks for the fix!

Thanks.

Re: future changelog entry

The problem is specific to RSA keys, password-protected DSA+ElGamal
keys work fine. Sorry for not mentioning it earlier.

RSA code was added later than ElGamal, and the bug is probably
because of copy-paste from public key code...

--
marko