I am trying to sign an efi image with a Yubikey 4
I configured Yubikey with the following:
yubico-piv-tool -k $key -a import-key -s 9c < test-key.rsa
yubico-piv-tool -k $key -a import-certificate -s 9c < test-cert.pem
I included the certificate in a certdir:
certutil -A -n "efi-cert" -t ,,Tu -d $CERTDIR -a -i test-cert.pem
I can see the token in pkcs11-tool:
$ pkcs11-tool --module=/usr/lib/x86_64-linux-gnu/opensc-pkcs11.so -L
Available slots:
Slot 0 (0xffffffffffffffff): Virtual hotplug slot
(empty)
Slot 1 (0x1): Yubico Yubikey 4 OTP+CCID 00 00
token label : PIV_II (PIV Card Holder pin)
token manufacturer : piv_II
token model : PKCS#15 emulated
token flags : rng, login required, PIN initialized, token initialized
hardware version : 0.0
firmware version : 0.0
serial num : 00000000
But when I try to use it with pesign, it doesn't find the token
$ sudo pesign -i bootx64.efi --export-signature bootx64.sig --sign -d sha256 -t "PIV_II (PIV Card Holder pin)" -c "efi-cert" -n $CERTDIR
could not find token "PIV_II (PIV Card Holder pin)"
pesign: Could not find certificate efi-cert
In strace I saw that pesign doesn't read opensc-pkcs11.so, but it reads libnssckbi.so, can this be the reason? Should I configure the Yubikey differently?
Any help would be much appreciated.