Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uWg3M-00HKKs-TZ for pgsql-jdbc@arkaria.postgresql.org; Tue, 01 Jul 2025 18:50:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uWg3L-007oIv-0W for pgsql-jdbc@arkaria.postgresql.org; Tue, 01 Jul 2025 18:49:59 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uWg3K-007oIn-PX for pgsql-jdbc@lists.postgresql.org; Tue, 01 Jul 2025 18:49:59 +0000 Received: from pgintl.fastcrypt.com ([149.56.129.164]) by makus.postgresql.org with smtp (Exim 4.96) (envelope-from ) id 1uWg3I-004zzU-2c for pgsql-jdbc@lists.postgresql.org; Tue, 01 Jul 2025 18:49:57 +0000 Received: from mail-ed1-f52.google.com (mail-ed1-f52.google.com [209.85.208.52]) by pgintl.fastcrypt.com (Postfix) with ESMTPSA id 94B3420477 for ; Tue, 1 Jul 2025 14:49:55 -0400 (EDT) Received: by mail-ed1-f52.google.com with SMTP id 4fb4d7f45d1cf-60c9d8a169bso6353696a12.1 for ; Tue, 01 Jul 2025 11:49:55 -0700 (PDT) X-Gm-Message-State: AOJu0YxPHSRcwUNzABoGYTZZ/lnu2kncuOcmaPpE8iJwvfoVmE/uyx0/ 9t/aZr9bzqApqPyJ7CNTbjQZYs78+CdNkItTTlDU1oMXLGAk8Z4NoBODKt+/GuTfeaAmW3RnjCW 28fOuNbCOsSNN4Xqvzy1EvaNWm8vq/5M= X-Google-Smtp-Source: AGHT+IGH7Mx7NsTD6Ptc/kP/4unJoEskmNoJPPBXs3tqjj5hNFemonS39jRlkNXHK1FZJAe4RRVsTvx/89hJdNqNzuo= X-Received: by 2002:a05:6402:354f:b0:60c:461e:71c0 with SMTP id 4fb4d7f45d1cf-60c88e7e342mr16269089a12.30.1751395794449; Tue, 01 Jul 2025 11:49:54 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Dave Cramer Date: Tue, 1 Jul 2025 14:49:37 -0400 X-Gmail-Original-Message-ID: X-Gm-Features: Ac12FXy6TZv-hCAYAIlZHjAbukVP5aFty5n_FHW2APsYiMqVEEddBjfWAuOv3vo Message-ID: Subject: Re: Patch for supporting PEM based certs and keys To: harinath kanchu Cc: pgsql-jdbc@lists.postgresql.org Content-Type: multipart/alternative; boundary="000000000000307edb0638e29ce0" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000307edb0638e29ce0 Content-Type: text/plain; charset="UTF-8" As you have surmised, we do not accept patches in this form. Dave Cramer www.postgres.rocks On Fri, 27 Jun 2025 at 13:14, harinath kanchu wrote: > Hello Pgjdbc community, > > I found that PGJDBC currently lacks support for PEM based certs and keys. > > We have a use case where PEM files are auto renewed on disk and > converting them to DER format requires running something that watches > files on disk and auto-converts to DER. > > Hence I would like to propose a patch for supporting PEM based certs, keys. > > This is the approach for adding the support, > > - Introduce a new PEMKeyManager which implements X509KeyManager. > - PEMKeyManager will have the logic for extracting the BASE64 encoded > DER bytes to convert into private key using key algorithm specified by > property PGProperty.PEM_KEY_ALGORITHM. > - PEMKeyManager will read the PEM based cert chain using > CertificateFactory to get the X509Certificate chain. > - Now LibPQFactory can initialize PEMKeyManager if the SSL Keyfile > ends with .key or .pem > > I am attaching a patch file which also contains new test cases for PEM > based certs, keys. Please take a look. > > Thanks. > > Regards, > Harinath > --000000000000307edb0638e29ce0 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
As you have surmised, we do not accept patches in thi= s form.

Dave Cramer
www.po= stgres.rocks


On Fri, 27 Ju= n 2025 at 13:14, harinath kanchu <kanchuharinath@gmail.com> wrote:
Hello Pgjdbc community,

I found that PGJDBC currently lacks support for PEM based certs and keys.
We have a use case where PEM files are auto renewed on disk and
converting them to DER format requires running something that watches
files on disk and auto-converts to DER.

Hence I would like to propose a patch for supporting PEM based certs, keys.=

This is the approach for adding the support,

- Introduce a new PEMKeyManager which implements X509KeyManager.
- PEMKeyManager will have the logic for extracting the BASE64 encoded
DER bytes to convert into private key using key algorithm specified by
property PGProperty.PEM_KEY_ALGORITHM.
- PEMKeyManager will read the PEM based cert chain using
CertificateFactory to get the X509Certificate chain.
- Now LibPQFactory can initialize PEMKeyManager if the SSL Keyfile
ends with .key or .pem

I am attaching a patch file which also contains new test cases for PEM
based certs, keys. Please take a look.

Thanks.

Regards,
Harinath
--000000000000307edb0638e29ce0--