Skip to content

Commit

Permalink
Add GPG key generation with good hardcoded defaults.
Browse files Browse the repository at this point in the history
  • Loading branch information
Smári McCarthy committed Dec 20, 2013
1 parent 71587a0 commit a972a1d
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions mailpile/gpgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,29 @@ def is_available(self):

return self.available

def gen_key(self, name, email, passphrase):
# FIXME: Allow for selection of alternative keyring
# Syntax:
# %%pubring mypubring.pgp
# %%secring mysecring.pgp

batchjob = """
%%echo starting keygen
Key-Type: RSA
Key-Length: 4096
Subkey-Type: RSA
Subkey-Length: 4096
Name-Real: %(name)s
Name-Email: %(email)s
Expire-Date: 0
Passphrase: %(passphrase)s
%%commit
%%echo done
""" % {"name": name, "email": email, "passphrase": passphrase}

returncode, retvals = self.run(["--gen-key"], output=batchjob)
return returncode, retvals

def list_keys(self):
"""
>>> g = GnuPG()
Expand Down

0 comments on commit a972a1d

Please sign in to comment.