Commit Graph

95 Commits (1d22ce5adb3ee3a6d1939ff30f1ea1973fad6d9c)

Author SHA1 Message Date
Isis Lovecruft 1d22ce5adb
Merge remote-tracking branch 'mmn/file_and_io_handling_diff' into develop
* ADD patch by Mikael Nordfeldth to file python3 syntax compatibility due to
   the 'file' builtin being removed.
       isinstance(foo, file) → hasattr(foo, 'read'), or,
       file = _io._IOBase
 * CLOSES issue #13.
   https://github.com/isislovecruft/python-gnupg/pull/13
2013-07-29 20:57:25 +00:00
Mikael Nordfeldth 1bdf0290ab File and IO handling in Py3 is different than Py2
Instead of checking whether data isinstance of 'file', then we check that
it is file-like _enough_ to be treated as a file (i.e. it hasattr 'read').
2013-07-28 18:35:16 +02:00
Isis Lovecruft 1e867d6e11
If using GnuPG v1.x, use {'Key-Type': 'RSA'} in GPG.gen_key_input().
* CHANGE default key type to RSA for older GnuPG versions, since they seems
   to not understand using a 'default' key type.
 * UPDATE docstring for GPG.gen_key_input().
2013-07-28 11:38:43 +00:00
Isis Lovecruft 6eccbe7048
Make default gen_key_input() Key-Type conditional on GnuPG version.
* ADD functions _util._match_version_string(), _util._is_gpg2(), and
   _util._is_gpg1() for determining whether to set the default Key-Type to
   'default' (for GnuPG v2.x) or to 'RSA' (for GnuPG v1.x).
 * ADD class attribute GPG.binary_version, which stores the GnuPG executable's
   version string, which should be in the form x.x.x, where 'x' is an integer.
2013-07-28 11:28:49 +00:00
Isis Lovecruft 420d2b590d
Remove TODO item for keyring separation in GPG.gen_key_input() and GPG.gen_key(). 2013-07-27 19:42:37 +00:00
Isis Lovecruft 6b154c294e
Change LICENSE to GPLv3+, after discussion with intrigeri.
* ADD docs/change-license-emails.txt, which includes email exchanges between
   myself and intrigeri, including links to Debian and LEAP mailing lists with
   arguments for and against using AGPL for a library.
 * CHANGE license header for all files.
 * CHANGE LICENSE file and gnupg/copyright.py to use GPLv3+ text.
2013-07-27 19:27:53 +00:00
drebs ef022f977f Fix list_packets() call in utilities. 2013-07-09 08:35:42 +00:00
drebs 2832df8be1 Add missing param to utilities methods. 2013-07-09 08:35:42 +00:00
drebs 9db97dd184 Fix sign() and encrypt() docstrings. 2013-07-09 08:35:42 +00:00
drebs 171d3afa67 Fix delete_keys command line options. 2013-07-09 08:35:42 +00:00
Isis Lovecruft 94e591f6dc
Update docstrings for v1.1.6 Sphinx generation in gnupg.py and _parsers.py. 2013-07-03 10:24:11 +00:00
Isis Lovecruft f11ea6901c
Set gpg.temp_[key|sec]ring to None after setting key.[key|sec]ring.
* Change the returned _parsers.GenKey from gnupg.GPG.gen_key() to store the
   location of the renamed temporary keyrings as attributes. This way, one can
   do something like:

   >>> key = gpg.gen_key(key_input)
   >>> key.keyring
   './generated-keys/328A5C6C1B2F0891125ECBE4624276B5A2296478.pubring.gpg'
2013-06-28 07:09:35 +00:00
Isis Lovecruft 8232f14f2a
Remove commented out code from GPG.gen_key() for import after generation.
* Generated keys in separate keyring would not be available after switching
   back to the normal keyrings (not the ones set up for key generation), so at
   first in the unittests I imported them back into the main keyrings… this,
   however, is would be stupid, as in nullifies half the reasons for using
   separate keyrings in the first place, thus the code was commented out. Now
   that the temporary keyrings are placed in the gnupg.GPG._generated_keys
   directory, it would be nice to eventually either extend GPG.import_keys()
   or add a new helper function for doing:

       $ gpg --no-default-keyring --keyring pubring.gpg \
            --keyring ./generated-keys/<some_fingerprint>.gpg
2013-06-28 06:44:52 +00:00
Isis Lovecruft 9008faa0db
Fix a misnamed variable in gnupg.py; self._key_dir→self._keys_dir 2013-06-28 06:42:42 +00:00
Isis Lovecruft 1afcda8364
Fix a misnamed process thread variable. 2013-06-09 08:25:34 +00:00
Isis Lovecruft 295d98fbdc
GPG.encrypt_file()→GPGBase.encrypt() and fix doctests and documentation. 2013-06-04 01:42:07 +00:00
Isis Lovecruft 785b2760bb
Move GPG._sign_file() to GPGBase since it's never called directly. 2013-06-03 21:34:39 +00:00
Isis Lovecruft 042d52a75f
Move source files to directory named for top-level package. 2013-06-03 21:16:19 +00:00
Isis Lovecruft c97b51fec5
Add versioneer and restructure the repo into a src/ dir. 2013-05-12 09:32:46 +00:00
Isis Lovecruft cc7beb7185
Rewrite GPG.decrypt_file(). 2013-05-11 18:26:14 +00:00
Isis Lovecruft cfd7b38242
Add option to delete subkeys with GPG.delete_keys().
* TODO this needs unittests.
2013-05-11 18:25:17 +00:00
Isis Lovecruft dce4b4a226
Rename handle_status() parser methods to be private to cleanup the API. 2013-05-11 18:10:41 +00:00
Isis Lovecruft e4f2d533b1
Add cipher, compress, and digest preferences and rename parameters.
* Rename gpghome to homedir.
 * Rename gpgbinary to binary.
 * Add setting to append '--no-use-agent' to the command string in an attempt
   to overcome bugs resulting on systems where the user has gpg-agent running
   in the background (with some configurations, this is run before X is
   started, and killing the agent can result in X dying) and GnuPG tries to
   call the program specified by the symlink at /usr/bin/pinentry, result in
   encryption and decryption failing due to the '--batch' option blasting
   through pinentry without input. This results in a complaint from GnuPG:

       gpg: Sorry, no terminal at all requested - can't get input

   This bug also prevents symmetric encryption/decryption from working in a
   similar manner.
       Daniel Kahn Gilmor's monkeysphere, if I am recalling correctly, has a
   hack to remove the $DISPLAY variable from the users environment, and then
   add it back in, but frankly this option frightens me, as unsetting the
   display could result in all X applications failing.
       Werner Koch's suggestions, from the gnupg-devel mailing list are:
   http://lists.gnupg.org/pipermail/gnupg-users/2007-April/030927.html
       And, for the record, '--no-use-agent' doesn't disable pinentry.
2013-05-11 18:03:41 +00:00
Isis Lovecruft 458b8a4c2c
Remove unused logger statement. 2013-05-11 14:48:45 +00:00
Isis Lovecruft 228cec9533
Add all available key fields for GPG.gen_key_input to the docstring. 2013-05-11 08:49:37 +00:00
Isis Lovecruft a7afce0394
Add a testing mode to GPG.gen_key_input() which uses insecure PRNG.
* This should only be used in the unittests, as the PRNG it uses in GnuPG does
   not create strong keypairs (though it's faster, thus why we're using it for
   testing).
2013-05-11 08:43:33 +00:00
Isis Lovecruft f95c3c7c1e
Remove old TODO comment. 2013-05-10 09:50:56 +00:00
Isis Lovecruft d392265101
Fix two bugs, one due to an extra pair of quotes, the other due to strformat. 2013-05-10 09:45:39 +00:00
Isis Lovecruft b66fc4ca82
Add subkey support and a docstring to GPG.export_keys(). 2013-05-10 09:44:07 +00:00
Isis Lovecruft 55185d528b
Separate options into tidy groups so that the parser handles them efficiently. 2013-05-10 09:42:30 +00:00
Isis Lovecruft fdaadcbd20
Fix a bug due to calling a GnuPG option which was removed several versions ago. 2013-05-10 09:40:36 +00:00
Isis Lovecruft 5d0e45170f
Add a docsting for GPG.delete_keys(). 2013-05-10 09:39:40 +00:00
Isis Lovecruft 04a79a2802
Remove the version string from generated keys, encrypted files, and sigs. 2013-05-10 09:33:07 +00:00
Isis Lovecruft df5346694d
Get rid of the "--no-show-photos is deprecated" GnuPG warning. 2013-04-17 22:49:09 +00:00
Isis Lovecruft bd853d3fdb
Make the util module private. 2013-04-17 22:48:07 +00:00
Isis Lovecruft 0bc97dd48b
Move _copy_data(), _write_passphrase(), and _threaded_copy_data() to util. 2013-04-17 22:47:13 +00:00
Isis Lovecruft 0394034236
Add key generation utility functions.
* Add util._make_passphrase() for creating a random string passphrase and
   optionally writing it to a file only readable by the real uid of the
   running process.
 * Change the util._today() function to _next_year(), which gives us today's
   date a year from now, for setting the default expire date in
   GPG.gen_key_input().
2013-04-17 20:58:49 +00:00
Isis Lovecruft 9288f8eead
Add docstring for GPG.gen_key_input(). 2013-04-17 20:57:51 +00:00
Isis Lovecruft a9faa376e7
Update docstring for GPG.genkey(). 2013-04-17 20:54:39 +00:00
Isis Lovecruft faf102e6ac
Remove old commented out code for keyring generation in GPG.__init__(). 2013-04-17 20:53:56 +00:00
Isis Lovecruft 56131179c6
Add stub GPG.list_sigs() function. 2013-04-17 00:16:28 +00:00
Isis Lovecruft 9dc2947014
Update docstrings for GPG.decrypt() and GPG.send_keys(). 2013-04-17 00:14:06 +00:00
Isis Lovecruft 961b63f958
Add explicit --no-show-photos option to GPG.list_keys() just in case. 2013-04-17 00:12:18 +00:00
Isis Lovecruft 2fb88ad6b4
Fix function verify_file() to handle detached signature files. 2013-04-16 23:09:05 +00:00
Isis Lovecruft 301fd6f89c
Clean up the logging statements in _sign_file(). 2013-04-16 23:07:37 +00:00
Isis Lovecruft 70b8269aaf
Remove one of the sources of the UnicodeDecodeErrors on Python2.6. 2013-04-16 23:06:42 +00:00
Isis Lovecruft 807aa9821b
Make log statements in _copy_data() more explicit. 2013-04-16 22:45:33 +00:00
Isis Lovecruft 07310a860e
Move _make_binary_stream() to util module and update unittests. 2013-04-15 01:42:55 +00:00
Isis Lovecruft b09adb3f19
Remove extra output handing logic in GPG.encrypt_file(). 2013-04-15 01:13:47 +00:00
Isis Lovecruft f357c16a21
Move dreb's GPGWrapper class to gnupg.py. 2013-04-15 01:12:36 +00:00