Patching out GPGMail license check

I was blindsided when the support contract scheme is suddenly applied to GPGMail. I have spent some time reading into the code regarding the support contract, and figured out the way to patch it out.

I have decided against releasing the patch directly in order to put up some barrier of entry to this – as you have to either patch it yourself with your own labor and bear with the constant nag, or pay GPGTools team to remove the limitations.

The following steps describe how did I patch out the license check.

  1. What does the patch achieve and does not achieveAfter the patch, GPGMail will be able to operate in trial mode indefinitely. GPGMail will nag every time you open Apple Mail, but since the trial is currently fully functional it will still work. As of the filesystem the files regarding the license check will not be created, and existing ones will be ignored.
  2. What to patchDespite my initial assumption, patching GPGMail.mailbundle does not quite work, since the actual license check is not performed there. The patch is applied to the Libmacgpg XPC service, where the actual license check happens.
  3. Prepare the patch
    1. You will need a version of Xcode to apply this patch. Xcode can be downloaded for free from Mac App Store.
    2. In order to satisfy the code signing requirements, you will also need an Apple ID with Apple Developer access. Without the $99/year Apple Developer Program subscription the certificates will only be valid for a week, but with the said certificate the certificates will be valid for a year.
  4. Apply the patch:
    1. Download the source code of Libmacgpg from Github, and open it in Xcode. Xcode will nag about garbage collection in one of the unit tests, however since we are not building that part of the project it is safe to ignore it for now.
    2. The license check is implemented using an external framework known as Paddle, so that is the target to be patched out. Remove the files and references of frameworks Paddle and GSPaddle from org.gpgtool.Libmacgpg.xpc first, and Xcode will start to report errors regarding missing files.
    3. Go to org.gpgtools.Libmacgpg.xpc/JailfreeTask.m file and patch out #import directives regarding files related to Paddle, and use the errors and the original code (after commenting them out) as a guide to stub out the methods.
    4. Compile the resulting framework, and copy the resulting Paddle-less org.gpgtools.Libmacgpg.xpc bundle from the build products folder (machine dependent, you should find it out using Xcode) to /Library/Application Support/GPGTools/org.gpgtools.Libmacgpg.xpc
      5) Restart your computer to force the XPC service to be reloaded.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.