pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Craig Ringer <craig@postnewspapers.com.au>
To: Jeffrey Baker <jwbaker@gmail.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: JDBC SSL with postgresql
Date: Thu, 03 Jun 2010 14:19:19 +0800
Message-ID: <4C074967.2090305@postnewspapers.com.au> (raw)
In-Reply-To: <AANLkTim91O5GEynBfhjXZUaJM4Wp0YHtvKFf-iTWAFU5@mail.gmail.com>
References: <AANLkTikptvIa8hE5J_9lzqIwZYuQ7AMHLQIiZh8uAFEn@mail.gmail.com>
	<AANLkTim91O5GEynBfhjXZUaJM4Wp0YHtvKFf-iTWAFU5@mail.gmail.com>

On 3/06/2010 12:08 PM, Jeffrey Baker wrote:
> On Wed, Jun 2, 2010 at 5:46 PM, Jeffrey Baker<jwbaker@gmail.com>  wrote:
>> I was interested in this[1] work on SSL client certs for JDBC, but I
>> see the author stopped working on your project.  I hope the list can
>> give me a quick clue, because i've been banging my head against this
>> all day.
>
> Just to update the list, I did figure this out.  Turns out I hadn't
> imported my private key into the keystore file.  Which, in turn, is a
> ridiculous pain in the butt because keytool can only deal with private
> keys it generated, or those in PKCS#12 files, and in fact only in
> PKCS#12 files protected with passwords.

It's often easier to just point the keyStore directly at a PKCS#12 file 
using the javax.net.ssl.trustStoreType=pkcs12 system property.

> Furthermore once the key is
> in the keystore it must also have a password there (keystore password
> as well as key password) or the implementation will refuse to use it!

And both passwords must be the SAME.

> # openssl pkcs12 -export -out client.pkcs12 -in client.cert -inkey client.key
> # keytool -importkeystore -deststorepass changeit -destkeystore
> client.jks -srckeystore client.pkcs12 -srcstorepass changeit
> -srcstoretype PKCS12 -alias 1 -destkeypass changeit

Generally, you are better off using keytool to generate the key and a 
certificate request, getting that certificate request signed by the CA, 
and importing the reply into your keystore.

--
Craig Ringer



view thread (7+ messages)

Message-ID: <4C074967.2090305@postnewspapers.com.au>
Permalink:  ../4C074967.2090305@postnewspapers.com.au/
Also on:    postgresql.org/message-id/4C074967.2090305@postnewspapers.com.au

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: craig@postnewspapers.com.au, jwbaker@gmail.com
  Subject: Re: JDBC SSL with postgresql
  In-Reply-To: <4C074967.2090305@postnewspapers.com.au>
  References: <AANLkTikptvIa8hE5J_9lzqIwZYuQ7AMHLQIiZh8uAFEn@mail.gmail.com> <AANLkTim91O5GEynBfhjXZUaJM4Wp0YHtvKFf-iTWAFU5@mail.gmail.com> <4C074967.2090305@postnewspapers.com.au>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox