Commit Graph
100 Commits
Author SHA1 Message Date
William Grant e9d01800de Canonicalizationpolicy.from_c_value() now raise InvalidCanonicalizationPolicyErrors instead of logging and returning None. 2011-06-04 15:51:14 +10:00
William Grant 79eff489d4 Extract c= value manipulation into a new (tested) CanonicalizationPolicy. 2011-06-04 14:40:06 +10:00
William Grant 3008ad76a7 Capitalise and unexport dkim.canonicalization.algorithms. 2011-06-04 14:38:29 +10:00
William Grant f8e938c152 Use CanonicalizationPolicy in sign(). 2011-06-04 14:37:18 +10:00
William Grant 6b4b98478b Add CanonicalizationPolicy.to_c_value(). 2011-06-04 14:37:07 +10:00
William Grant 206c860890 Pull c= value parsing out into Canonicalizationpolicy.from_c_value. 2011-06-04 14:30:19 +10:00
William Grant 7b1a3f70dc Add CanonicalizationPolicy, which encapsulates the combined hybrid simple/relaxed schemes. 2011-06-04 14:05:54 +10:00
William Grant 19b554212e Quick fix to make end-to-end tests verify all canonicalization cases. Tests for bug #587783. 2011-06-04 13:46:57 +10:00
William Grant eb31f6d685 Extract and test DNS and canonicalization and some hashing functions. 2011-06-04 00:17:22 +10:00
William Grant 382d9157c5 Fix get_txt to assume unicode results. 2011-06-03 23:13:45 +10:00
William Grant 472750c0db Signature algorithm names are now defined in dkim.crypto. 2011-06-03 22:34:23 +10:00
William Grant 5f949337d1 Handle Unicode in get_txt. 2011-06-03 22:24:21 +10:00
William Grant a82f3110ea Split out DNS utilities into their own module. 2011-06-03 22:07:42 +10:00
William Grant b78a41d6bf Add an __all__. 2011-06-03 22:04:21 +10:00
William Grant 5da23e5856 rstrip header field names in relaxed, as the spec says. 2011-06-03 22:03:41 +10:00
William Grant 61cd0e1080 Factor out all the canonicalization regexps. 2011-06-03 22:03:14 +10:00
William Grant 28aaa6f2f2 dkim.canonicalization now has an algorithms dict mapping names to algorithms. Use it. 2011-06-03 21:52:33 +10:00
William Grant a1fc55bcaa Rewrite tests to use an assertCanonicalForm helper. 2011-06-03 21:25:20 +10:00
William Grant 589853aee5 Split out dkim.canonicalization, and test it. Note that test_wsp_strips_headers is correctly failing, as trailing whitespace is not stripped from header names. 2011-06-03 21:16:31 +10:00
William Grant 1721b7fec2 Drop Python 2.5 support, add 3.1 and 3.2. 2011-06-03 00:18:38 +10:00
William Grant f4875a8768 Don't crash when asked to verify a badly encoded domain or selector. 2011-06-02 23:07:01 +10:00
William Grant 30bf1bc171 Fix DeprecationWarnings in tests. 2011-06-02 19:12:49 +10:00
William Grant d9e3b49a8e Make encodings all ascii/utf-8 as appropriate. 2011-03-19 22:44:46 +11:00
William Grant b6d9e35a1d Update Python version and DNS library requirements in README. 2011-03-19 21:55:38 +11:00
William Grant 67b3fdc4f0 Port dkimsign.py. 2011-03-19 21:41:52 +11:00
William Grant bc78c7d1d0 python2.6 doesn't have assertRaisesRegexp. 2011-03-19 21:25:00 +11:00
William Grant 672c6084e3 python2.6 base64.b64encode doesn't like bytearrays... convert to bytes instead. 2011-03-19 21:24:48 +11:00
William Grant ed9bc94fa2 Fix test_dkim's mock dnstxt to do unicode. 2011-03-19 21:24:22 +11:00
William Grant cb4b034941 python2.6's sys.version_info isn't a namedtuple. 2011-03-19 21:04:48 +11:00
William Grant 5726afce8d Port dkimverify.py. 2011-03-19 21:03:22 +11:00
William Grant 44db746563 More bytestring conversions in __init__. pydns seems to like to deal with unicode, so convert on the way in and back. 2011-03-19 21:01:54 +11:00
William Grant 3cf0a5ce9f Merge pydns support from trunk. 2011-03-19 20:58:23 +11:00
William Grant 128288a20c Fall back to pydns if dnspython is unavailable. 2011-03-19 20:56:37 +11:00
William Grant 8cf859db4f bytesify __init__. Tests now parse if dns.resolver is removed. 2011-03-19 20:09:01 +11:00
William Grant e176c8fd4b Bytesify test_dkim. 2011-03-19 20:08:31 +11:00
William Grant df47a7d88e And fix test_crypto to pass. 2011-03-19 19:13:48 +11:00
William Grant 54e553ee8d Fix dkim.asn1. 2011-03-19 19:13:34 +11:00
William Grant 7949bff344 Make dkim.crypto mostly work. 2011-03-19 19:04:11 +11:00
William Grant e220d2da1d asn1_length fixed. 2011-03-19 18:54:31 +11:00
William Grant be1368f374 Make str2int/int2str work with bytes. 2011-03-19 18:52:35 +11:00
William Grant 9af52236fc parse_tag_value now deals with bytes. 2011-03-19 18:47:51 +11:00
William Grant 88915e3a01 Fix some test_crypto literals to be byteses. 2011-03-19 18:45:04 +11:00
William Grant dcf0580406 Open data files as binary for now. 2011-03-19 18:44:49 +11:00
William Grant f5db65966e Use new 2.6/3.x except syntax. 2011-03-19 18:36:19 +11:00
William Grant e0fca7e613 Stop using deprecated map(). 2011-03-19 18:36:00 +11:00
William Grant f29addb823 Use normal Python logging everywhere, not printing to debuglog. 2011-03-19 18:31:48 +11:00
William Grant 46c57176a2 Use normal Python logging everywhere, not printing to debuglog. 2011-03-19 18:27:11 +11:00
William Grant 167b2986d7 validate_signature_field now raises a ValidationError if it finds an issue. 2011-03-19 18:04:41 +11:00
William Grant 80c518d30b Fix EMSA-PKCS1-v1_5-ENCODE digest length check. The spec requires at least 8 bytes of padding. 2011-03-19 17:33:11 +11:00
William Grant d5ffbac38a EMSA_PKCS1_v_1_5_encode now works out the hash ID itself. 2011-03-19 17:14:14 +11:00
William Grant fab1be9f2d Comment key data. 2011-03-19 16:48:09 +11:00
William Grant e47c470acf Test dkim.crypto. 2011-03-19 16:45:25 +11:00
William Grant 152458defe Test RSASSA. 2011-03-19 16:39:57 +11:00
William Grant 2ee087da01 Extract parse_pem_private_key, and test it and parse_public_key. 2011-03-19 16:23:48 +11:00
William Grant d79c856ef0 RSA tests. 2011-03-19 15:03:53 +11:00
William Grant bcbf8feacf Add int2str/str2int tests. 2011-03-17 22:47:50 +11:00
William Grant 916d61bdff Add EMSA-PKCS1-v1_5-ENCODE tests. One fails because we don't require at least 8 bytes of padding. 2011-03-17 22:39:45 +11:00
William Grant f1c9fe1911 Move dkim.util tests into test_util. 2011-03-16 23:20:52 +11:00
William Grant 9aea8985fb Support multiple test modules. 2011-03-16 23:03:52 +11:00
William Grant ae9ffbc86f Factor out most crypto bits into their own functions and modules, where they can sensibly be tested. 2011-03-13 18:55:30 +11:00
William Grant f1720d15f3 Fix up copyright notice. 2011-03-13 18:07:21 +11:00
William Grant 440dd14de0 Correct crypto exception handling. 2011-03-12 17:19:59 +11:00
William Grant bafc0d5ea6 Raise a DigestTooLarge exception if it won't fit within the requested message length. 2011-03-12 15:46:58 +11:00
William Grant bd7a6e6933 Slightly improved asn1 docstrings. 2011-03-12 15:41:02 +11:00
William Grant 7fa823748d crypto docstrings. 2011-03-12 15:37:25 +11:00
William Grant 7dec2e4697 Merge trunk. 2011-03-12 12:32:14 +11:00
William Grant c19043d70f Use a better, tested Tag=Value parser. 2011-03-12 12:28:39 +11:00
William Grant e74405d27a Raise more descriptive exceptions, DuplicateTag and InvalidTagSpec. 2011-03-12 12:24:55 +11:00
William Grant 160718f9b2 Add @param. 2011-03-12 12:18:22 +11:00
William Grant f6b9bb1b27 Factor out a few functions. Not yet tested. 2011-03-12 12:16:48 +11:00
William Grant 142285bc03 More docstrings. 2011-03-12 12:09:43 +11:00
William Grant ed497a40d6 Add docstrings to the two crypto functions. 2011-03-12 12:05:15 +11:00
William Grant fdd36b7cd4 Add basic end-to-end tests. 2011-03-12 11:22:37 +11:00
William Grant 44cb4c357d Only exclude .testrepository at the root. 2011-03-12 11:20:30 +11:00
William Grant f9c2c2dcd9 Add license header to test_dkim. 2011-03-10 09:32:15 +11:00
William Grant cbe755269c Restore erroneously removed license header. 2011-03-10 09:31:03 +11:00
William Grant bbe60e0646 int2str returns a string instead of a list, so the ''.join() is redundant. 2011-03-10 00:05:42 +11:00
William Grant 7526317dfe Unexport EMSA_PKCS1_v1_5_encode; it's only used by RSASSA_PKCS1_v1_5_*. 2011-03-10 00:03:26 +11:00
William Grant c82703cea9 Implement RSASSA-PKCS1-v1_5 in dkim.crypto, and use that in verify() and sign(). Move str2int/int2str into dkim.crypto. Verification no longer does a constant-time string compare; there is no private key involved on which a timing attack could be performed. 2011-03-10 00:03:15 +11:00
William Grant 5898094fe1 Factor out RSA into perform_rsa. 2011-03-09 23:37:59 +11:00
William Grant 6f715a1a01 Extract crypto stuff to dkim.crypto. 2011-03-09 23:27:04 +11:00
William Grant b6d3502f9e Split ASN.1 utilities out into their own file. 2011-03-09 23:23:01 +11:00
William Grant b3225a0a24 Extract parse_private_key. 2011-03-09 23:14:11 +11:00
William Grant fb2d8678fd Use parse_tag_value in verify(). 2011-03-09 22:54:41 +11:00
William Grant 42a463cc23 Test that whitespace around tags and values is stripped. 2011-03-09 22:50:08 +11:00
William Grant f8fb2d952d Fail if there is a duplicate tag. 2011-03-09 22:48:34 +11:00
William Grant 98c72db3b1 Add a (hopefully correct) Tag=Value list parser, with tests. 2011-03-09 22:46:17 +11:00
William Grant a6374ed26d Extract signature field validation. 2011-03-09 21:40:51 +11:00
William Grant ece86c0e67 Shrink the mandatory fields check. 2011-03-09 21:36:46 +11:00
William Grant 2437ab75a3 Extract public key parsing. 2011-03-09 21:21:58 +11:00
William Grant 160fb39e39 Extract hash_headers. 2011-03-09 20:59:10 +11:00
William Grant 405757ef49 Use the new EMSA-PKCS1-v1_5 function in verify() too. 2011-03-09 20:49:45 +11:00
William Grant c859c87c73 Take the hash ID as an arg. 2011-03-09 20:44:12 +11:00
William Grant bcbe6d19aa Start ripping out EMSA-PKCS1-v1_5. 2011-03-09 20:37:04 +11:00
William Grant b165714c52 Remove old test which was specific to the original upstrea. 2011-03-09 20:16:53 +11:00
William Grant 58525fbbd7 Add basic end-to-end signing and verification tests. 2011-03-09 20:10:18 +11:00
William Grant fbe24a0001 Allow callers to override the DNS function used by verify(). 2011-03-09 20:10:04 +11:00
William Grant 97ec4a65a4 Add TESTING section to README. 2011-03-09 18:49:18 +11:00
William Grant 3fa5c5263a Add testrepository config. 2011-03-09 18:47:27 +11:00
William Grant 508ad7ceec Add a couple of tests for fold(). One disabled, because the function is broken. 2011-03-09 18:47:11 +11:00