Re: pgjdbc is not working with PKCS8 certificates with password

From: just madhu <justvmadhu(at)gmail(dot)com>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: pgjdbc is not working with PKCS8 certificates with password
Date: 2024-02-07 11:42:06
Message-ID: CALwjh=SbLe7QvVsnMVmZ-4GCEPQen9HuQg0ZZYFmRkHV+OPufw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On further investigation,

*With certificate generated as below. JDBC connection is successful.openssl
pkcs8 -topk8 -inform PEM -in client.key -outform DER -out client.pk8
-passout pass:foobar * -v1 PBE-MD5-DES

But a connection from pgAdmin (connection failed:
\SSLCerts\pk8_pass\client_pass_PBE.pk8": no start line) and psql(psql:
error: could not load private key file "client_pass_PBE.pk8": unsupported)
is failing

Is there a common way in which certificate with passwords can be created
for both libpq and jdbc ?

On Wed, Feb 7, 2024 at 3:17 PM just madhu <justvmadhu(at)gmail(dot)com> wrote:

> Hi ,
>
> postgresql-42.7.1.jar
>
> Trying to use establish a connection using PKCS8 certificate created with
> password.
>
>
> *openssl pkcs8 -topk8 -inform PEM -in client.key -outform DER -out
> client.pk8 -passout pass:foobar*
>
> I set the properties as below:
> *...*
>
> *sslProperties.setProperty("sslkey",
> "client.pk8");sslProperties.setProperty("sslpassword","foobar");*
> *...*
>
> *Connection connection = DriverManager.getConnection(jdbcUrl,
> sslProperties);*
> *....*
> *This is failing with the error:*
>
>
>
>
> *org.postgresql.util.PSQLException: SSL error: Connection reset at
> org.postgresql.ssl.MakeSSL.convert(MakeSSL.java:43) at
> org.postgresql.core.v3.ConnectionFactoryImpl.enableSSL(ConnectionFactoryImpl.java:584)
> at
> org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:168)*
> *...*
>
> Regards,
> Madhu
>
>

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tender Wang 2024-02-07 11:54:33 Re: BUG #18314: PARALLEL UNSAFE function does not prevent parallel index build
Previous Message just madhu 2024-02-07 09:47:06 pgjdbc is not working with PKCS8 certificates with password

Browse pgsql-hackers by date

  From Date Subject
Next Message Dilip Kumar 2024-02-07 11:58:41 Re: Synchronizing slots from primary to standby
Previous Message Jeevan Chalke 2024-02-07 11:36:08 Re: recently added jsonpath method change jsonb_path_query, jsonb_path_query_first immutability