Hi! Thanks for this wrapper around gpgme. I just started using it and try to get used to it. I need to create a program that automatically configures YubiKeys. This can be done with gpg --edit-card and by extension then also gpgme_op_interact (the C function) and of course interact_with_card from this Rust library. The problem is that the latter requires a &Key to be passed in.
I can configure a smartcard without having any keys in my GnuPG keystore with gpg --edit-key. But the Rust wrapper interact_with_card requires a key. So the only way to currently do what I need is to create some mock key, just to get a handle to pass in.
I kind of get why it's implemented like this. Because the C documentation for gpgme_op_interact states that a valid key pointer must be provided. However, I did look at the source code. And nowhere is it using that key argument if the flag GPGME_INTERACT_CARD is provided.
Ultimately I should report this upstream to the gpgme mailing list or similar, and ask for advice there. How to use the C library to edit smartcards without needing a key. Hopefully they find it OK to use a null pointer for the key argument when interacting with cards. Just that they didn't properly document it. But I was too lazy to do that now. So I thought I'd start the journey by reporting this inconvenience here.
For now I think I'll just write my own interact_with_card wrapper around gpgme-sys that just uses a null pointer for key, given that I know it's safe (with the current versions of gpgme)
Hi! Thanks for this wrapper around gpgme. I just started using it and try to get used to it. I need to create a program that automatically configures YubiKeys. This can be done with
gpg --edit-card
and by extension then alsogpgme_op_interact
(the C function) and of courseinteract_with_card
from this Rust library. The problem is that the latter requires a&Key
to be passed in.I can configure a smartcard without having any keys in my GnuPG keystore with
gpg --edit-key
. But the Rust wrapperinteract_with_card
requires a key. So the only way to currently do what I need is to create some mock key, just to get a handle to pass in.I kind of get why it's implemented like this. Because the C documentation for
gpgme_op_interact
states that a valid key pointer must be provided. However, I did look at the source code. And nowhere is it using thatkey
argument if the flagGPGME_INTERACT_CARD
is provided.Ultimately I should report this upstream to the gpgme mailing list or similar, and ask for advice there. How to use the C library to edit smartcards without needing a key. Hopefully they find it OK to use a null pointer for the
key
argument when interacting with cards. Just that they didn't properly document it. But I was too lazy to do that now. So I thought I'd start the journey by reporting this inconvenience here.For now I think I'll just write my own
interact_with_card
wrapper aroundgpgme-sys
that just uses a null pointer for key, given that I know it's safe (with the current versions of gpgme)