Skip to content
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

Support for gpgsm #240

Open
tdussa opened this issue Aug 5, 2024 · 3 comments
Open

Support for gpgsm #240

tdussa opened this issue Aug 5, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@tdussa
Copy link

tdussa commented Aug 5, 2024

I would like to be able to interface to gpgsm in addition to gpg because I'd like to be able to create S/MIME as well as GPG signatures. I believe this should be fairly easily doable; however, setting gpgbinary to gpgsm in the gnupg.GPG init call results in an error message:

ValueError: Error invoking gpg: 2: [GNUPG:] FAILURE option-parser 50331649
gpgsm: invalid option "--fixed-list-mode"

Describe the solution you'd like
Be able to initialize gnupg.GPG with gpgsm as the backend binary to be used.

Describe alternatives you've considered
There seem to be python-gnupg forks(?) that allow for exactly this, for example https://github.com/isislovecruft/python-gnupg; however, those forks are not packaged by, say, Debian or Arch.

Additional context
None.

@vsajip vsajip added the enhancement New feature or request label Aug 6, 2024
@vsajip
Copy link
Owner

vsajip commented Aug 6, 2024

For gpgsm to be easily usable via gpgbinary, it needs to be completely command-line compatible with gpg.

You may be able to subclass gnupg.GPG to get the behaviour you want with gpgsm - you could override GPG._handle_io or GPG._open_subprocess and modify the args to suit gpgsm before passing to the base method.

The other fork you mention hasn't seen activity for many years; I would guess it's abandonware (though I may be wrong on that).

@tdussa
Copy link
Author

tdussa commented Aug 6, 2024

I totally understand that it is not sufficient to set gpgbinary=gpgsm at the moment because gpgsm unfortunately is not command-line compatible. However, I would really love it if python-gnupg would implement gpgsm support. I am aware that this is potentially a substantial effort. I am also aware that the fork is not actively maintained. However, I wanted to point to it because it at least claims to support gpgsm, so it is possible that approaches how to handle the situation might be found there. I am somewhat cautiously optimistic that the required changes to gnupg.GPG might be limited. I'll have a look into what is necessary to be changed.

THX for your help!

@vsajip
Copy link
Owner

vsajip commented Aug 6, 2024

because it at least claims to support gpgsm

Sure, but it's years out of date now, as far as I know, so I'm not sure any claims it makes are still valid. I don't see that any approaches of value are to be found there (you'll see dozens of open issues and unaddressed PRs there).

From what I can see, it's just a case of using the appropriate command line parameters for the appropriate tool. This is the first time anyone has asked for S/MIME / gpgsm support since I released this library, so I'm not sure how much the support burden might be for what might be a niche use case (in terms of number of users wanting it).

I would suggest taking the subclass-and-override approach I suggested earlier, and if that works well, we can look and see if it's feasible to fold that in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants