aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cryptography/hazmat/backends/openssl/ec.py8
-rw-r--r--src/cryptography/hazmat/primitives/asymmetric/ec.py14
2 files changed, 21 insertions, 1 deletions
diff --git a/src/cryptography/hazmat/backends/openssl/ec.py b/src/cryptography/hazmat/backends/openssl/ec.py
index 68a35b21..3a81f919 100644
--- a/src/cryptography/hazmat/backends/openssl/ec.py
+++ b/src/cryptography/hazmat/backends/openssl/ec.py
@@ -135,6 +135,10 @@ class _EllipticCurvePrivateKey(object):
curve = utils.read_only_property("_curve")
+ @property
+ def key_size(self):
+ return self.curve.key_size
+
def signer(self, signature_algorithm):
_check_signature_algorithm(signature_algorithm)
return _ECDSASignatureContext(
@@ -231,6 +235,10 @@ class _EllipticCurvePublicKey(object):
curve = utils.read_only_property("_curve")
+ @property
+ def key_size(self):
+ return self.curve.key_size
+
def verifier(self, signature, signature_algorithm):
if not isinstance(signature, bytes):
raise TypeError("signature must be bytes.")
diff --git a/src/cryptography/hazmat/primitives/asymmetric/ec.py b/src/cryptography/hazmat/primitives/asymmetric/ec.py
index a527387b..7931b086 100644
--- a/src/cryptography/hazmat/primitives/asymmetric/ec.py
+++ b/src/cryptography/hazmat/primitives/asymmetric/ec.py
@@ -22,7 +22,7 @@ class EllipticCurve(object):
@abc.abstractproperty
def key_size(self):
"""
- The bit length of the base point of the curve.
+ Bit size of a secret scalar for the curve.
"""
@@ -63,6 +63,12 @@ class EllipticCurvePrivateKey(object):
"""
@abc.abstractproperty
+ def key_size(self):
+ """
+ Bit size of a secret scalar for the curve.
+ """
+
+ @abc.abstractproperty
def sign(self, data, signature_algorithm):
"""
Signs the data
@@ -98,6 +104,12 @@ class EllipticCurvePublicKey(object):
The EllipticCurve that this key is on.
"""
+ @abc.abstractproperty
+ def key_size(self):
+ """
+ Bit size of a secret scalar for the curve.
+ """
+
@abc.abstractmethod
def public_numbers(self):
"""