GPGME, C++ wrappers and Stupid Questions.

Robert J. Hansen rjhansen@inav.net
Fri Mar 8 23:53:01 2002


Is there any project underway to wrap GPGME in C++?  (I know that a lot
of people on the list have no fondness for C++, but hey, I like the
language.)

If not, I've got the beginnings of a wrapper going--right now it's only
adequate for querying the keyring, but it shouldn't be too terribly hard
to extend it to support the full range of GPGME operations.  Before I do
any more work on it, though, I'd like to make sure I'm not reinventing
the wheel.

And on a related note, I'm having some real troubles deleting keys from
a keyring.  The following is a snippet of code that shows the bug:

void Key::deleteKey(bool deleteSecret = false)
{
  GpgmeError err = GPGME_No_Error;
  switch (deleteSecret)
  {
    case false:
      err = gpgme_op_delete_start(ctx, key, 0);
      ctx = gpgme_wait(ctx, &err, 1);
      break;
    case true:
      err = gpgme_op_delete_start(ctx, key, 1);
      ctx = gpgme_wait(ctx, &err, 1);
      break;
  };
  errswitch(err);
}

... Whenever I call Key::deleteKey, err is GPGME_No_Error by the time
the error-switcher is reached.  However, the key remains on my GPG
keyring even after the function ends.  Am I misusing the API, or is
there some subtle error elsewhere in my code that's causing this to
fail?