Merge branch 'master' into simple-symmetric-encryption

Conflicts:
	setup.py
This commit is contained in:
Donald Stufft 2013-08-11 17:38:13 -04:00
commit 446a457218
10 changed files with 156 additions and 15 deletions

4
.gitignore vendored
View file

@ -4,3 +4,7 @@ _build/
.tox/
*.egg-info/
.coverage
cffi-*.egg/
pycparser-*.egg/
pytest-*.egg/
dist/

View file

@ -5,3 +5,5 @@ AUTHORS
* Hynek Schlawack <hs@ox.cx>
* Donald Stufft <donald@stufft.io>
* Laurens Van Houtven <_@lvh.io>
* Christian Heimes <christian@python.org>

View file

@ -10,6 +10,13 @@ Code
When in doubt, refer to `PEP 8`_ for Python code.
Every code file must start with the boilerplate notice of the Apache License.
Additionally, every Python code file must contain
.. code-block:: python
from __future__ import absolute_import, division, print_function
Docs
====
@ -17,12 +24,12 @@ Write docstrings like this:
.. code-block:: python
def some_function(some_arg):
"""
Does some things.
def some_function(some_arg):
"""
Does some things.
:param some_arg: Some argument.
"""
:param some_arg: Some argument.
"""
So, specifically:

7
MANIFEST.in Normal file
View file

@ -0,0 +1,7 @@
include LICENSE
include AUTHORS.rst
include CONTRIBUTING.rst
include README.rst
recursive-include tests *.py
recursive-include tests/primitives/vectors *

View file

@ -13,9 +13,6 @@ recipes to Python developers.
It is currently in early development and isn't recommended for general usage
yet. It targets Python 2.6-2.7, Python 3.2+, as well as PyPy.
Why a new crypto library for Python?
------------------------------------
You can find more documentation at `Read The Docs`_.
None of the existing ones work on PyPy, and many of them are unmaintained or
are based around very poor implementations of algorithms (i.e ones with known
side-channel attacks).
.. _`Read The Docs`: https://cryptography.readthedocs.org/

32
cryptography/__about__.py Normal file
View file

@ -0,0 +1,32 @@
# 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 __future__ import absolute_import, division, print_function
__all__ = [
"__title__", "__summary__", "__uri__", "__version__", "__author__",
"__email__", "__license__", "__copyright__",
]
__title__ = "cryptography"
__summary__ = ("cryptography is a package designed to expose cryptographic "
"primitives and recipes to Python developers.")
__uri__ = "https://github.com/alex/cryptography"
__version__ = "0.1.dev1"
__author__ = ("Alex Gaynor, Donald Stufft, Laurens van Houvten, "
"Jean-Paul Calderone, Chris Heime, and Indivdual Contributors")
__email__ = "cryptography-dev@python.org"
__license__ = "Apache License, Version 2.0"
__copyright__ = "Copyright 2013 Donald Stufft"

View file

@ -0,0 +1,22 @@
# 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.__about__ import (
__title__, __summary__, __uri__, __version__, __author__, __email__,
__license__, __copyright__
)
__all__ = [
"__title__", "__summary__", "__uri__", "__version__", "__author__",
"__email__", "__license__", "__copyright__",
]

View file

@ -8,7 +8,24 @@ Welcome to ``cryptography``
``cryptography`` is a Python library which exposes cryptographic primitives and
recipes.
Contents:
Why a new crypto library for Python?
------------------------------------
We wanted to address a few issues with existing cryptography libraries in
Python:
* Lack of PyPy support.
* Lack of maintenance.
* Use of poor implementations of algorithms (i.e. ones with known side-channel
attacks).
* Lack of high level, "Cryptography for humans", APIs.
* Absence of algorithms such as AES-GCM.
* Poor introspectability, and thus poor testability.
* Extremely error prone APIs, and bad defaults.
Contents
--------
.. toctree::
:maxdepth: 2

View file

@ -14,7 +14,7 @@ where the encrypter and decrypter both use the same key.
>>> from cryptography.primitives.block import BlockCipher, ciphers, modes
>>> cipher = BlockCipher(ciphers.AES(key), modes.CBC(iv))
>>> cipher.encrypt("my secret message") + cipher.finalize()
>>> cipher.encrypt(b"a secret message") + cipher.finalize()
# The ciphertext
[...]

View file

@ -12,7 +12,23 @@
# limitations under the License.
import sys
from setuptools import setup
from setuptools import setup, find_packages
about = {}
with open("cryptography/__about__.py") as fp:
exec(fp.read(), about)
CFFI_DEPENDENCY = "cffi>=0.6"
install_requires = [
CFFI_DEPENDENCY,
]
setup_requires = [
CFFI_DEPENDENCY,
]
install_requires = [
"cffi>=0.6",
@ -22,7 +38,44 @@ if sys.version_info[:2] < (3, 4):
install_requires += ["enum34"]
setup(
name="cryptography",
license="Apache License, Version 2.0",
name=about["__title__"],
version=about["__version__"],
description=about["__summary__"],
license=about["__license__"],
url=about["__uri__"],
author=about["__author__"],
author_email=about["__email__"],
classifiers=[
"Development Status :: 2 - Pre-Alpha",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Natural Language :: English",
"Operating System :: MacOS :: MacOS X",
"Operating System :: POSIX",
"Operating System :: POSIX :: BSD",
"Operating System :: POSIX :: Linux",
"Operating System :: Microsoft :: Windows",
#"Programming Language :: cffi",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.6",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.2",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Security :: Cryptography",
],
packages=find_packages(exclude=["tests", "tests.*"]),
install_requires=install_requires,
setup_requires=setup_requires,
# for cffi
zip_safe=False,
)