KeyManagerImpl always taking the first client alias

Abierto
#1,076 3 comentarios 0 reacciones 1 asignado Ver en GitHub

@prbprbprb ya está trabajando en esto.

Desde el 15/1/2023.

Evaluación

Este issue todavía no se ha evaluado.

Descripción

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];
    }
Lenguaje dominante
Java
Estrellas
1.4k
Forks
332
Merge medio
2 d 56 min
PR fusionados (30 d)
5

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de google/conscrypt

Todos los issues de google/conscrypt

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.