aboutsummaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2014-02-12 15:35:00 -0600
committerPaul Kehrer <paul.l.kehrer@gmail.com>2014-02-12 15:35:00 -0600
commit4e1c40b9b62ea486a8e9f5b634b36fd7a0d00a65 (patch)
tree0514fa8f93ccdab74284703bd8caf5aee7afc2a3 /docs
parent1681a698a9fb75715bd51b6b1a877b6c8e045214 (diff)
downloadcryptography-4e1c40b9b62ea486a8e9f5b634b36fd7a0d00a65.tar.gz
cryptography-4e1c40b9b62ea486a8e9f5b634b36fd7a0d00a65.tar.bz2
cryptography-4e1c40b9b62ea486a8e9f5b634b36fd7a0d00a65.zip
remove references to the CAST5 generation (will be in separate PR)
Diffstat (limited to 'docs')
-rw-r--r--docs/development/test-vectors.rst79
1 files changed, 0 insertions, 79 deletions
diff --git a/docs/development/test-vectors.rst b/docs/development/test-vectors.rst
index 03e31f34..2a071d7c 100644
--- a/docs/development/test-vectors.rst
+++ b/docs/development/test-vectors.rst
@@ -56,85 +56,6 @@ Symmetric Ciphers
* CAST5 (ECB) from :rfc:`2144`.
-Creating Test Vectors
----------------------
-
-To create test vectors for a block cipher the following code may be used as a
-template:
-
-.. code-block:: python
-
- import binascii
-
- from cryptography.hazmat.backends.openssl.backend import backend
- from cryptography.hazmat.primitives.ciphers import base, algorithms, modes
-
-
- def encrypt(key, iv, plaintext):
- cipher = base.Cipher(
- algorithms.CAST5(binascii.unhexlify(key)),
- modes.OFB(binascii.unhexlify(iv)),
- backend
- )
- encryptor = cipher.encryptor()
- ct = encryptor.update(binascii.unhexlify(plaintext))
- ct += encryptor.finalize()
- return binascii.hexlify(ct)
-
-
- vector_file = open(
- "tests/hazmat/primitives/vectors/ciphers/AES/OFB/OFBMMT128.rsp",
- "r"
- )
-
- count = 0
- output = []
- key = None
- iv = None
- plaintext = None
- ct = None
- for line in vector_file:
- line = line.strip()
- if line.startswith("KEY"):
- if count != 0:
- output.append("CIPHERTEXT = {}".format(encrypt(key, iv, plaintext)))
- output.append("\nCOUNT = {}".format(count))
- count += 1
- name, key = line.split(" = ")
- output.append("KEY = {}".format(key))
- elif line.startswith("IV"):
- name, iv = line.split(" = ")
- iv = iv[0:16]
- output.append("IV = {}".format(iv))
- elif line.startswith("PLAINTEXT"):
- name, plaintext = line.split(" = ")
- output.append("PLAINTEXT = {}".format(plaintext))
-
- output.append("CIPHERTEXT = {}".format(encrypt(key, iv, plaintext)))
- print("\n".join(output))
-
-The algorithm, mode, and vector_file loaded must be modified to fit on a case
-by case basis. Additionally, the IV must be truncated (if necessary) to the
-length of the block size.
-
-The output generated by this script **must** be verified against at least one
-other implementation. In the example above, the vectors were generated against
-OpenSSL's implementation, so they must be verified against an implementation
-such as ``CommonCrypto`` or ``Go``.
-
-Any vectors generated by this method must also be prefixed with the following
-header format (substituting the correct information):
-
-.. code-block:: python
-
- # CAST5 CBC vectors built for https://github.com/pyca/cryptography
- # Derived from the AESVS MMT test data for CBC
- # Verified against the CommonCrypto and Go crypto packages
- # Key Length : 128
-
-If official test vectors appear in the future the custom generated vectors
-should be discarded.
-
.. _`NIST`: http://www.nist.gov/
.. _`IETF`: https://www.ietf.org/
.. _`NIST CAVP`: http://csrc.nist.gov/groups/STM/cavp/