aboutsummaryrefslogtreecommitdiffstats
path: root/docs/hazmat/primitives
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2014-02-23 11:26:37 -0600
committerPaul Kehrer <paul.l.kehrer@gmail.com>2014-02-23 11:26:37 -0600
commit4ccceaf4484dce24c5f0994b52079293a5fdb37c (patch)
tree7a8190e8f274ee210f1431014e932680b85df4db /docs/hazmat/primitives
parent2d4f36a2246580466f3c1c6e027f03bb9b265960 (diff)
downloadcryptography-4ccceaf4484dce24c5f0994b52079293a5fdb37c.tar.gz
cryptography-4ccceaf4484dce24c5f0994b52079293a5fdb37c.tar.bz2
cryptography-4ccceaf4484dce24c5f0994b52079293a5fdb37c.zip
add RSA PKCS1 signing (and structure for PSS + verification)
Diffstat (limited to 'docs/hazmat/primitives')
-rw-r--r--docs/hazmat/primitives/asymmetric/index.rst10
-rw-r--r--docs/hazmat/primitives/asymmetric/padding.rst20
-rw-r--r--docs/hazmat/primitives/asymmetric/rsa.rst (renamed from docs/hazmat/primitives/rsa.rst)30
-rw-r--r--docs/hazmat/primitives/index.rst2
4 files changed, 61 insertions, 1 deletions
diff --git a/docs/hazmat/primitives/asymmetric/index.rst b/docs/hazmat/primitives/asymmetric/index.rst
new file mode 100644
index 00000000..10319fad
--- /dev/null
+++ b/docs/hazmat/primitives/asymmetric/index.rst
@@ -0,0 +1,10 @@
+.. hazmat::
+
+Asymmetric Algorithms
+=====================
+
+.. toctree::
+ :maxdepth: 1
+
+ rsa
+ padding
diff --git a/docs/hazmat/primitives/asymmetric/padding.rst b/docs/hazmat/primitives/asymmetric/padding.rst
new file mode 100644
index 00000000..d3f713ae
--- /dev/null
+++ b/docs/hazmat/primitives/asymmetric/padding.rst
@@ -0,0 +1,20 @@
+.. hazmat::
+
+Padding
+=======
+
+.. currentmodule:: cryptography.hazmat.primitives.asymmetric.padding
+
+.. warning::
+ `Padding is critical`_ when signing or encrypting data using RSA. Without
+ correct padding signatures can be forged, messages decrypted, and private
+ keys compromised.
+
+.. class:: PKCS1()
+
+ .. versionadded:: 0.3
+
+ PKCS1 (also known as PKCS1 v1.5) is a simple padding scheme developed for
+ use with RSA keys. It is also defined in :rfc:`3447`.
+
+.. _`Padding is critical`: http://rdist.root.org/2009/10/06/why-rsa-encryption-padding-is-critical/
diff --git a/docs/hazmat/primitives/rsa.rst b/docs/hazmat/primitives/asymmetric/rsa.rst
index 4e1f8e49..82cf3528 100644
--- a/docs/hazmat/primitives/rsa.rst
+++ b/docs/hazmat/primitives/asymmetric/rsa.rst
@@ -50,6 +50,36 @@ RSA
provider.
:return: A new instance of ``RSAPrivateKey``.
+ .. method:: signer(padding, algorithm, backend)
+
+ .. versionadded:: 0.3
+
+ :param padding: An instance of a
+ :class:`~cryptography.hazmat.primitives.interfaces.AsymmetricPadding`
+ provider.
+
+ :param algorithm: An instance of a
+ :class:`~cryptography.hazmat.primitives.interfaces.HashAlgorithm`
+ provider.
+
+ :param backend: A
+ :class:`~cryptography.hazmat.backends.interfaces.RSABackend`
+ provider.
+
+ :returns:
+ :class:`~cryptography.hazmat.primitives.interfaces.AsymmetricSignatureContext`
+
+ .. doctest::
+
+ >>> from cryptography.hazmat.backends import default_backend
+ >>> from cryptography.hazmat.primitives import hashes
+ >>> from cryptography.hazmat.primitives.asymmetric import rsa, padding
+ >>> private_key = rsa.RSAPrivateKey.generate(65537, 2048, default_backend())
+ >>> signer = private_key.signer(padding.PKCS1(), hashes.SHA256(), default_backend())
+ >>> signer.update(b"this is some data I'd like")
+ >>> signer.update(b" to sign")
+ >>> signature = signer.finalize()
+
.. class:: RSAPublicKey(public_exponent, modulus)
diff --git a/docs/hazmat/primitives/index.rst b/docs/hazmat/primitives/index.rst
index 5199d493..90deec8b 100644
--- a/docs/hazmat/primitives/index.rst
+++ b/docs/hazmat/primitives/index.rst
@@ -11,7 +11,7 @@ Primitives
symmetric-encryption
padding
key-derivation-functions
- rsa
+ asymmetric/index
constant-time
interfaces
twofactor