Browse Source

own keys

master
Volker Birk 4 months ago
parent
commit
f40f940880
2 changed files with 27 additions and 7 deletions
  1. +0
    -4
      enigmail.py
  2. +27
    -3
      pEp_import.py

+ 0
- 4
enigmail.py View File

@@ -49,10 +49,6 @@ def fpr_from_keyid(keyid):
raise LookupError()


def own_keys():
return [ fpr_from_keyid(x[4]) for x in command('-K') if x[0] == 'sec' and x[1] == 'u' ]


uid_re = re.compile(r'(?P<name>[^<]*) \<(?P<email>[^>]*)\>')




+ 27
- 3
pEp_import.py View File

@@ -9,10 +9,10 @@ import enigmail
import pEp_JSON
import thunderbird
from enigmail import thunderbird_base
from base64 import b64encode


own_pgp_keys = enigmail.own_pgp_keys()
identities = enigmail.identities()
#identities = enigmail.identities()

#print identities
#print thunderbird.enigmail_assignKeysByEmailAddr(thunderbird_base)
@@ -20,5 +20,29 @@ identities = enigmail.identities()
#print enigmail.comm_partner_pgp_keys()

with pEp_JSON.Connection() as call:
print call("serverVersion")[u'return']
# own keys

own_pgp_keys = enigmail.own_pgp_keys()
print own_pgp_keys

for own_key in own_pgp_keys:
# import keydata

keydata = enigmail.secret(own_key['fpr'])
call('import_key', b64encode(keydata), 23, [ '42', ])

# set as own key

for uid in own_key['uids']:
me = {
'username': uid['name'],
'user_id': 'pEp_own_userId',
'address': uid['email'],
'fpr': own_key['fpr'],
}
print call('set_own_key', me, own_key['fpr'])

# set own identities


Loading…
Cancel
Save