So here are some results or comments.
I tried to decode the log of the command :
OPENSC_DEBUG=9 openssl req -engine pkcs11 -sha256 -new -key 01 -keyform engine -out SigningKeyCsr.pem -outform PEM -subj '...blabla...'
The ATR analysis seems very long and should be optimised, but it’s not the problem.
Once the OpenPGP card module found , there are some exchanges with the card. OK.
But it sounds strange to have a GET DATA HistoricalBytes and after a GET DATA ApplicationRelatedData. As far as I have seen, HistoricalBytes must be in ApplicationRelatedData for an openPGP card. Since i’m not familiar with topics, there should be an explanation.
In the trace, we could find :
P:4245; T:0x139913859376256 11:55:16.167 [opensc-pkcs11] pkcs15-pubkey.c:1159:sc_pkcs15_dup_pubkey: named_curve parameter missing
P:4245; T:0x139913859376256 11:55:16.167 [opensc-pkcs11] pkcs15-pubkey.c:1174:sc_pkcs15_dup_pubkey: returning with: -1408 (Not supported)
This trace is also strange, since during the ApplicationRelatedData, we got:
4F 10 D2 76 00 01 24 01 02 00 FF FE 67 09 33 52 O..v..$.....g.3R
00 00 5F 52 0A 00 31 84 73 80 01 80 05 90 00 73 .._R..1.s......s
81 BD C0 0A 74 00 00 20 08 00 00 FF 01 00 C1 09 ....t.. ........
13 2A 86 48 CE 3D 03 01 07 C2 06 01 08 00 00 20 .*.H.=.........
00 C3 09 13 2A 86 48 CE 3D 03 01 07 C4 07 00 7F ....*.H.=.......
7F 7F 03 03 03 C5 3C 9F 9E A6 64 67 F0 D4 C5 E9 ......<...dg....
EE FE F1 F8 4E B3 B7 D1 F0 B7 30 D0 DF CB 05 C1 ....N.....0.....
3A F7 31 6C 1B CF B7 C9 6B 91 2B 5D A0 6D 73 A4 :.1l....k.+].ms.
3E 4F F6 AD DE 6C 9F 96 06 41 59 C9 B3 7B B6 02 >O...l...AY..{..
31 1D 8A C6 3C 00 00 00 00 00 00 00 00 00 00 00 1...<...........
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 CD 0C 5E 9A DA 5F 5E 9A DA 5F 5E 9A DA 5F 90 ...^.._^.._^.._.
00
And if we decode :
4F : Full AID
10 : Length
D276000124010200FFFE670933520000
5F52 : Historical Bytes
0A : Length
00318473800180059000
73 : Discretionary data objects
81 : Length on 1 byte : BD
C0 : Extended Capabilities
0A : Length
74 00 00 20 08 00 00 FF 01 00
C1 : Algorithm Attributes signature
09 : length
13 2A 86 48 CE 3D 03 01 07 => 0x13 = 19 : ECDSA. OID for NIST curve
C2 : Algorithm decryption
06 : Length
01 08 00 00 20 00
C3 : Algorithm attributes authentication
09 : length
13 2A 86 48 CE 3D 03 01 07 => 0x13 = 19 : ECDSA. OID for NIST curve
C4 PW Status Bytes
07:length
00 7F 7F 7F 03 03 03
C5 : fingerprints
3C : Length
9F9EA66467F0D4C5E9EEFEF1F84EB3B7D1F0B730
D0DFCB05C13AF7316C1BCFB7C96B912B5DA06D73
A43E4FF6ADDE6C9F96064159C9B37BB602311D8A
C6 : List of CA-Fingerprints
3C : Length
000
CD : List of generation dates/times
Afterward, I’m a little bit disappointed, to see that the VERIFY command is not protected.
Moreover, we can found in the trace the user pin in clear !
I guess and hope that it will be corrected at the very next release,
And then no more exchanges with the card, and finally got :
Key not found.
PKCS11_get_private_key returned NULL
cannot load Private Key from engine
139862395589760:error:80067065:pkcs11 engine:ctx_load_privkey:object not found:eng_back.c:862:
139862395589760:error:26096080:engine routines:ENGINE_load_private_key:failed loading private key:../crypto/engine/eng_pkey.c:78:
unable to load Private Key
I found this a little bit strange, since I believed that we will try to sign a buffer with the token in order to get the CSR.
1°) Could you confirm my assumption ?
Because, if the problem comes from pkcs15 or pkcs11 and the if the card content is OK, then I should be able to make a workaround with some scripts to create the CSR, and wait for the official update afterward.
2°) If I have correctly overviewed the openPGP card specification, it seems that only ECDSA is supported. do you know why ECDH is not supported ?
Many thanks in advance for your help and support.
Best regards.