Comment 3 for bug 1212214

Revision history for this message
Nils Rokita (akasch) wrote :

from io import BytesIO

gpgme.Context()
strio = BytesIO(open("id_rsa.pub", 'rb').read())
ctx.import_(strio)

Works for me. if the key is in a variable one have to encode it:

ctx = gpgme.Context()
result = ctx.import_(BytesIO(keytext.encode('utf-8')))