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ewUHAwIMBgxghkgBxfV7BQcDAg0GDGCGSAHF9XsFBwMCDjANBgkqhkiG9w0BAQ0F
AAOCAgEAHCGoiwwAGLjQUl1lrMez2j9GD+vsG8uiyB0LVW098Z1HjHxZZwH4fQ0Pixpj+/Ck0L09
WYvVIApL5x90smt/AyMe42ZU4MlmxkNlGBbe+ttq1fJdVC5hut8VRkyLRB3hSEB5avxRMG0LXEiZ
uO5eR0uHK8Gzh61uvqe+OXNQg0iaFzcdEUGQnqers9klRi/woTPEbbd8GInrhRX2tN1iGd2ph0r2
yQ7ZBazop3es4DH1BD7gHDa+/EiiPEuFu+tKsSvcdvinAviSXmUWKdeEncr2XwxzHc+im5qfMdoX
AfnMOS5wRUlsdRSUyqw6Pk/H+UATx1sTCMZmLpP3edq7TR18XPHg1bKoXSgdyT1ItF0chWZFMhIZ
Ra5Y03tbh6vOEcbpOtjCSA3HL9fefdxwFiRRD5J8Ii5YCkaXeJaYFSmC4VK8797okHWSiyddltn0
lNk7KX0S7BS/IlEIevWplBmIyAiNdyuaqbziccuQyYGj3kuLrmeloJfz2xvoLyDOX16hD6SAPhf8
Tu+YxJ5dvDAHzVjRCTYAdXpAiLzLl9bu0sycXPT6aUILTCQG83dQ4Hw/AXJD9OGbmWTiVQKrVtYB
FrS2TfJvQyH6RuwzKu28Lj9W6HaJwsQRJOzQJSjjDGtVVpL2pr+aAnU1wlveYCzgkLxmyJzX9ZFJ
lRT4RJg=
-----END CERTIFICATE-----
Thanks for the detailed report!
I'm not able to easily reproduce it:
$ ykman piv generate-key --pin 123456 -a RSA2048 --pin-policy NEVER --touch-policy NEVER -F PEM 9a pub.pem
$ ykman piv generate-csr --pin 123456 -s erik 9a pub.pem csr.pem
Then used this site for getting a cert from the CSR.
$ ykman piv import-certificate -v 9a ~/Desktop/erik-2020-03-18-233700.pem
$ ykman piv info
PIV version: 5.2.4
PIN tries remaining: 3
CHUID: 3019d4e739da739ced39ce739d836858210842108421c84210c3eb341079dd112a333c9b65575c5fd8a972714b350832303330303130313e00fe00
CCC: No data available.
Slot 9a:
Algorithm: RSA2048
Subject DN: CN=erik
Issuer DN: C=US,ST=Washington,L=Seattle,O=getaCert - www.getacert.com
Serial: 2184
Fingerprint: 3098a69fd2494817ef79a1d4747f82dfc539be0d775b270f94f1a2cf3930dc47
Not before: 2020-03-19 06:37:01
Not after: 2020-05-18 06:37:01
However, looking at the code, I suspect the error message might be wrong, or at least assuming too much.
Could you try again with debug logging enabled to see if it gives any clues?
$ ykman --log-level DEBUG piv import-certificate -v 9a cert.pem
I think it's simpler than that. The client certificate is signed by the certificate provider, not by us. It should match their private key instead.
Please ignore my ignorance while I go sit in a corner :-/
No worries, closing this then.
When I try to import a signed client certificate for PIV mode,
ykman import-certificate -v
says the certificate does not match the private key that was used to generate the original CSR.At this point I have the cert signed as
cert.pem
Steps to reproduce
See the steps and commands above.
I also tried generating the private key myself, outside the Yubikey using openssl and then importing the key, followed by import-certificate, but that gave the same result.
Expected result
I would expect
ykman piv import-certificate -v
to not claim that the cert.pem does not match the private key in slot 9a.