summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2014-09-24 11:26:48 -0500
committerPaul Kehrer <paul.l.kehrer@gmail.com>2014-09-27 09:42:03 -0500
commite025be284e1a1d19e761b0fff907d126f17b4fb0 (patch)
tree4f9b96a5ad59b91fc965568aae363058a2c4ab94
parent45d4c5909bd857986b901d59fd4d77bce63bfeff (diff)
downloadcryptography-e025be284e1a1d19e761b0fff907d126f17b4fb0.tar.gz
add EC WithNumbers interfaces and docs
-rw-r--r--cryptography/hazmat/primitives/interfaces.py18
-rw-r--r--docs/hazmat/primitives/interfaces.rst34
2 files changed, 52 insertions, 0 deletions
diff --git a/cryptography/hazmat/primitives/interfaces.py b/cryptography/hazmat/primitives/interfaces.py
index d60f9e0e1..c7ad0cf83 100644
--- a/cryptography/hazmat/primitives/interfaces.py
+++ b/cryptography/hazmat/primitives/interfaces.py
@@ -444,6 +444,15 @@ class EllipticCurvePrivateKey(object):
@six.add_metaclass(abc.ABCMeta)
+class EllipticCurvePrivateKeyWithNumbers(EllipticCurvePrivateKey):
+ @abc.abstractmethod
+ def private_numbers(self):
+ """
+ Returns an EllipticCurvePrivateNumbers.
+ """
+
+
+@six.add_metaclass(abc.ABCMeta)
class EllipticCurvePublicKey(object):
@abc.abstractmethod
def verifier(self, signature, signature_algorithm):
@@ -456,3 +465,12 @@ class EllipticCurvePublicKey(object):
"""
The EllipticCurve that this key is on.
"""
+
+
+@six.add_metaclass(abc.ABCMeta)
+class EllipticCurvePublicKeyWithNumbers(EllipticCurvePublicKey):
+ @abc.abstractmethod
+ def public_numbers(self):
+ """
+ Returns an EllipticCurvePublicNumbers.
+ """
diff --git a/docs/hazmat/primitives/interfaces.rst b/docs/hazmat/primitives/interfaces.rst
index ac47c1e1f..14be6982f 100644
--- a/docs/hazmat/primitives/interfaces.rst
+++ b/docs/hazmat/primitives/interfaces.rst
@@ -492,6 +492,23 @@ Elliptic Curve
The EllipticCurvePublicKey object for this private key.
+.. class:: EllipticCurvePrivateKeyWithNumbers
+
+ .. versionadded:: 0.6
+
+ Extends :class:`EllipticCurvePrivateKey`.
+
+ .. method:: private_numbers()
+
+ Create a
+ :class:`~cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePrivateNumbers`
+ object.
+
+ :returns: An
+ :class:`~cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePrivateNumbers`
+ instance.
+
+
.. class:: EllipticCurvePublicKey
.. versionadded:: 0.5
@@ -518,6 +535,23 @@ Elliptic Curve
The elliptic curve for this key.
+.. class:: EllipticCurvePublicKeyWithNumbers
+
+ .. versionadded:: 0.6
+
+ Extends :class:`EllipticCurvePublicKey`.
+
+ .. method:: private_numbers()
+
+ Create a
+ :class:`~cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePublicNumbers`
+ object.
+
+ :returns: An
+ :class:`~cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePublicNumbers`
+ instance.
+
+
Hash algorithms
---------------