Autocrypt Python API Reference

Note

While the code documented here is automatically tested against gpg, gpg2, python2 and python3, all of the API here is subject to change during 0.x releases. This doesn’t mean that everything will actually change.

autocrypt.account
autocrypt.storage
autocrypt.storage_fs HeadTracker and BlockService filesystem implementation.
autocrypt.bingpg BinGPG is a “gpg” or “gpg2” command line wrapper which implements all operations we need for Autocrypt usage.
autocrypt.cmdline
autocrypt.bot
autocrypt.mime mime message parsing and manipulation functions for Autocrypt usage.

account module

cmdline module

storage module

storage_fs module

HeadTracker and BlockService filesystem implementation.

bot module

mime module

mime message parsing and manipulation functions for Autocrypt usage.

autocrypt.mime.parse_ac_headervalue(value)[source]

return a autocrypt attribute dictionary parsed from the specified autocrypt header value. Unspecified default values for prefer-encrypt and the key type are filled in.

autocrypt.mime.parse_email_addr(string)[source]

return a (prefix, emailadr) tuple.

autocrypt.mime.render_mime_structure(msg, prefix=u'\u2514')[source]

msg should be an email.message.Message object

autocrypt.mime.verify_ac_dict(ac_dict)[source]

return a list of errors from checking the autocrypt attribute dict. if the returned list is empty no errors were found.

bingpg module

BinGPG is a “gpg” or “gpg2” command line wrapper which implements all operations we need for Autocrypt usage. It is not meant as a general wrapper outside Autocrypt contexts.

class autocrypt.bingpg.BinGPG(homedir=None, gpgpath=u'gpg')[source]

basic wrapper for gpg command line invocations.

__init__(homedir=None, gpgpath=u'gpg')[source]
Parameters:
  • homedir (unicode or None) – gpg home directory, if None system gpg homedir is used.
  • gpgpath (unicode) – If the path contains path separators and points to an existing file we use it directly. If it contains no path separators, we lookup the path to the binary under the system’s PATH. If we can not determine an eventual binary we raise ValueError.
autocrypt.bingpg.find_executable(name)[source]

return a path object found by looking at the systems underlying PATH specification. If an executable cannot be found, None is returned. copied and adapted from py.path.local.sysfind.