Automating and integrating GPG

Werner Koch wk at gnupg.org
Thu Sep 21 16:54:53 CEST 2017


On Thu, 21 Sep 2017 11:03, aheinlein at gmx.com said:

> Interesting. I haven't found anything smartcard related in the GPGME
> docs. I am really not good at C, but I took a look at the sources of

Yes, it is a generic interface to make a core libassuan function (which
is already used by gpgme) available as GPGME API.  The actual API to the
smartcard daemon is Assuan based and there is not much documentation than
the reference you get when running

  $ gpg-connect-agent
  > scd help

this lists all smartcard commands.  gpg-agent intercepts some of the
calls to provide a Pinentry but despite of this the "scd " prefix
forwards all command to scdaemon.

> I hadn't thought of that possibility. Python-GPG should support this,
> too - take a look at assuan.py in the examples folder. But I haven't yet

GPGME's Python interface supports this.  Here is code from the
distributed example:

--8<---------------cut here---------------start------------->8---
"""Demonstrate the use of the Assuan protocol engine"""

From __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals

import gpg

with gpg.Context(protocol=gpg.constants.protocol.ASSUAN) as c:
    # Invoke the pinentry to get a confirmation.
    err = c.assuan_transact(['GET_CONFIRMATION', 'Hello there'])
    print("You chose {}.".format("cancel" if err else "ok"))
--8<---------------cut here---------------end--------------->8---


Shalom-Salam,

   Werner

-- 
Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 227 bytes
Desc: not available
URL: </pipermail/attachments/20170921/6a43d696/attachment.sig>


More information about the Gnupg-users mailing list