From 94a8c318cf4fb7d7eae4d35492cfe006e69d734a Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Wed, 22 Oct 2014 10:05:41 -0700 Subject: fix overindent --- tests/hazmat/primitives/test_hmac.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/hazmat/primitives/test_hmac.py b/tests/hazmat/primitives/test_hmac.py index 77dfb6be..dca3eb02 100644 --- a/tests/hazmat/primitives/test_hmac.py +++ b/tests/hazmat/primitives/test_hmac.py @@ -32,7 +32,7 @@ from ...utils import raises_unsupported_algorithm @utils.register_interface(interfaces.HashAlgorithm) class UnsupportedDummyHash(object): - name = "unsupported-dummy-hash" + name = "unsupported-dummy-hash" @pytest.mark.supported( -- cgit v1.2.3 From b79f3ee0bbc98cb44714db9c01605666747a9751 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Wed, 22 Oct 2014 10:15:06 -0700 Subject: Simplify the implementation of the EC curve keys --- cryptography/hazmat/primitives/asymmetric/ec.py | 135 ++++++------------------ 1 file changed, 30 insertions(+), 105 deletions(-) diff --git a/cryptography/hazmat/primitives/asymmetric/ec.py b/cryptography/hazmat/primitives/asymmetric/ec.py index b27d0458..ced732fb 100644 --- a/cryptography/hazmat/primitives/asymmetric/ec.py +++ b/cryptography/hazmat/primitives/asymmetric/ec.py @@ -21,167 +21,92 @@ from cryptography.hazmat.primitives import interfaces @utils.register_interface(interfaces.EllipticCurve) class SECT571R1(object): - @property - def name(self): - return "sect571r1" - - @property - def key_size(self): - return 571 + name = "sect571r1" + key_size = 571 @utils.register_interface(interfaces.EllipticCurve) class SECT409R1(object): - @property - def name(self): - return "sect409r1" - - @property - def key_size(self): - return 409 + name = "sect409r1" + key_size = 409 @utils.register_interface(interfaces.EllipticCurve) class SECT283R1(object): - @property - def name(self): - return "sect283r1" - - @property - def key_size(self): - return 283 + name = "sect283r1" + key_size = 283 @utils.register_interface(interfaces.EllipticCurve) class SECT233R1(object): - @property - def name(self): - return "sect233r1" - - @property - def key_size(self): - return 233 + name = "sect233r1" + key_size = 233 @utils.register_interface(interfaces.EllipticCurve) class SECT163R2(object): - @property - def name(self): - return "sect163r2" - - @property - def key_size(self): - return 163 + name = "sect163r2" + key_size = 163 @utils.register_interface(interfaces.EllipticCurve) class SECT571K1(object): - @property - def name(self): - return "sect571k1" - - @property - def key_size(self): - return 571 + name = "sect571k1" + key_size = 571 @utils.register_interface(interfaces.EllipticCurve) class SECT409K1(object): - @property - def name(self): - return "sect409k1" - - @property - def key_size(self): - return 409 + name = "sect409k1" + key_size = 409 @utils.register_interface(interfaces.EllipticCurve) class SECT283K1(object): - @property - def name(self): - return "sect283k1" - - @property - def key_size(self): - return 283 + name = "sect283k1" + key_size = 283 @utils.register_interface(interfaces.EllipticCurve) class SECT233K1(object): - @property - def name(self): - return "sect233k1" - - @property - def key_size(self): - return 233 + name = "sect233k1" + key_size = 233 @utils.register_interface(interfaces.EllipticCurve) class SECT163K1(object): - @property - def name(self): - return "sect163k1" - - @property - def key_size(self): - return 163 + name = "sect163k1" + key_size = 163 @utils.register_interface(interfaces.EllipticCurve) class SECP521R1(object): - @property - def name(self): - return "secp521r1" - - @property - def key_size(self): - return 521 + name = "secp521r1" + key_size = 521 @utils.register_interface(interfaces.EllipticCurve) class SECP384R1(object): - @property - def name(self): - return "secp384r1" - - @property - def key_size(self): - return 384 + name = "secp384r1" + key_size = 384 @utils.register_interface(interfaces.EllipticCurve) class SECP256R1(object): - @property - def name(self): - return "secp256r1" - - @property - def key_size(self): - return 256 + name = "secp256r1" + key_size = 256 @utils.register_interface(interfaces.EllipticCurve) class SECP224R1(object): - @property - def name(self): - return "secp224r1" - - @property - def key_size(self): - return 224 + name = "secp224r1" + key_size = 224 @utils.register_interface(interfaces.EllipticCurve) class SECP192R1(object): - @property - def name(self): - return "secp192r1" - - @property - def key_size(self): - return 192 + name = "secp192r1" + key_size = 192 _CURVE_TYPES = { -- cgit v1.2.3 From 218f7fbdc6ec3fbc43f6dd112d8e5a6645ffa0e1 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Wed, 22 Oct 2014 11:15:08 -0700 Subject: Fixed #1429 -- mark these classes as implementing the MACContext interface --- cryptography/hazmat/backends/commoncrypto/hmac.py | 1 + cryptography/hazmat/backends/openssl/hmac.py | 1 + 2 files changed, 2 insertions(+) diff --git a/cryptography/hazmat/backends/commoncrypto/hmac.py b/cryptography/hazmat/backends/commoncrypto/hmac.py index ec3a878b..c6e3f276 100644 --- a/cryptography/hazmat/backends/commoncrypto/hmac.py +++ b/cryptography/hazmat/backends/commoncrypto/hmac.py @@ -18,6 +18,7 @@ from cryptography.exceptions import UnsupportedAlgorithm, _Reasons from cryptography.hazmat.primitives import interfaces +@utils.register_interface(interfaces.MACContext) @utils.register_interface(interfaces.HashContext) class _HMACContext(object): def __init__(self, backend, key, algorithm, ctx=None): diff --git a/cryptography/hazmat/backends/openssl/hmac.py b/cryptography/hazmat/backends/openssl/hmac.py index 3f1576f5..ca62184b 100644 --- a/cryptography/hazmat/backends/openssl/hmac.py +++ b/cryptography/hazmat/backends/openssl/hmac.py @@ -19,6 +19,7 @@ from cryptography.exceptions import UnsupportedAlgorithm, _Reasons from cryptography.hazmat.primitives import interfaces +@utils.register_interface(interfaces.MACContext) @utils.register_interface(interfaces.HashContext) class _HMACContext(object): def __init__(self, backend, key, algorithm, ctx=None): -- cgit v1.2.3 From 09dd287ad88280f0e822696da1a0b3934dd6fcb4 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Wed, 22 Oct 2014 14:15:43 -0700 Subject: Fixed a few typos --- docs/security.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/security.rst b/docs/security.rst index 3bb10fa4..50253457 100644 --- a/docs/security.rst +++ b/docs/security.rst @@ -12,10 +12,10 @@ We ask that you do not report security issues to our normal GitHub issue tracker. If you believe you've identified a security issue with ``cryptography``, please -report it to ``alex.gaynor@gmail.com``. Message may be optionally be encrypted -with PGP using key fingerprint -``E27D 4AA0 1651 72CB C5D2 AF2B 125F 5C67 DFE9 4084`` -(this public key is available from most commonly-used key servers). +report it to ``alex.gaynor@gmail.com``. Messages may be optionally encrypted +with PGP using key fingerprint +``E27D 4AA0 1651 72CB C5D2 AF2B 125F 5C67 DFE9 4084`` (this public key is +available from most commonly-used key servers). Once you've submitted an issue via email, you should receive an acknowledgment within 48 hours, and depending on the action to be taken, you may receive -- cgit v1.2.3