-
Notifications
You must be signed in to change notification settings - Fork 65
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
ECDH for using P-384 keys for more than signing #79
Comments
A-ha! Found the difference! |
I tried reproducing the 0x81->0x85 difference here Line 756 in d3b05b2
but that just broke with
Same yubikey, same slot, works with ykpiv. I must be still doing something wrong. |
Ah, signing was silently truncating the input still. Commenting out this line kludges Line 746 in d3b05b2
|
Now, obviously the above is not the right way to do it, just a proof of concept. How should the real API look like? I'm not thrilled by the idea of a Decrypt that doesn't really decrypt. Should YubiKey.PrivateKey return value learn an extra optional interface?
|
I guess that KeyAgreement should take Any thoughts on the name of the interface, can't -er name it easily. KeyAgreementer. KeyAgreer. Are there good synonyms for the Diffie-Hellman operation? I already intentionally made it not say EC or DH, because I thought both of those were algorithm-specific details. |
I'll have a pull request ready as soon as I figure out how this library is tested. |
First stab is at https://github.com/tv42/piv-go/tree/wip-ecdh, without tests for now. |
go-ykpiv's CGo wrapper of libykpiv has this:
https://godoc.org/github.com/go-piv/go-ykpiv#Slot.Decrypt
I've tested that to work. I would, however, like to use pure-Go libraries.
I couldn't figure out how to get ECDH working with piv-go. For the CGo version, sign and decrypt look very similar:
https://github.com/go-piv/go-ykpiv/blob/32315ce599d8e21e91880e6ecdce55a98420ddc0/decrypt.go#L68
https://github.com/go-piv/go-ykpiv/blob/32315ce599d8e21e91880e6ecdce55a98420ddc0/sign.go#L166
and so do libykpiv's two functions, they both call the same function:
https://github.com/Yubico/yubico-piv-tool/blob/0b27308560ab4f3df4bc29a179e1c91649ce0629/lib/ykpiv.c#L1144
https://github.com/Yubico/yubico-piv-tool/blob/0b27308560ab4f3df4bc29a179e1c91649ce0629/lib/ykpiv.c#L1126
go-ykpiv has a helpful test case here:
https://github.com/go-piv/go-ykpiv/blob/32315ce599d8e21e91880e6ecdce55a98420ddc0/ykpiv_test.go#L522
But I can't see where exactly signing and decrypting are different to make ECDH work with go-piv. Any thoughts?
The text was updated successfully, but these errors were encountered: