-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ykcs11 with ed25519 (using firmware 5.7.1) #507
Comments
ED25519 should now be supported by YKCS11. Can you please set the |
Sure, this is after I generated an ed25519 key once more:
The output of |
OK, I can re-produce the error. As far as I can see, YKCS11 does return the correct key type, and the error message "skipping unsupported key type" seems to be produced by the ssh-key command, not YKCS11. I did some googling and found, among others, this ticket that seems to indicate that OpenSSH does not support ED25519 via PKCS11: OpenSC/OpenSC#2824. It's from last year but it references a PR with a patch that looks to be still open |
Ohhh 😒 Well, I compiled that old referenced version and branch of openssh. I had to do that on debian 12 since it didn't really work with the openssl version in debian testing. Also recompiled yubico-piv-tool on that same system. No luck, but it outputs "C_GetAttributeValue failed: 18" instead of "skipping unsupported key type". Here's the complete debug output: ssh-keygen.1724273754.log diff to previous log file is basically:
So, although YKCS11 supports ed25519 now, is there some way you could actually use with SSH? |
I've done some tweaks. Can you try to build yubico-piv-tool from this branch and see if it works better with your patched OpenSSH? https://github.com/Yubico/yubico-piv-tool/tree/ed_ykcs11 |
I rebuilt it using
It seems to behave the same as before, unfortunately. |
I guess we'll simply have to wait for the official support in openssh then. Unrelated to this repo, but I forked and patched piv-go and yubikey-agent, and now I've got a working ssh setup using ed25519 keys in PIV mode. 😀 |
Thanks you for the tip. I'm glad you got it to work 😀 I have made another tweek to add support for another missing attribute. Also on this branch https://github.com/Yubico/yubico-piv-tool/tree/ed_ykcs11. Feel free to try it out and please let me know the result if you do. |
Looks better!
|
with -vv you can see that it indeed tries to use the ed25519 key:
And with YKCS11_DBG=9: |
Thank you for trying it out. I'm afraid I'm not sure what the debug output after the PKCS11 session has ended mean. Does this mean that YKCS11 side of things now works with the patched version of OpenSSH? I am currently unable to test this setup here. |
Yeah, it might mean that the YKCS11 part does work, and then it's simply the openssh patch that doesn't work all the way. While running pcscd in debug mode I'm noticing that it returns |
What part returns |
I combined the logs with timestamps and it seems like 6A 80 isn't related to "sign_and_send_pubkey: signing failed for ED25519 "Public key for PIV Authentication": invalid argument". I believe that error is related to the openssh patches. |
OK. Thank you for looking into it. In this case, we'll make sure to come out with a patch release soon. I'm sorry it won't help much with your issue but hopefully it'll work better in other settings |
@aveenismail I tried your branch https://github.com/Yubico/yubico-piv-tool/tree/ed_ykcs11 in a different context - using https://github.com/latchset/pkcs11-provider - as I was running into the same
After digging into it a bit more this appears to be because you're returning the raw public key here https://github.com/Yubico/yubico-piv-tool/blob/ed_ykcs11/ykcs11/openssl_utils.c#L699, while pkcs11-provider is expecting it to be a DER octet string with the tag and length, like what's done for EVP_PKEY_EC here: https://github.com/Yubico/yubico-piv-tool/blob/ed_ykcs11/ykcs11/openssl_utils.c#L686-L687. I tried a quick patch and it seemed to clear up that error, though I'm still running into other issues. I suspect they may not be ykcs11 issues, though I don't really understand what's going on yet. |
@Pythoner6 Thank you for the report. Can you please try the https://github.com/Yubico/yubico-piv-tool/tree/ed_ykcs11 branch again now? The encoding should be fixed now |
Yep, that solves the failed to store issue! |
Were you able to get past BR |
Since #308 was merged yesterday, I figured YKCS11 would support ed25519 keys, but I can't get it to work.
And then semi-according to https://developers.yubico.com/PIV/Guides/SSH_with_PIV_and_PKCS11.html
At this point I expected an ed25519 public key to show up.
The same procedure works fine using ecdsa:
Are ed25519 keys simply not supported yet or did I do something wrong?
The text was updated successfully, but these errors were encountered: