Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Sign and Decrypt operations failing on new epass2003 devices but not on an older one

Abierto
#2,843 38 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 2 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
25/100
Tipo de issue
Error
Claridad
Necesita aclaración
Estado de actividad
Estancado
Stack tecnológico
c
Área
security

Línea de trabajo

Start with the failing log entry in card-epass2003.c:2195 and compare the sign/decrypt behavior on the new and older epass2003 devices using the supplied pkcs15-init.exe and pkcs15-crypt.exe commands. Investigate the reported SW1=6F, SW2=83 response; done means identifying the cause and confirming sign and decrypt work on the new devices.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Problem Description

A set of recently manufactured epass2003 devices (sourced from Feitian) are erroring with Card command failed (1200) when attempting a sign or decrypt operation. An older epass2003 device initialized using the same procedure is performing correctly.

Proposed Resolution

Unclear what the problem is!

We've also reached out direct to Feitian, will update this issue if they come through with something, but I thought I'd try my luck here as well in case there is an OpenSC toolset change I've not spotted that could be causing this.

Steps to reproduce

On both devices, I have done the following procedure:

pkcs15-init.exe -E
pkcs15-init.exe -C --profile pkcs15+onepin --pin <pin> --puk <puk>
pkcs15-init.exe -G rsa/2048 -a 01 -i 01 --pin <pin> -u decrypt -u sign -l <label> --public-key-label <label>

Then, running this command:

pkcs15-crypt.exe -c --key 01 -p <pin> -i <signed file>

Produces the correct output on the old card, and Compute signature failed: Card command failed on the new ones. Same thing for the decipher operation. Public key is accessible and is the same format between the two cards.

Diffing the output of ./opensc-tool.exe -f had a difference in the serial numbers and in the final block which I assume is the public key data, otherwise everything else is the same. The old device had been previously initialized using an older version of OpenSC (0.16 I think) and had a much smaller file contents, but after erasing and re-init'ing the card in the new OpenSC version (0.23) it now looks the same.

OpenSC-0.23.0, rev: 5497519e, commit-time: 2022-11-29 09:34:43 +0100

Logs
<snip>
P:26832; T:28232 2023-08-25 16:45:09.564 [pkcs15-crypt] Unknown SWs; SW1=6F, SW2=83
P:26832; T:28232 2023-08-25 16:45:09.564 [pkcs15-crypt] card-epass2003.c:2195:epass2003_decipher: returning with: -1200 (Card command failed)
P:26832; T:28232 2023-08-25 16:45:09.564 [pkcs15-crypt] sec.c:66:sc_compute_signature: returning with: -1200 (Card command failed)
P:26832; T:28232 2023-08-25 16:45:09.564 [pkcs15-crypt] card.c:530:sc_unlock: called
P:26832; T:28232 2023-08-25 16:45:09.564 [pkcs15-crypt] reader-pcsc.c:740:pcsc_unlock: called
P:26832; T:28232 2023-08-25 16:45:09.580 [pkcs15-crypt] pkcs15-sec.c:169:use_key: returning with: -1200 (Card command failed)
P:26832; T:28232 2023-08-25 16:45:09.580 [pkcs15-crypt] pkcs15-sec.c:771:sc_pkcs15_compute_signature: use_key() failed: -1200 (Card command failed)
P:26832; T:28232 2023-08-25 16:45:09.580 [pkcs15-crypt] pkcs15-sec.c:784:sc_pkcs15_compute_signature: returning with: -1200 (Card command failed)
Compute signature failed: Card command failed

https://gist.github.com/drodgers-immt/eea221465190b979a37f95f96b60c263 for the full run log.

(Note that I have both the old and new smartcard connected to my system, I'm actually using -r <id> on the commands to target each one, but I left it out of the commands above to avoid confusion. Problem still occurs individually).

Lenguaje dominante
C
Estrellas
3.1k
Forks
858
Merge medio
4 d 4 h
PR fusionados (30 d)
16

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 OpenSC/OpenSC

Todos los issues de OpenSC/OpenSC

Issues similares

Más issues de C

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.