I'm just getting started with Yubikey, and with smart cards in general, so this might be a dumb question. I am trying to perform what should be a simple operation: digitally sign something using the Yubikey, and then verify the signature using OpenSSL.
I have generated an ECDSA-256 certificate request in slot 9a, issued the certificate, and installed it. I am then generating a digital signature for a file using:
Code:
#pkcs11-tool --module /usr/lib/i386-linux-gnu/opensc-pkcs11.so --sign --input-file=Downloads/test_file --output-file=test_file.sig
Using slot 1 with a present token (0x1)
Logging in to "PIV_II (PIV Card Holder pin)".
Please enter User PIN:
Using signature algorithm ECDSA
Writing OpenSSL ECDSA_SIG
So far, so good. This generated a file with a length of 70 bytes.
Now I try to verify the signature using OpenSSL. I have extracted the public key for my certificate into the file "yubikey.pubkey" previously:
Code:
#openssl dgst -verify yubikey.pubkey -signature test_file.sig test_file
Verification Failure
Am I way off the mark in what I'm trying to do here? Any ideas? Thanks!