Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nC4GE-0002co-Oq for pgsql-jdbc@arkaria.postgresql.org; Mon, 24 Jan 2022 18:40:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nC4Fg-0004le-Rt for pgsql-jdbc@arkaria.postgresql.org; Mon, 24 Jan 2022 18:39:40 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nC4Fg-0004lU-Ik for pgsql-jdbc@lists.postgresql.org; Mon, 24 Jan 2022 18:39:40 +0000 Received: from out-20.smtp.github.com ([192.30.252.203]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nC4FY-0003IP-9C for pgsql-jdbc@lists.postgresql.org; Mon, 24 Jan 2022 18:39:40 +0000 Received: from github.com (hubbernetes-node-40af223.va3-iad.github.net [10.48.125.43]) by smtp.github.com (Postfix) with ESMTPA id ECF69E1935 for ; Mon, 24 Jan 2022 10:39:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=github.com; s=pf2014; t=1643049569; bh=tIecBqIAM8yHbUt+AvNHQIdIsVl/BhBtTpBMAQkJpyY=; h=Date:From:To:Subject:From; b=t8gZH7vmqtIgIAt9lWXAElD22u0sViSSEN2PCDVuvQBM8aiGrrOyy6NkUWb7Fku75 6bXYZOlciRRn/tn6Jr533bFJ0OaEerZC+0Jb13A57Md5+5W6+0cFTwbOA9lT6St4bo QbSsY58poArdOZHid48zxzfXkHgpmVtECO5yEPsM= Date: Mon, 24 Jan 2022 10:39:29 -0800 From: Nick Burgan To: pgsql-jdbc@lists.postgresql.org Message-ID: Subject: [pgjdbc/pgjdbc] d281a7: Add cert key type checking to chooseClientAlias (#... Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Approved: 58GruLoMopuc X-GitHub-Recipient-Address: pgsql-jdbc@lists.postgresql.org X-Auto-Response-Suppress: All List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Branch: refs/heads/master Home: https://github.com/pgjdbc/pgjdbc Commit: d281a788b227b73e5a5236a10f3e5f5e73d011e7 https://github.com/pgjdbc/pgjdbc/commit/d281a788b227b73e5a5236a10f3e5f5e73d011e7 Author: Nick Burgan <13688219+nmburgan@users.noreply.github.com> Date: 2022-01-24 (Mon, 24 Jan 2022) Changed paths: M pgjdbc/src/main/java/org/postgresql/ssl/LazyKeyManager.java M pgjdbc/src/main/java/org/postgresql/ssl/PKCS12KeyManager.java M pgjdbc/src/test/java/org/postgresql/test/ssl/LazyKeyManagerTest.java M pgjdbc/src/test/java/org/postgresql/test/ssl/PKCS12KeyTest.java Log Message: ----------- Add cert key type checking to chooseClientAlias (#2417) Previously, these functions ignored the keyType (or 'strings') argument to the chooseClientAlias function. Some libraries (e.g. Bouncy Castle) expect that when chooseClientAlias is called and key types are passed in, that it will return null if the cert doesn't use one of the given key types. For example, if ['EC'] was passed in for keyType and the cert contained an RSA key, since this would return 'user' rather than null in that case, it would cause Bouncy Castle to assume using an ECDSA signing algorithm was okay, and cause problems during the Certificate Verify part of the handshake. This modifies these functions to only return 'user' if keyType is passed in and the cert contains a key of that type. If keyType is empty or null, it will ignore this and continue to check only the issuer.