1-*- mode: org -*- 2 3* I/O :io: 4** TODO in GPG.__make_args() :io:makeargs: 5It would be nice to make the file descriptors for communication with the GnuPG 6process configurable, and not the default, hard-coded 0=stdin 1=stdout 72=stderr. 8 9* Key editing :editkey: 10** TODO add '--edit-key' feature :editkey: 11see :compatibility:gen__key_input: 12 13* Compatibility between GnuPG versions :compatibility: 14** TODO GnuPG>=2.1.0 won't allow key generation with preset passphrase 15*** DONE add version detection for GPG.gen_key_input() :compatibility:gen_key_input: 16DONE: use gnupg._util._is_gpg2() and gnupg.util._is_gpg1() to check versions 17 18If we add a GnuPG version detection feature (the version string is already 19obtained in GPG.___init___() [[gnupg.py:407]]), then we can automatically chain 20GPG.gen__key_input() to another new feature for '--edit-key'. This chaining 21would likely need to happen here [[gnupg.py:1146]]. 22 23*** TODO passphase setting for GnuPGv2.x in GPG.gen__key_input() :compatibility:gen_key_input: 24In the docstring of GPG.gen__key_input() [[gnupg.py:1068]], for the parameter 25'passphrase', it is explained that: 26 27 :param str passphrase: The passphrase for the new key. The default is 28 to not use any passphrase. Note that 29 GnuPG>=2.1.x will not allow you to specify a 30 passphrase for batch key generation -- GnuPG 31 will ignore the ``passphrase`` parameter, stop, 32 and ask the user for the new passphrase. 33 However, we can put the command '%no-protection' 34 into the batch key generation file to allow a 35 passwordless key to be created, which can then 36 have its passphrase set later with '--edit-key'. 37 38*** TODO add '--edit-key' feature :editkey: 39This would be necessary for adding a passphrase to the key after passwordless 40generation in GnuPG>=2.1.0. 41 42** DONE GnuPG==1.4.12 doesn't process "Key-Type: default" in batch files 43 44DONE: GnuPG version detection in gen_key_input() was added in commits 456eccbe704841cca90573dc554019712528d927a0 and 461e867d6e117f603cd9f2238641a1fb9cb87d4b51 47 48(python-gnupg)∃!isisⒶwintermute:~/code/riseup/python-gnupg ∴ ipython 49WARNING: Attempting to work in a virtualenv. If you encounter problems, please install IPython inside the virtualenv. 50 51In [1]: import gnupg 52GnuPG logging disabled... 53 54In [2]: gpg = gnupg.GPG(homedir='./tests/doctests') 55 56In [3]: key_input = gpg.gen_key_input() 57 58In [4]: print key_input 59Key-Type: default 60Key-Length: 4096 61Subkey-Type: default 62Name-Email: isis@wintermute 63Expire-Date: 2014-05-28 64Name-Real: Autogenerated Key 65%commit 66 67 68In [5]: key = gpg.gen_key(key_input) 69 70In [6]: print key.stderr 71gpg: -:1: invalid algorithm 72[GNUPG:] KEY_NOT_CREATED 73 74 75In [7]: quit() 76(python-gnupg)∃!isisⒶwintermute:~/code/riseup/python-gnupg ∴ which gpg 77/usr/bin/gpg 78(python-gnupg)∃!isisⒶwintermute:~/code/riseup/python-gnupg ∴ gpg --version 79gpg (GnuPG) 1.4.12 80Copyright (C) 2012 Free Software Foundation, Inc. 81License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> 82This is free software: you are free to change and redistribute it. 83There is NO WARRANTY, to the extent permitted by law. 84 85Home: ~/.gnupg 86Supported algorithms: 87Pubkey: RSA, RSA-E, RSA-S, ELG-E, DSA 88Cipher: 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH, CAMELLIA128, 89 CAMELLIA192, CAMELLIA256 90Hash: MD5, SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224 91Compression: Uncompressed, ZIP, ZLIB, BZIP2 92(python-gnupg)∃!isisⒶwintermute:~/code/riseup/python-gnupg ∴ 93 94* Code cleanup :cleanup: 95** TODO in parsers.__sanitise() :cleanup:sanitise: 96Ughh...this is the ugliest code I think I've ever written. It works, but I 97worry that it is fragile, not to mention *I* have trouble reading it, and I 98fucking wrote the damn thing. There's probably not much that could be done to 99make it more Pythonic, because type checks and input validation are pretty much 100intrinsically non-Pythonic. But did i mention that it's ugly? I'm sure these 101functions would be pretty glad to get a shower, shave, and haircut. 102 103** TODO in parsers.__is_allowed() :cleanup:is_allowed: 104There is a lot of madness dealing with stupid things like hyphens 105vs. underscores, and lists of options vs. strings. This can *definitely* be 106cleaned up. 107 108