Commit Graph

166 Commits (f11ea6901cdd0a01ac713c23f8635c9e86a3fa7d)

Author SHA1 Message Date
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 603379eb37
Change _copy_data() error handling to explain errors not due to broken pipes. 2013-06-28 06:40:09 +00:00
Isis Lovecruft 328e8fcbe0
Add a 'generated-keys' subdirectory to gnupg.GPG.homedir.
* Add GPG._generated_keys as an _utils.InheritableProperty class for storing
   a configurable (even by subclasses of GPGBase, without property overrides)
   subdirectory of whichever directory gnupg.GPG.homedir is set to. This
   subdirectory can be used via the 'separate_keyring=True' option to
   gnupg.GPG.gen_key_input(), which will switch temporarily to new pubring.gpg
   and secring.gpg keyrings during key creation, and upon finishing creation
   of the new key, will ask for the new key's fingerprint, and move the
   keyrings into this GPG._generated_keys directory, renamed in the format
   "<GPG.homedir>/<GPG._generated_keys>/<fingerprint>.[pub|sec]ring.gpg".
2013-06-28 06:29:38 +00:00
Isis Lovecruft 9d5cdb8854
Fix upstream issue #62, handle expired keys.
* see https://code.google.com/p/python-gnupg/issues/detail?id=62
2013-06-28 02:31:37 +00:00
Isis Lovecruft d129ed5b17
Add _parsers.GenKey.secring and _parsers.GenKey.keyring attributes and docs. 2013-06-28 02:30:57 +00:00
Isis Lovecruft f996bf9e31
Update _parsers._sanitise_list() documentation. 2013-06-28 02:30:20 +00:00
Isis Lovecruft 4fcfef1bde
Add _parsers._is_string() function, and change _sanitise() to use it. 2013-06-28 02:29:36 +00:00
Isis Lovecruft 4871e9e038
Move allowed_options into separate groups in their own functions. 2013-06-28 02:28:29 +00:00
Isis Lovecruft 9b9e441dd7
Update function docs for _parsers._is_allowed() function. 2013-06-28 01:44:04 +00:00
Isis Lovecruft 1e03011296
Remove unnecessary comment, there is now a unittest for this condition. 2013-06-28 01:42:05 +00:00
Isis Lovecruft e1139c7e37
Remove commented out code from _util._copy_data(). 2013-06-09 08:36:22 +00:00
Isis Lovecruft bcaa26685b
Change several imports for installed modules to be absolute in _meta.py. 2013-06-09 08:35:17 +00:00
Isis Lovecruft a707a50c31
Update test directory shortcut in gnupg/_logger.py. 2013-06-09 08:34:15 +00:00
Isis Lovecruft ceb38fdefe
Change directory shortcuts in gnupg._util.py module. 2013-06-09 08:33:30 +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 25637ef50e
PEP-8ify a couple lines that were running off the screen.
* Also, change a logger string to say 'GnuPG' instead of the binary's name
   'gpg'.
2013-05-11 18:34:28 +00:00
Isis Lovecruft e3eb7eea0c
Fix an old-style class. 2013-05-11 18:33:39 +00:00
Isis Lovecruft 2700b3c338
Return the result of a encryption or decryption operation without *.data 2013-05-11 18:32:18 +00:00
Isis Lovecruft e5ac938486
Add hastily written check_preferences().
* TODO I sleepily realised two lines before the end of bashing this out that
   it should just be a set difference.
2013-05-11 18:30:22 +00:00
Isis Lovecruft 4258900368
Fix a bug which caused result_map['crypt'] to expect a Verify(). 2013-05-11 18:28:47 +00:00
Isis Lovecruft 0785d7dd3b
Various docstring and whitespace fixes in parsers.py. 2013-05-11 18:28:04 +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 ae0ab0a7c7
WHO PUTS UNITTESTS IN A TRY/EXCEPT BLOCK WHICH CATCHES ALL EXCEPTIONS?!
* WHAT WAS THE POINT OF WRITING THE UNITTEST IF IT ALWAYS PASSES?
2013-05-11 18:22:50 +00:00
Isis Lovecruft 347cecb9f2
Add unittests for multiparty file en/decryption and symmetric en/decryption. 2013-05-11 18:22:07 +00:00
Isis Lovecruft 23b3315c45
Remove old logger statements and comments. 2013-05-11 18:20:49 +00:00
Isis Lovecruft b76bf502c9
Add better unittests for homedir and keyring creation. 2013-05-11 18:19:59 +00:00
Isis Lovecruft f06c2d7396
Cleanup docstring for GPGTestCase.setUpClass(). 2013-05-11 18:19:04 +00:00
Isis Lovecruft 2a92e3f10b
Since we use '--no-emit-version', we don't need this anymore. 2013-05-11 18:18:18 +00:00
Isis Lovecruft d38efaffbc
Use proper tempfile isolation of GnuPG homedirs in unittests. 2013-05-11 18:17:22 +00:00
Isis Lovecruft 14ffe14569
Add a unittest and a fix for hexidecimal inputs with lowercase. 2013-05-11 18:16:18 +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 38057cfe1c
Add various new options and assign input parsers to them. 2013-05-11 18:09:33 +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 adaf53c256
Fix a call in a unittest to _make_binary_stream() to call the correct module. 2013-05-11 08:55:47 +00:00
Isis Lovecruft 79bf77a185
Update test_import_and_export() unittest with newer key generation utility. 2013-05-11 08:54:17 +00:00
Isis Lovecruft 6c87679e7e
Fix a bug in two unittests caused by a method not having been renamed. 2013-05-11 08:53:12 +00:00
Isis Lovecruft ed2bc4d882
Split the old test_encryption_and_decryption() up into several smaller tests. 2013-05-11 08:51:48 +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 863ad194a5
Cleanup indentation style a bit. 2013-05-11 08:48:39 +00:00
Isis Lovecruft b562a346ff
Fix typo in docstring. 2013-05-11 08:48:12 +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