Commit Graph

110 Commits (f65618bd83e06f4be69e4768d2e526b64f83a4e2)

Author SHA1 Message Date
Isis Lovecruft f65618bd83
Remove unused function _underscore(). 2013-04-10 22:44:10 +00:00
Isis Lovecruft 58de4c6c21
Make a logger statement more explicit. 2013-04-10 21:58:56 +00:00
Isis Lovecruft 0ae817e3b8
Update _sanitise() docstring with information on return object. 2013-04-10 21:56:55 +00:00
Isis Lovecruft 38cc813412 Rearrange the logic on checking safe_values so that None is skipped. 2013-04-10 21:49:44 +00:00
Isis Lovecruft dd25c3742a Remove some extraneous log statements, make others more explicit. 2013-04-10 21:49:44 +00:00
Isis Lovecruft 582a17beb8 Remove a comment about pre-Python2.6 compatibility, since we don't care. 2013-04-10 21:49:44 +00:00
Isis Lovecruft 0ce277a367 Add options '--list-secret-keys' and '--fixed-list-mode' to _is_allowed(). 2013-04-10 21:49:44 +00:00
Isis Lovecruft d861b36305 Fix #2162 add stream check. 2013-04-10 21:49:44 +00:00
Isis Lovecruft 00e94d6b34
Hack around the nasty ctb=%d.02 GnuPG bug that keeps resurfacing.
* https://bugs.g10code.com/gnupg/issue1179

 * This bug has resurfaced several times in GnuPG's history, and as far as I've
   understood it, it is due to a generation or an attempt at parsing a .gpg
   file (a message/file, or one of the keyrings) which is generated/formatted
   such that the GnuPG data packets comprise a certain number of bytes (562
   bytes precisely) and/or the demarcation signal (two equal signs, '==') of
   the trailing ctb (I assume 'ctb' stands for cipher text bytes; it's
   everywhere in GnuPG's sourcecode) CRC checksum ends up on its own line, like
   so:

        -----BEGIN PGP MESSAGE-----

        hQIMA1DJjYe0ARAPAQ/6A7PWiyfiBIpbJ7+XbaptYPB0muoi3rXF4cuIXU37uDug
        04Cck+8u9hcMjhYd0pN6zJMJLO8CUOdUKJblpxPSYc7yanJDc33n1jsdkr7XNbbz
        Xjh1z3EJZPhhp3YE7lqgnTTXQsGUihnhwiQqsuNgCVZfSwXpVFa+IHC+/AXhAPLl
        /BoY6+YOupD8G4bOUCU/XBvQp8uH9kh9n9101+6SopJ94H354X0PtZJs5BISCW7g
        /tUxAqxLesDaZkHF91HL7AJE8+/pheTc8vHGP+Zu8/Q5Lr+GW2cUrCXXxUV/xRIh
        P7t7WDdU5V1BXyughEBP7Jwr8G3llKr42ZRVgvOyFIe+sMVibq2dEhxJr/sjR0j6
        lYws+tZVWbmuxOnMDCjgIaEverU0nnd1SqQ/tS7yFh8lpBfMay2IdVVh+Bi3zDeT
        Kb/h3tCjG0++h5FuG8UBWv13LRlfcF817ShnwoG80y4cESgCXxZGkd9DRExH8wy8
        VJpIaVKiaZs5jlHLHX4JWy2IVmEvk/6xwZZwrNV4sGYzDGkxHLyTUUQu/NOkCtAb
        2Zs9mGrtsSGSoP6lfKDk9hh8fJtPGxGzIezVR9WXYKeYAfGZOzMI1Ji1jF1fO21G
        KqTaF2WnWfaWmsuICTiBntgNntZRsXwmMNkcBt5LVK8uRpWQqIQmAkN4vl6SgovS
        QAHrC6D9mUmoNvKcS71aH4uZjkfYtNmgp8i5cmTP6UaGouVeqzDCtK/vIy1V/iaX
        89vcdsILlMMVB/10Rtscyus
        ==suET
        -----END PGP MESSAGE-----

    When this happens, GnuPG *stops* parsing entirely before the CRC checksum
    following the '==', and thus the next time it starts parsing again the
    first thing it gets is the end header '-----END PGP MESSAGE-----'.

 * My solution for hacking around this is to export directly to a keyring,
   which can either be one we create for this purpose, or the keyring set as
   self.pubring. I do not know yet if this will affect --list-keys.
2013-04-10 21:49:35 +00:00
Isis Lovecruft dc0d9cf70b
Update docstring for GPG.gen_key_input() with details on batch file syntax. 2013-04-10 19:16:58 +00:00
Isis Lovecruft 24da4d186c
Factor out unnecessary parsing for the presence of the passphrase fd. 2013-04-10 19:15:43 +00:00
Isis Lovecruft c96aed31ed
Add function for getting a string of today's date in %Y-%m-%d format. 2013-04-10 19:14:48 +00:00
Isis Lovecruft 8c6821ea0e
Remove log statement entirely because otherwise it's triplicate. 2013-04-10 18:03:52 +00:00
Isis Lovecruft b8ce529638
Remove duplicate log statement of the GnuPG command we're running. 2013-04-10 18:00:00 +00:00
Isis Lovecruft a54fa33ff5 Bump because minor version because we've rewritten large chunks of the codebase. 2013-04-10 17:51:06 +00:00
Isis Lovecruft 0c5fda7da4
GnuPG wants pubring for its option '--keyring'. Fuck GnuPG. 2013-04-10 17:22:59 +00:00
Isis Lovecruft af7e952b42
Factor out some unnecessary string parsing code. 2013-04-10 17:22:09 +00:00
Isis Lovecruft 5fd040c793
Remove extraneous logger statement. 2013-04-10 17:21:11 +00:00
Isis Lovecruft e978f34712
Add '--secret-keyring' as an allowed option. 2013-04-10 17:20:47 +00:00
Isis Lovecruft 9af49dbce5
Add missing option `--batch` to _allowed options set.
* Rearranged the other options because their order was nolens volens.
2013-04-09 17:35:10 +00:00
Isis Lovecruft f9bd8e928e
Updated documentation and .rst files for Sphinx. 2013-04-06 00:35:40 +00:00
Isis Lovecruft bb65660586
Add missing super() call in ListKeys class. 2013-04-05 21:28:26 +00:00
Isis Lovecruft 1e4fa9e2f4
Refactor old docstrings to have PEP8 conformant three double quotes. 2013-04-05 21:27:21 +00:00
Isis Lovecruft 53c90f4469
Fix a bug where gpg status message handling did not work for signatures.
* If an attempt was made to check a signature and none was found, the
   status message would not get handled.
2013-04-02 13:06:46 +00:00
Isis Lovecruft 4d28854feb
Add module name in order to register it in test_gnupg.py. 2013-04-02 12:49:25 +00:00
Isis Lovecruft 4aded0141f
Shorten code for setting keyring paths. 2013-04-02 10:36:55 +00:00
Isis Lovecruft 7840360bb4
General code cleanup.
* Move exceptions and global parameters to top of file.
 * Move global function to top of file before classes and alphabetise them.
2013-04-02 10:27:26 +00:00
Isis Lovecruft b8fd74dde3
Change keyring file specification options.
* Add DeprecationWarning for gnupg.GPG.keyring parameter, and first steps
   towards moving to use gnupg.GPG.secring and pubring instead, because
   'keyring' seemed unclear as to which keyring it was referring to.
 * Add checks for keyring files, and create them if they are not there.
 * Update documentation for gnupg.GPG.__init__().
2013-04-02 10:13:59 +00:00
Isis Lovecruft c5611782a7
Modify logic for creating path to secret keyring. 2013-04-02 09:31:16 +00:00
Isis Lovecruft 931792cd9b
Fix error where unpermitted variables would remain on a heap. 2013-04-02 08:58:03 +00:00
Isis Lovecruft d8351e52e9
Change assert to check for bytearray stream rather than file handle. 2013-04-02 05:38:32 +00:00
Isis Lovecruft 4a00a56456
Rearrange the assignment of self.gpghome to go before self.gpgbinary. 2013-03-19 07:14:48 +00:00
Isis Lovecruft 629d13c27c Reorder checks in gnupg.GPG.__init__() in a more sensible way. 2013-03-18 19:36:30 +00:00
Isis Lovecruft 3c6376a598 Add function _sanitise_list() for sanitising lists of options. 2013-03-18 19:36:30 +00:00
Isis Lovecruft 915a74022a Fix an error where a list filo would raise an IndexError. 2013-03-18 19:36:30 +00:00
Isis Lovecruft eaeda9d9a8 Update debugging logging strings. 2013-03-18 19:36:30 +00:00
Isis Lovecruft 618567b1d8 Fix a bug where sometimes sanitised options values were not being added. 2013-03-18 19:36:30 +00:00
Isis Lovecruft b5f687060c Deduplicate code assertion checks in GPG.__init__(). 2013-03-18 19:36:30 +00:00
Isis Lovecruft 225c05bf58 Add additional allowed options --fingerprint and --with-colons. 2013-03-18 19:36:30 +00:00
Isis Lovecruft 617eb53e57 Apply patch 0001: Make _open_subprocess argument more explicit in _handle_io(). 2013-03-18 19:36:30 +00:00
Isis Lovecruft 311ee4b83b Add unittest for discovery of keyring files. 2013-03-18 19:36:30 +00:00
Isis Lovecruft b776247176 Cleanup the docstring and code in gnupg.GPG.list_keys(). 2013-03-18 19:36:30 +00:00
Isis Lovecruft 608efaf60a Rewrite method gnupg.GPG.make_args() to use lists for _sanitise(). 2013-03-18 19:36:30 +00:00
Isis Lovecruft a7940e3c84 Rewrite checks in gnupg.GPG.__init__(). 2013-03-18 19:36:30 +00:00
Isis Lovecruft 852a0fae97 Rewrite function _sanitise(). 2013-03-18 19:36:29 +00:00
Isis Lovecruft 7ac7af9bcb Update list of allowed gpg options. 2013-03-18 19:36:29 +00:00
Isis Lovecruft b35309e73f Update docstrings in several functions.
* Including updates to:
   _underscore()
   _hyphenate()
   _is_allowed()
2013-03-18 19:36:29 +00:00
Isis Lovecruft 058c6f6ca8 Change _is_file to return booleans and never raise anything. 2013-03-18 19:36:29 +00:00
Isis Lovecruft babff61ec2 Shorten assertion string in gnupg.GPG.__init__(). 2013-03-18 19:36:29 +00:00
Isis Lovecruft ed63f622a1 Change logger messages in gnupg.GPG.sign() to be at the debug level. 2013-03-18 19:36:29 +00:00