Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id A583C6331B7 for ; Thu, 3 Jun 2010 02:50:28 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 76739-10 for ; Thu, 3 Jun 2010 05:50:21 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from www.postnewspapers.com.au (www.postnewspapers.com.au [202.4.227.11]) by mail.postgresql.org (Postfix) with ESMTP id B48DF632E07 for ; Thu, 3 Jun 2010 02:50:21 -0300 (ADT) Received: from mail.postnewspapers.com.au (202-89-185-120.static.dsl.amnet.net.au [202.89.185.120]) by www.postnewspapers.com.au (Postfix) with ESMTP id 8F2E6A2AB; Thu, 3 Jun 2010 13:50:10 +0800 (WST) Received: from localhost (localhost [127.0.0.1]) by mail.postnewspapers.com.au (Postfix) with ESMTP id 58605AF2C1; Thu, 3 Jun 2010 13:48:31 +0800 (WST) X-Virus-Scanned: Debian amavisd-new at postnewspapers.com.au Received: from mail.postnewspapers.com.au ([127.0.0.1]) by localhost (mail.postnewspapers.com.au [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 7g5UWy3cAKLS; Thu, 3 Jun 2010 13:48:25 +0800 (WST) Received: from [10.1.1.7] (124-148-251-30.dyn.iinet.net.au [124.148.251.30]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "Craig Ringer", Issuer "POST Certificate Authority" (verified OK)) by mail.postnewspapers.com.au (Postfix) with ESMTPSA id CBE92AF2BF; Thu, 3 Jun 2010 13:48:25 +0800 (WST) Message-ID: <4C074292.8010208@postnewspapers.com.au> Date: Thu, 03 Jun 2010 13:50:10 +0800 From: Craig Ringer User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.1.9) Gecko/20100317 Thunderbird/3.0.4 MIME-Version: 1.0 To: Jeffrey Baker CC: pgsql-jdbc@postgresql.org Subject: Re: JDBC SSL with postgresql References: <4C0712E6.1050002@postnewspapers.com.au> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.011 tagged_above=-10 required=5 tests=BAYES_40=-0.001, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201006/33 X-Sequence-Number: 20603 On 3/06/2010 11:06 AM, Jeffrey Baker wrote: > Thanks for the info. > > I have complete control of both ends, and both the server and client > are signed by my self-signed root cert. I think perhaps the problem > here is that I'm trying to tackle the entire Java SSL infrastructure > in one go; I knew nothing about it this morning. I read somewhere > that the keystore has to include both the client cert and the root > cert that signed it. Is that not true? No, it's not strictly true, but it's a good idea. However, "include" is pretty broad. When you get a reply from your certificate authority containing the signed certificate, it should include the full certificate chain in that reply. If it doesn't, you should append the CA cert and any other intermediate certs to the reply before importing it with keytool. So, when you use keytool to list your keystore, you should only see one entry (alias). The certificate part of that entry should preferably include the full certificate chain up to the CA certificate, though. Your truststore should contain only trustedCertificate aliases for the CA certs you trust to identify peers. > I've tried it both ways: > added root cert, then added client cert (this is the way it's > documented in the keytool manual page, the way I interpret it), and > only adding the client cert to the keystore. It doesn't seem to work > either way. Concatenate all certs in the chain into one file, and import that. -- Craig Ringer