KeyManagerImpl always taking the first client alias

未关闭
#1,076 3 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

@prbprbprb 已经在做这个了。

开始于 2023年1月15日。

评估

这个 Issue 还没有评估数据。

描述

In KeyManagerImpl the logic that chooses a client alias in method chooseClientAlias always takes the first client alias. For my use case, I am using the KeyManagerImpl for MTLS communication to the backend.

My scenario is that I have 2 keypairs in my KeymManager keystore. One of the keypair's certificate is about to be expired, so i created a new keypair and both of these keypairs are signed by the same CA, thus when talking to my backend the same Principal Names are return when chooseClientAlias is invoked.

Now the problem comes when the backend removes the expired leaf certificate, but chooseClientAlias still will choose the keypair with the expired certificate and an http 403 will occur despite my keystore having both the expired and the non-expired keypairs.

this happens because of the below

@Override
    public String chooseClientAlias(String[] keyTypes, Principal[] issuers, Socket socket) {
        final String[] al = chooseAlias(keyTypes, issuers);
        return (al == null ? null : al[0]);
    }

Conscrypt KeyManagerImpl will just take the first alias no matter what. Can there be some form of deterministic behaviour where the array of aliases be sorted first b4 returning like below? By doing this i can somehow decide which keypair is used first when creating the keystore.

@Override
    public String chooseClientAlias(String[] keyTypes, Principal[] issuers, Socket socket) {
        final String[] al = chooseAlias(keyTypes, issuers);
        if (al == null) return null;
        Arrays.sort(al);
        return al[0];
    }
主要语言
Java
星标
1.4k
派生
332
平均合并
2 天 56 分钟
30 天内合并 PR
5

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

google/conscrypt 的其他 Issue

查看 google/conscrypt 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。