After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 641848 - possible to collapse GMimeGpgContext with GMimePkcs7Context ?
possible to collapse GMimeGpgContext with GMimePkcs7Context ?
Status: RESOLVED FIXED
Product: gmime
Classification: Other
Component: general
2.5.x
Other Linux
: Normal normal
: ---
Assigned To: Jeffrey Stedfast
Jeffrey Stedfast
Depends on:
Blocks:
 
 
Reported: 2011-02-08 17:13 UTC by Daniel Kahn Gillmor
Modified: 2017-03-11 22:29 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Daniel Kahn Gillmor 2011-02-08 17:13:32 UTC
GMime 2.4 has GMimeGpgContext.

GMime 2.5 also introduces GMimePkcs7Context.

Both are implementations of GMimeCryptoContext, and both appear (from the documentation) to use GnuPG under the hood.

It sounds to me like it is going to be up to the caller to decide which cryptocontext to use based on whether a given GMimePart uses PGP/MIME or S/MIME.  Is this correct?

If so, this determination seems possible to do within GMime itself, and it might be possible to collapse these two contexts into the same object.  This would simplify things for the caller, particularly when verifying or decrypting.

For signing/encrypting, it might make sense to allow the user to set a flag on the context object itself to indicate what form of signing/encrypting they want to do.

If these really must be different classes of context for whatever reason, it seems like they should be re-named to make it clearer which is which (e.g. if they both use GnuPG, then neither or both of them should have "Gpg" in the name, but not just one) and the documentation should be improved to indicate when to use one or the other.

What happens if you use a GMimeGpgContext to decrypt/verify an S/MIME message?  What happens if you use a GMimePkcs7Context to decrypt/verify a PGP/MIME message?
Comment 1 Jeffrey Stedfast 2017-03-02 11:22:25 UTC
This is in progress... I still want to keep the 2 different contexts, but I am working toward making them share as much code as possible.

I've already made it such that MultipartSigned.Verify() chooses the correct context for you so you don't have to pass one in.

MultipartEncrypted.Decrypt() does the same and the new ApplicationPkcs7Mime class does as well.

It's now only necessary to choose the context when doing MultipartEncrypted.Encrypt() and MultipartSigned.Sign().
Comment 2 Jeffrey Stedfast 2017-03-11 22:29:24 UTC
This is now fixed.