summaryrefslogtreecommitdiff
path: root/lib/Crypto/SelfTest/Protocol
Commit message (Collapse)AuthorAgeFilesLines
* Rename S2V -> _S2V until we come up with a real PRF APIDwayne Litzenberger2013-10-201-3/+3
|
* Add support for SIV (Synthetic IV) modeLegrandin2013-10-201-1/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch add supports for SIV, an AEAD block cipher mode defined in RFC5297. SIV is only valid for AES. The PRF of SIV (S2V) is factored out in the Protocol.KDF module. See the following example to get a feeling of the API (slightly different than other AEAD mode, during decryption). Encryption (Python 2): >>> from Crypto.Cipher import AES >>> key = b'0'*32 >>> siv = AES.new(key, AES.MODE_SIV) >>> ct = siv.encrypt(b'Message') >>> mac = siv.digest() Decryption (Python 2): >>> from Crypto.Cipher import AES, MacMismatchError >>> key = b'0'*32 >>> siv = AES.new(key, AES.MODE_SIV) >>> pt = siv.decrypt(ct + mac) >>> try: >>> siv.verify(mac) >>> print "Plaintext", pt >>> except MacMismatchError: >>> print "Error" This change also fixes the description/design of AEAD API. With SIV (RFC5297), decryption can only start when the MAC is known. The original AEAD API did not support that. For SIV the MAC is now exceptionally passed together with the ciphertext to the decrypt() method. [dlitz@dlitz.net: Included changes from the following commits from the author's pull request:] - [9c13f9c] Rename 'IV' parameter to 'nonce' for AEAD modes. - [d7727fb] Fix description/design of AEAD API. - [fb62fae] ApiUsageError becomes TypeError [whitespace] - [4ec64d8] Removed last references to ApiUsageError [whitespace] - [ee46922] Removed most 'import *' statements - [ca460a7] Made blockalgo.py more PEP-8 compliant; The second parameter of the _GHASH constructor is now the length of the block (block_size) and not the full module. [dlitz@dlitz.net: A conflict that was not resolved in the previous commit was originally resolved here. Moved the resolution to the previous commit.] [dlitz@dlitz.net: Replaced MacMismatchError with ValueError] [dlitz@dlitz.net: Replaced ApiUsageError with TypeError] [dlitz@dlitz.net: Whitespace fixed with "git rebase --whitespace=fix"]
* Removed most 'import *' statementsLegrandin2013-10-201-1/+3
| | | | | | | | | | | | [dlitz@dlitz.net: Re-ordered commits; so don't import S2V yet] [dlitz@dlitz.net: Included an additional 'import *' change from the following commit:] commit 4ec64d8eaaa4965889eb8e3b801fc77aa84e0a4e Author: Legrandin <helderijs@gmail.com> Date: Tue Sep 10 07:28:08 2013 +0200 Removed last references to ApiUsageError [dlitz@dlitz.net: Removed unrelated whitespace changes]
* Added KDF unit tests to suiteLegrandin2013-10-201-0/+1
|
* whitespace changes (pre-AEAD)Legrandin2013-10-201-2/+2
| | | | | | | [dlitz@dlitz.net: Whitespace changes extracted from the author's pull request:] - [9c13f9c] Rename 'IV' parameter to 'nonce' for AEAD modes. - [4ec64d8] Removed last references to ApiUsageError - [ee46922] Removed most 'import *' statements
* Hash: Rename SHA->SHA1 and RIPEMD->RIPEMD160 (1/2)Dwayne Litzenberger2013-02-161-1/+1
| | | | | | | | | These algorithm names were confusing, because there are actually algorithms called "SHA" (a.k.a. SHA-0) and "RIPEMD" (the original version). This commit just renames the modules, with no backward-compatibility support.
* Re-enable (accidentally?) disabled PBKDF2 testsDwayne C. Litzenberger2012-01-131-1/+1
| | | | These were disabled in commit 897b75983c31a9e2630af92161e6206c2480685e
* Merge from upstreamLegrandin2011-12-221-4/+3
|\
| * Python 3.x fixes:Dwayne C. Litzenberger2011-10-221-3/+3
| | | | | | | | | | - Use absolute imports - Fix StringIO import so that 2to3 can translate it
* | Merged from upstream (py3k support) and modified so that all unit tests pass.Legrandin2011-10-185-7/+85
|\ \ | |/
| * Py3k compatibility: testsDwayne C. Litzenberger2011-10-101-2/+2
| |
| * Unwraping byte conversion on test vectors.Anders Sundman2011-04-241-3/+3
| | | | | | | | Doing the wraping later, at the point of use instead.
| * Now really staging the allornothing test. oops.Thorsten Behrens2011-01-041-0/+76
| |
| * Add unit test for AllOrNothingThorsten Behrens2011-01-031-0/+1
| | | | | | | | | | Note that AllOrNothing fails occasionally. This has always been the case; the unit test merely forces the flaw to be exposed.
| * PY3K support for _fastmath.c; removed floordiv(a,b) hack and replaced with ↵Thorsten Behrens2010-12-292-4/+4
| | | | | | | | divmod(a,b)[0]; move to assertEqual throughout the test suite to prep for assert_ and failIf being removed in 3.3/3.4
| * More consistent use of binary strings in test scripts. Now suceeds with ↵Thorsten Behrens2010-12-281-3/+4
| | | | | | | | Python 3.2b2
* | Added Lorenz Quack's native C implementation of all SHA-2 algorithmLegrandin2011-10-161-1/+1
| | | | | | | | | | | | | | | | | | (as submitted here https://bugs.launchpad.net/pycrypto/+bug/544792) so that they are available also in Python 2.1, 2.2, 2.3 and 2.4. Regardless where the implementation comes from (Python standard library or our native modules, depending on the Python version), all Crypto.Hash objects are always used as front-ends.
* | Add new module Crypto.Protocol.KDF with two PKCS#5 key derivation algorithms.Legrandin2011-09-222-0/+99
|/
* test_rfc1751.py: Add a legal noticeDwayne C. Litzenberger2009-08-031-1/+21
| | | | I have permission to do this. See the LEGAL directory.
* Chaffing.py, test_chaffing.py: Add/Replace legal noticesDwayne C. Litzenberger2009-08-031-1/+21
| | | | I have permission to do this. See the LEGAL directory.
* Fix comment at the top of test_rfc1751.pyDwayne C. Litzenberger2009-08-021-1/+1
|
* Legal: Dedicate my files to the public domain.Dwayne C. Litzenberger2009-03-011-21/+17
| | | | | | | | | | | | | In an attempt to simplify the copyright status of PyCrypto, I'm placing my code into the public domain, and encouraging other contributors to do the same. I have used a public domain dedication that was recommended in a book on FOSS legal issues[1], followed by the warranty disclaimer boilerplate from the MIT license. [1] _Intellectual Property and Open Source: A Practical Guide to Protecting Code_, a book written by Van Lindberg and published by O'Reilly Media. (ISBN 978-0-596-51796-0)
* cleanup: Move modules to "lib/Crypto" subdirectory.Dwayne C. Litzenberger2009-02-283-0/+139
This will avoid the previous situation where scripts like the old "test.py" get included accidentally in a release. It also frees us to put additional build scripts in the top-level directory of the source tree.