Hi all,
we are using an SE050A chip on an i.MX8MN with middleware 04.05.00.
Middleware is built by ourselves with these Cmake settings:
-DCMAKE_BUILD_TYPE=Release \
-DPTMW_Host=iMXLinux \
-DPTMW_SMCOM=T1oI2C \
-DPTMW_SE05X_Auth=None \
-DPTMW_Applet=SE05X_A \
-DWithSharedLIB=ON \
-DPTMW_SE05X_Ver=03_XX \
-DPTMW_RTOS=Default \
-DSSS_HAVE_HOSTCRYPTO_MBEDTLS=ON \
-DPAHO_BUILD_STATIC=FALSE \
-DPAHO_BUILD_SHARED=TRUE \
We have some troubles using it with opensc (pkcs11-tool).
The problem is that when we have two or more public keys on the SE050, the signature verification fails. If there is only one key, the verification works properly.
Please find the attached example for all the details. Steps to reproduce are simple and are contained in section 1 of the attachment (full commands and output):
1. create a EC key pair with OpenSSL (key1)
2. sign a file with OpenSSL using private key1
2. connect to SE050, reset it and load the public key1 with label 0xaabbccdd
3. verify the signature with pkcs#11 using key label 0xaabbccdd (key1): it works
4. generate another EC key pair with OpenSSL (key2)
5. connect to SE050 and load the public key2 with label 0x01020304
6. verify again the signature with pkcs#11 using key label 0xaabbccdd (key1): it fails
7. connect to SE050 and delete the key with label 0x01020304 (key2)
8. re-do the verification of the signature with pkcs#11 using key label 0xaabbccdd (key1): it works
Section 2 of the attachment contains the same steps but using a different label (0xccddeeff) for key2. With this label, key 2 is listed after key 1 (instead of before) in the objects list: the problem stills to happen.
Section 3 of the attachment contains another test: with only one key loaded, try to verify the signature using a non-existent label: unexpectedly, it works
Seems that the pkcs11 library completely ignores the label, making the library itself completely useless when there are two or more keys.
Is this a known bug? Are there programmed fixes for this bug?
Thanks in advance.
Mauro