aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Reid <dreid@dreid.org>2014-06-11 09:49:59 -0700
committerDavid Reid <dreid@dreid.org>2014-06-11 09:49:59 -0700
commit512d3be8e20d3f59f6f1a3951e5ff1d81dc16429 (patch)
tree5b540bbf30f009fcfd64433add667c4262019e27
parent21e1a4cf4401c4d13f75e59a75ef6d5199a70c14 (diff)
parentf0a48c6916bf7963dc27043401a73a685943a16c (diff)
downloadcryptography-512d3be8e20d3f59f6f1a3951e5ff1d81dc16429.tar.gz
cryptography-512d3be8e20d3f59f6f1a3951e5ff1d81dc16429.tar.bz2
cryptography-512d3be8e20d3f59f6f1a3951e5ff1d81dc16429.zip
Merge pull request #1115 from reaperhulk/rsa-numbers-serialization
RSA Keys -> Numbers Interface
-rw-r--r--cryptography/hazmat/primitives/interfaces.py16
-rw-r--r--docs/hazmat/primitives/interfaces.rst34
2 files changed, 50 insertions, 0 deletions
diff --git a/cryptography/hazmat/primitives/interfaces.py b/cryptography/hazmat/primitives/interfaces.py
index d805bd1a..682a36da 100644
--- a/cryptography/hazmat/primitives/interfaces.py
+++ b/cryptography/hazmat/primitives/interfaces.py
@@ -205,6 +205,14 @@ class RSAPrivateKey(object):
@six.add_metaclass(abc.ABCMeta)
+class RSAPrivateKeyWithNumbers(RSAPrivateKey):
+ def private_numbers(self):
+ """
+ Returns an RSAPrivateNumbers.
+ """
+
+
+@six.add_metaclass(abc.ABCMeta)
class RSAPublicKey(object):
@abc.abstractmethod
def verifier(self, signature, padding, algorithm, backend):
@@ -220,6 +228,14 @@ class RSAPublicKey(object):
@six.add_metaclass(abc.ABCMeta)
+class RSAPublicKeyWithNumbers(RSAPublicKey):
+ def public_numbers(self):
+ """
+ Returns an RSAPublicNumbers
+ """
+
+
+@six.add_metaclass(abc.ABCMeta)
class DSAParameters(object):
@abc.abstractproperty
def modulus(self):
diff --git a/docs/hazmat/primitives/interfaces.rst b/docs/hazmat/primitives/interfaces.rst
index d5ca59ab..8e6c2548 100644
--- a/docs/hazmat/primitives/interfaces.rst
+++ b/docs/hazmat/primitives/interfaces.rst
@@ -163,6 +163,22 @@ Asymmetric interfaces
The bit length of the modulus.
+.. class:: RSAPrivateKeyWithNumbers
+
+ .. versionadded:: 0.5
+
+ Extends :class:`RSAPrivateKey`.
+
+ .. method:: private_numbers()
+
+ Create a
+ :class:`~cryptography.hazmat.primitives.asymmetric.rsa.RSAPrivateNumbers`
+ object.
+
+ :returns: An
+ :class:`~cryptography.hazmat.primitives.asymmetric.rsa.RSAPrivateNumbers`
+ instance.
+
.. class:: RSAPublicKey
@@ -219,6 +235,23 @@ Asymmetric interfaces
The bit length of the modulus.
+.. class:: RSAPublicKeyWithNumbers
+
+ .. versionadded:: 0.5
+
+ Extends :class:`RSAPublicKey`.
+
+ .. method:: public_numbers()
+
+ Create a
+ :class:`~cryptography.hazmat.primitives.asymmetric.rsa.RSAPublicNumbers`
+ object.
+
+ :returns: An
+ :class:`~cryptography.hazmat.primitives.asymmetric.rsa.RSAPublicNumbers`
+ instance.
+
+
.. class:: DSAParameters
.. versionadded:: 0.3
@@ -491,6 +524,7 @@ Asymmetric interfaces
.. attribute:: name
+
Hash algorithms
~~~~~~~~~~~~~~~