aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.travis.yml7
-rw-r--r--AUTHORS.rst4
-rw-r--r--README.rst3
-rw-r--r--cryptography/bindings/__init__.py0
-rw-r--r--cryptography/bindings/openssl/__init__.py (renamed from cryptography/c/__init__.py)2
-rw-r--r--cryptography/bindings/openssl/api.py (renamed from cryptography/c/api.py)4
-rw-r--r--docs/architecture.rst6
-rw-r--r--docs/community.rst12
-rw-r--r--docs/index.rst1
-rw-r--r--docs/primitives/index.rst7
-rw-r--r--docs/primitives/symmetric-encryption.rst69
-rw-r--r--tests/bindings/__init__.py0
-rw-r--r--tests/bindings/test_openssl.py19
-rw-r--r--tests/test_c.py6
14 files changed, 122 insertions, 18 deletions
diff --git a/.travis.yml b/.travis.yml
index f7ff6d97..24a3a4dc 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -16,3 +16,10 @@ script:
after_success:
- coveralls
+
+notifications:
+ irc:
+ channels:
+ - "irc.freenode.org#cryptography-dev"
+ use_notice: true
+ skip_join: true
diff --git a/AUTHORS.rst b/AUTHORS.rst
index f4f761f9..06e23d1f 100644
--- a/AUTHORS.rst
+++ b/AUTHORS.rst
@@ -2,6 +2,6 @@ AUTHORS
=======
* Alex Gaynor <alex.gaynor@gmail.com>
-* Hynek Schlawack <schlawack@variomedia.de>
+* Hynek Schlawack <hs@ox.cx>
* Donald Stufft <donald@stufft.io>
-* Laurens Van Houtven <_@lvh.cc>
+* Laurens Van Houtven <_@lvh.io>
diff --git a/README.rst b/README.rst
index 0a577076..4379bb58 100644
--- a/README.rst
+++ b/README.rst
@@ -4,6 +4,9 @@ Cryptography
.. image:: https://travis-ci.org/alex/cryptography.png?branch=master
:target: https://travis-ci.org/alex/cryptography
+.. image:: https://coveralls.io/repos/alex/cryptography/badge.png?branch=master
+ :target: https://coveralls.io/r/alex/cryptography?branch=master
+
``cryptography`` is a package designed to expose cryptographic primitives and
recipes to Python developers.
diff --git a/cryptography/bindings/__init__.py b/cryptography/bindings/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/cryptography/bindings/__init__.py
diff --git a/cryptography/c/__init__.py b/cryptography/bindings/openssl/__init__.py
index 09bf4977..6c803fbc 100644
--- a/cryptography/c/__init__.py
+++ b/cryptography/bindings/openssl/__init__.py
@@ -11,7 +11,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from cryptography.c.api import api
+from cryptography.bindings.openssl import api
__all__ = ["api"]
diff --git a/cryptography/c/api.py b/cryptography/bindings/openssl/api.py
index ea8827f1..3cc6a0e9 100644
--- a/cryptography/c/api.py
+++ b/cryptography/bindings/openssl/api.py
@@ -15,7 +15,9 @@ from __future__ import absolute_import, division, print_function
class API(object):
- """OpenSSL API wrapper."""
+ """
+ OpenSSL API wrapper.
+ """
api = API()
diff --git a/docs/architecture.rst b/docs/architecture.rst
index 7b394950..0a9550c0 100644
--- a/docs/architecture.rst
+++ b/docs/architecture.rst
@@ -8,11 +8,11 @@ Architecture
``cryptography`` has three different layers:
-* ``cryptography.c``: This package contains bindings to low level cryptographic
- libraries. Our initial target will be OpenSSL.
+* ``cryptography.bindings``: This package contains bindings to low level
+ cryptographic libraries. Our initial target will be OpenSSL.
* ``cryptography.primitives``: This packages contains low level algorithms,
things like ``AES`` or ``SHA1``. This is implemented on top of
- ``cryptography.c``.
+ ``cryptography.bindings``.
* ``cryptography``: This package contains higher level recipes, for example
"encrypt and then MAC". This is implemented on top of
``cryptography.primitives``.
diff --git a/docs/community.rst b/docs/community.rst
index 0cefd279..809ffd12 100644
--- a/docs/community.rst
+++ b/docs/community.rst
@@ -1,13 +1,15 @@
Community
=========
-You can find ``crytography`` all over the web:
+You can find ``cryptography`` all over the web:
* `Mailing list`_
* `Source code`_
* `Issue tracker`_
-* IRC: ``#crytography-dev`` on ``irc.freenode.net``
+* `Documentation`_
+* IRC: ``#cryptography-dev`` on ``irc.freenode.net``
-.. _`Mailing list`: http://mail.python.org/mailman/listinfo/cryptography-dev
-.. _`Source code`: https://github.com/alex/crytopgraphy
-.. _`Issue tracker`: https://github.com/alex/crytopgraphy/issues
+.. _`Mailing list`: https://mail.python.org/mailman/listinfo/cryptography-dev
+.. _`Source code`: https://github.com/alex/cryptography
+.. _`Issue tracker`: https://github.com/alex/cryptography/issues
+.. _`Documentation`: https://cryptography.readthedocs.org/
diff --git a/docs/index.rst b/docs/index.rst
index 28975f30..1d8ffda6 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -14,4 +14,5 @@ Contents:
:maxdepth: 2
architecture
+ primitives/index
community
diff --git a/docs/primitives/index.rst b/docs/primitives/index.rst
new file mode 100644
index 00000000..1066e30e
--- /dev/null
+++ b/docs/primitives/index.rst
@@ -0,0 +1,7 @@
+Primitives
+==========
+
+.. toctree::
+ :maxdepth: 1
+
+ symmetric-encryption
diff --git a/docs/primitives/symmetric-encryption.rst b/docs/primitives/symmetric-encryption.rst
new file mode 100644
index 00000000..fe074f3e
--- /dev/null
+++ b/docs/primitives/symmetric-encryption.rst
@@ -0,0 +1,69 @@
+Symmetric Encryption
+====================
+
+Symmetric encryption is a way to encrypt (hide the plaintext value) material
+where the encrypter and decrypter both use the same key.
+
+.. class:: cryptography.primitives.block.BlockCipher(cipher, mode)
+
+ Block ciphers work by encrypting content in chunks, often 64- or 128-bits.
+ They combine an underlying algorithm (such as AES), with a mode (such as
+ CBC, CTR, or GCM). A simple example of encrypting content with AES is:
+
+ .. code-block:: pycon
+
+ >>> from cryptography.primitives.block import BlockCipher, cipher, mode, padding
+ >>> cipher = BlockCipher(cipher.AES(key), mode.CBC(iv, padding.PKCS7()))
+ >>> cipher.encrypt("my secret message") + cipher.finalize()
+ # The ciphertext
+ [...]
+
+ :param cipher: One of the ciphers described below.
+ :param mode: One of the modes described below.
+
+ ``encrypt()`` should be called repeatedly with new plaintext, and once the
+ full plaintext is fed in, ``finalize()`` should be called.
+
+ .. method:: encrypt(plaintext)
+
+ :param bytes plaintext: The text you wish to encrypt.
+ :return bytes: Returns the ciphertext that was added.
+
+ .. method:: finalize()
+
+ :return bytes: Returns the remainder of the ciphertext.
+
+Ciphers
+~~~~~~~
+
+.. class:: cryptography.primitives.block.cipher.AES(key)
+
+ AES (Advanced Encryption Standard) is a block cipher standardized by NIST.
+ AES is both fast, and cryptographically strong. It is a good default
+ choice for encryption.
+
+ :param bytes key: The secret key, either ``128``, ``192``, or ``256`` bits.
+ This must be kept secret.
+
+
+Modes
+~~~~~
+
+.. class:: cryptography.primitives.block.mode.CBC(initialization_vector, padding)
+
+ CBC (Cipher block chaining) is a mode of operation for block ciphers. It is
+ considered cryptographically strong.
+
+ :param bytes initialization_vector: Must be random bytes. They do not need
+ to be kept secret (they can be included
+ in a transmitted message). Must be the
+ same number of bytes as the
+ ``block_size`` of the cipher. Do not
+ reuse an ``initialization_vector`` with
+ a given ``key``.
+ :param padding: One of the paddings described below.
+
+Paddings
+~~~~~~~~
+
+.. class:: cryptography.primitives.block.padding.PKCS7()
diff --git a/tests/bindings/__init__.py b/tests/bindings/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/bindings/__init__.py
diff --git a/tests/bindings/test_openssl.py b/tests/bindings/test_openssl.py
new file mode 100644
index 00000000..9d637222
--- /dev/null
+++ b/tests/bindings/test_openssl.py
@@ -0,0 +1,19 @@
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from cryptography.bindings.openssl import api
+
+
+class TestOpenSSL(object):
+ def test_api_exists(self):
+ assert api
diff --git a/tests/test_c.py b/tests/test_c.py
deleted file mode 100644
index c50968e2..00000000
--- a/tests/test_c.py
+++ /dev/null
@@ -1,6 +0,0 @@
-from cryptography.c import api
-
-
-class TestC(object):
- def test_api_exists(self):
- assert api