diff options
-rw-r--r-- | CHANGELOG.rst | 52 | ||||
-rw-r--r-- | docs/development/test-vectors.rst | 5 | ||||
-rw-r--r-- | docs/hazmat/primitives/asymmetric/dsa.rst | 47 | ||||
-rw-r--r-- | docs/hazmat/primitives/asymmetric/ec.rst | 40 | ||||
-rw-r--r-- | docs/hazmat/primitives/asymmetric/rsa.rst | 54 | ||||
-rw-r--r-- | docs/installation.rst | 17 | ||||
-rw-r--r-- | docs/spelling_wordlist.txt | 1 | ||||
-rw-r--r-- | docs/x509.rst | 4 | ||||
-rw-r--r-- | src/_cffi_src/openssl/x509v3.py | 3 | ||||
-rw-r--r-- | src/cryptography/hazmat/backends/openssl/x509.py | 32 | ||||
-rw-r--r-- | src/cryptography/hazmat/primitives/asymmetric/dsa.py | 6 | ||||
-rw-r--r-- | src/cryptography/hazmat/primitives/asymmetric/ec.py | 6 | ||||
-rw-r--r-- | src/cryptography/hazmat/primitives/asymmetric/rsa.py | 6 | ||||
-rw-r--r-- | tests/test_x509_ext.py | 10 | ||||
-rw-r--r-- | vectors/cryptography_vectors/x509/san_edipartyname.der | bin | 0 -> 702 bytes | |||
-rw-r--r-- | vectors/cryptography_vectors/x509/san_x400address.der | bin | 0 -> 691 bytes |
16 files changed, 102 insertions, 181 deletions
diff --git a/CHANGELOG.rst b/CHANGELOG.rst index bc95cf74..82a3e5b6 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -27,6 +27,11 @@ Changelog * Add support for creating certificate signing requests with :class:`~cryptography.x509.CertificateSigningRequestBuilder`. +0.9.2 - 2015-07-04 +~~~~~~~~~~~~~~~~~~ + +* Updated Windows wheels to be compiled against OpenSSL 1.0.2c. + 0.9.1 - 2015-06-06 ~~~~~~~~~~~~~~~~~~ @@ -125,51 +130,39 @@ Changelog SubjectPublicKeyInfo format for RSA, EC, and DSA). * Added :class:`~cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePrivateKeyWithSerialization` - and deprecated - :class:`~cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePrivateKeyWithNumbers`. + and deprecated ``EllipticCurvePrivateKeyWithNumbers``. * Added :meth:`~cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePrivateKeyWithSerialization.private_bytes` to :class:`~cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePrivateKeyWithSerialization`. * Added :class:`~cryptography.hazmat.primitives.asymmetric.rsa.RSAPrivateKeyWithSerialization` - and deprecated - :class:`~cryptography.hazmat.primitives.asymmetric.rsa.RSAPrivateKeyWithNumbers`. + and deprecated ``RSAPrivateKeyWithNumbers``. * Added :meth:`~cryptography.hazmat.primitives.asymmetric.rsa.RSAPrivateKeyWithSerialization.private_bytes` to :class:`~cryptography.hazmat.primitives.asymmetric.rsa.RSAPrivateKeyWithSerialization`. * Added :class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAPrivateKeyWithSerialization` - and deprecated - :class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAPrivateKeyWithNumbers`. + and deprecated ``DSAPrivateKeyWithNumbers``. * Added :meth:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAPrivateKeyWithSerialization.private_bytes` to :class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAPrivateKeyWithSerialization`. * Added :class:`~cryptography.hazmat.primitives.asymmetric.rsa.RSAPublicKeyWithSerialization` - and deprecated - :class:`~cryptography.hazmat.primitives.asymmetric.rsa.RSAPublicKeyWithNumbers`. -* Added - :meth:`~cryptography.hazmat.primitives.asymmetric.rsa.RSAPublicKeyWithSerialization.public_bytes` - to + and deprecated ``RSAPublicKeyWithNumbers``. +* Added ``public_bytes`` to :class:`~cryptography.hazmat.primitives.asymmetric.rsa.RSAPublicKeyWithSerialization`. * Added :class:`~cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePublicKeyWithSerialization` - and deprecated - :class:`~cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePublicKeyWithNumbers`. -* Added - :meth:`~cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePublicKeyWithSerialization.public_bytes` - to + and deprecated ``EllipticCurvePublicKeyWithNumbers``. +* Added ``public_bytes`` to :class:`~cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePublicKeyWithSerialization`. * Added :class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAPublicKeyWithSerialization` - and deprecated - :class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAPublicKeyWithNumbers`. -* Added - :meth:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAPublicKeyWithSerialization.public_bytes` - to + and deprecated ``DSAPublicKeyWithNumbers``. +* Added ``public_bytes`` to :class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAPublicKeyWithSerialization`. * :class:`~cryptography.hazmat.primitives.hashes.HashAlgorithm` and :class:`~cryptography.hazmat.primitives.hashes.HashContext` were moved from @@ -204,25 +197,24 @@ Changelog * :class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAParameters`, :class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAParametersWithNumbers`, :class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAPrivateKey`, - :class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAPrivateKeyWithNumbers`, + ``DSAPrivateKeyWithNumbers``, :class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAPublicKey` and - :class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAPublicKeyWithNumbers` - were moved from :mod:`~cryptography.hazmat.primitives.interfaces` to + ``DSAPublicKeyWithNumbers`` were moved from + :mod:`~cryptography.hazmat.primitives.interfaces` to :mod:`~cryptography.hazmat.primitives.asymmetric.dsa` * :class:`~cryptography.hazmat.primitives.asymmetric.ec.EllipticCurve`, :class:`~cryptography.hazmat.primitives.asymmetric.ec.EllipticCurveSignatureAlgorithm`, :class:`~cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePrivateKey`, - :class:`~cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePrivateKeyWithNumbers`, + ``EllipticCurvePrivateKeyWithNumbers``, :class:`~cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePublicKey`, - and - :class:`~cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePublicKeyWithNumbers` + and ``EllipticCurvePublicKeyWithNumbers`` were moved from :mod:`~cryptography.hazmat.primitives.interfaces` to :mod:`~cryptography.hazmat.primitives.asymmetric.ec`. * :class:`~cryptography.hazmat.primitives.asymmetric.rsa.RSAPrivateKey`, - :class:`~cryptography.hazmat.primitives.asymmetric.rsa.RSAPrivateKeyWithNumbers`, + ``RSAPrivateKeyWithNumbers``, :class:`~cryptography.hazmat.primitives.asymmetric.rsa.RSAPublicKey` and - :class:`~cryptography.hazmat.primitives.asymmetric.rsa.RSAPublicKeyWithNumbers` - were moved from :mod:`~cryptography.hazmat.primitives.interfaces` to + ``RSAPublicKeyWithNumbers`` were moved from + :mod:`~cryptography.hazmat.primitives.interfaces` to :mod:`~cryptography.hazmat.primitives.asymmetric.rsa`. 0.7.2 - 2015-01-16 diff --git a/docs/development/test-vectors.rst b/docs/development/test-vectors.rst index fe64fe1a..ea44a46c 100644 --- a/docs/development/test-vectors.rst +++ b/docs/development/test-vectors.rst @@ -104,6 +104,10 @@ X.509 cryptography website. * ``wildcard_san.pem`` - A leaf certificate issued by a public CA for ``langui.sh`` that contains wildcard entries in the SAN extension. +* ``san_edipartyname.der`` - A DSA certificate from a `Mozilla bug`_ + containing a SAN extension with an ``ediPartyName`` general name. +* ``san_x400address.der`` - A DSA certificate from a `Mozilla bug`_ containing + a SAN extension with an ``x400Address`` general name. Custom X.509 Vectors ~~~~~~~~~~~~~~~~~~~~ @@ -412,3 +416,4 @@ header format (substituting the correct information): .. _`DigiCert Global Root G3`: http://cacerts.digicert.com/DigiCertGlobalRootG3.crt .. _`root data`: https://hg.mozilla.org/projects/nss/file/25b2922cc564/security/nss/lib/ckfw/builtins/certdata.txt#l2053 .. _`asymmetric/public/PKCS1/dsa.pub.pem`: https://github.com/ruby/ruby/blob/4ccb387f3bc436a08fc6d72c4931994f5de95110/test/openssl/test_pkey_dsa.rb#L53 +.. _`Mozilla bug`: https://bugzilla.mozilla.org/show_bug.cgi?id=233586 diff --git a/docs/hazmat/primitives/asymmetric/dsa.rst b/docs/hazmat/primitives/asymmetric/dsa.rst index 179bb8d1..2ceb7d7d 100644 --- a/docs/hazmat/primitives/asymmetric/dsa.rst +++ b/docs/hazmat/primitives/asymmetric/dsa.rst @@ -284,23 +284,6 @@ Key interfaces The bit length of the modulus. -.. class:: DSAPrivateKeyWithNumbers - - .. versionadded:: 0.5 - - Extends :class:`DSAPrivateKey`. - - .. method:: private_numbers() - - Create a - :class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAPrivateNumbers` - object. - - :returns: A - :class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAPrivateNumbers` - instance. - - .. class:: DSAPrivateKeyWithSerialization .. versionadded:: 0.8 @@ -384,29 +367,6 @@ Key interfaces :returns: :class:`~cryptography.hazmat.primitives.asymmetric.AsymmetricVerificationContext` - -.. class:: DSAPublicKeyWithNumbers - - .. versionadded:: 0.5 - - Extends :class:`DSAPublicKey`. - - .. method:: public_numbers() - - Create a - :class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAPublicNumbers` - object. - - :returns: A - :class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAPublicNumbers` - instance. - -.. class:: DSAPublicKeyWithSerialization - - .. versionadded:: 0.8 - - Extends :class:`DSAPublicKey`. - .. method:: public_numbers() Create a @@ -435,6 +395,13 @@ Key interfaces :return bytes: Serialized key. +.. class:: DSAPublicKeyWithSerialization + + .. versionadded:: 0.8 + + Alias for :class:`DSAPublicKey`. + + .. _`DSA`: https://en.wikipedia.org/wiki/Digital_Signature_Algorithm .. _`public-key`: https://en.wikipedia.org/wiki/Public-key_cryptography .. _`FIPS 186-4`: http://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-4.pdf diff --git a/docs/hazmat/primitives/asymmetric/ec.rst b/docs/hazmat/primitives/asymmetric/ec.rst index 71f6e6fd..e0abe0ab 100644 --- a/docs/hazmat/primitives/asymmetric/ec.rst +++ b/docs/hazmat/primitives/asymmetric/ec.rst @@ -321,19 +321,6 @@ Key Interfaces The EllipticCurvePublicKey object for this private key. -.. class:: EllipticCurvePrivateKeyWithNumbers - - .. versionadded:: 0.6 - - Extends :class:`EllipticCurvePrivateKey`. - - .. method:: private_numbers() - - Create a :class:`EllipticCurvePrivateNumbers` object. - - :returns: An :class:`EllipticCurvePrivateNumbers` instance. - - .. class:: EllipticCurvePrivateKeyWithSerialization .. versionadded:: 0.8 @@ -399,26 +386,6 @@ Key Interfaces The elliptic curve for this key. - -.. class:: EllipticCurvePublicKeyWithNumbers - - .. versionadded:: 0.6 - - Extends :class:`EllipticCurvePublicKey`. - - .. method:: public_numbers() - - Create a :class:`EllipticCurvePublicNumbers` object. - - :returns: An :class:`EllipticCurvePublicNumbers` instance. - - -.. class:: EllipticCurvePublicKeyWithSerialization - - .. versionadded:: 0.6 - - Extends :class:`EllipticCurvePublicKey`. - .. method:: public_numbers() Create a :class:`EllipticCurvePublicNumbers` object. @@ -443,6 +410,13 @@ Key Interfaces :return bytes: Serialized key. +.. class:: EllipticCurvePublicKeyWithSerialization + + .. versionadded:: 0.6 + + Alias for :class:`EllipticCurvePublicKey`. + + .. _`FIPS 186-3`: http://csrc.nist.gov/publications/fips/fips186-3/fips_186-3.pdf .. _`FIPS 186-4`: http://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-4.pdf .. _`some concern`: https://crypto.stackexchange.com/questions/10263/should-we-trust-the-nist-recommended-ecc-parameters diff --git a/docs/hazmat/primitives/asymmetric/rsa.rst b/docs/hazmat/primitives/asymmetric/rsa.rst index 3b5b677b..e8bbf5ce 100644 --- a/docs/hazmat/primitives/asymmetric/rsa.rst +++ b/docs/hazmat/primitives/asymmetric/rsa.rst @@ -113,10 +113,8 @@ It is also possible to serialize without encryption using >>> pem.splitlines()[0] '-----BEGIN RSA PRIVATE KEY-----' -Similarly, if your public key implements -:class:`~cryptography.hazmat.primitives.asymmetric.rsa.RSAPublicKeyWithSerialization` -interface you can use -:meth:`~cryptography.hazmat.primitives.asymmetric.rsa.RSAPublicKeyWithSerialization.public_bytes` +For public keys you can use +:meth:`~cryptography.hazmat.primitives.asymmetric.rsa.RSAPublicKey.public_bytes` to serialize the key. .. doctest:: @@ -518,23 +516,6 @@ Key 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:: RSAPrivateKeyWithSerialization .. versionadded:: 0.8 @@ -625,30 +606,6 @@ Key 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:: RSAPublicKeyWithSerialization - - .. versionadded:: 0.8 - - Extends :class:`RSAPublicKey`. - .. method:: public_numbers() Create a @@ -679,6 +636,13 @@ Key interfaces :return bytes: Serialized key. +.. class:: RSAPublicKeyWithSerialization + + .. versionadded:: 0.8 + + Alias for :class:`RSAPublicKey`. + + .. _`RSA`: https://en.wikipedia.org/wiki/RSA_(cryptosystem) .. _`public-key`: https://en.wikipedia.org/wiki/Public-key_cryptography .. _`specific mathematical properties`: https://en.wikipedia.org/wiki/RSA_(cryptosystem)#Key_generation diff --git a/docs/installation.rst b/docs/installation.rst index 1c25ff78..96e1e8de 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -125,8 +125,23 @@ You'll also need to generate your own ``openssl.ld`` file. For example:: You should replace the version string on the first line as appropriate for your build. +Building cryptography on OS X +----------------------------- + +Building cryptography requires the presence of a C compiler and development +headers. On OS X this is typically provided by Apple's Xcode development tools. +To install the Xcode command line tools on open a terminal window and run: + +.. code-block:: console + + $ xcode-select --install + +This will install a compiler (clang) along with the required development +headers. If you wish to compile against a more recent OpenSSL than the +version shipped with OS X see the next section. + Using your own OpenSSL on OS X ------------------------------- +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To link cryptography against a custom version of OpenSSL you'll need to set ``ARCHFLAGS``, ``LDFLAGS``, and ``CFLAGS``. OpenSSL can be installed via diff --git a/docs/spelling_wordlist.txt b/docs/spelling_wordlist.txt index 235e08d4..1eed7c7a 100644 --- a/docs/spelling_wordlist.txt +++ b/docs/spelling_wordlist.txt @@ -63,3 +63,4 @@ unpadded unpadding Verisign wildcard +Xcode diff --git a/docs/x509.rst b/docs/x509.rst index f94f50eb..a3cf7e25 100644 --- a/docs/x509.rst +++ b/docs/x509.rst @@ -328,6 +328,8 @@ X.509 Certificate Object .. method:: public_bytes(encoding) + .. versionadded:: 1.0 + :param encoding: The :class:`~cryptography.hazmat.primitives.serialization.Encoding` that will be used to serialize the certificate. @@ -435,6 +437,8 @@ X.509 CSR (Certificate Signing Request) Object .. method:: public_bytes(encoding) + .. versionadded:: 1.0 + :param encoding: The :class:`~cryptography.hazmat.primitives.serialization.Encoding` that will be used to serialize the certificate request. diff --git a/src/_cffi_src/openssl/x509v3.py b/src/_cffi_src/openssl/x509v3.py index 52287459..0f5306d0 100644 --- a/src/_cffi_src/openssl/x509v3.py +++ b/src/_cffi_src/openssl/x509v3.py @@ -59,7 +59,8 @@ static const int GEN_IPADD; static const int GEN_RID; typedef struct { - ...; + ASN1_OBJECT *type_id; + ASN1_TYPE *value; } OTHERNAME; typedef struct { diff --git a/src/cryptography/hazmat/backends/openssl/x509.py b/src/cryptography/hazmat/backends/openssl/x509.py index 80e5f2b1..7bfeb2ce 100644 --- a/src/cryptography/hazmat/backends/openssl/x509.py +++ b/src/cryptography/hazmat/backends/openssl/x509.py @@ -36,6 +36,14 @@ def _asn1_integer_to_int(backend, asn1_int): return backend._bn_to_int(bn) +def _asn1_string_to_bytes(backend, asn1_string): + return backend._ffi.buffer(asn1_string.data, asn1_string.length)[:] + + +def _asn1_string_to_ascii(backend, asn1_string): + return _asn1_string_to_bytes(backend, asn1_string).decode("ascii") + + def _asn1_string_to_utf8(backend, asn1_string): buf = backend._ffi.new("unsigned char **") res = backend._lib.ASN1_STRING_to_UTF8(buf, asn1_string) @@ -81,7 +89,7 @@ def _decode_general_names(backend, gns): def _decode_general_name(backend, gn): if gn.type == backend._lib.GEN_DNS: - data = backend._ffi.buffer(gn.d.dNSName.data, gn.d.dNSName.length)[:] + data = _asn1_string_to_bytes(backend, gn.d.dNSName) if data.startswith(b"*."): # This is a wildcard name. We need to remove the leading wildcard, # IDNA decode, then re-add the wildcard. Wildcard characters should @@ -98,10 +106,7 @@ def _decode_general_name(backend, gn): return x509.DNSName(decoded) elif gn.type == backend._lib.GEN_URI: - data = backend._ffi.buffer( - gn.d.uniformResourceIdentifier.data, - gn.d.uniformResourceIdentifier.length - )[:].decode("ascii") + data = _asn1_string_to_ascii(backend, gn.d.uniformResourceIdentifier) parsed = urllib_parse.urlparse(data) hostname = idna.decode(parsed.hostname) if parsed.port: @@ -127,9 +132,7 @@ def _decode_general_name(backend, gn): elif gn.type == backend._lib.GEN_IPADD: return x509.IPAddress( ipaddress.ip_address( - backend._ffi.buffer( - gn.d.iPAddress.data, gn.d.iPAddress.length - )[:] + _asn1_string_to_bytes(backend, gn.d.iPAddress) ) ) elif gn.type == backend._lib.GEN_DIRNAME: @@ -137,9 +140,7 @@ def _decode_general_name(backend, gn): _decode_x509_name(backend, gn.d.directoryName) ) elif gn.type == backend._lib.GEN_EMAIL: - data = backend._ffi.buffer( - gn.d.rfc822Name.data, gn.d.rfc822Name.length - )[:].decode("ascii") + data = _asn1_string_to_ascii(backend, gn.d.rfc822Name) name, address = parseaddr(data) parts = address.split(u"@") if name or len(parts) > 2 or not address: @@ -280,11 +281,10 @@ class _Certificate(object): generalized_time = self._backend._ffi.gc( generalized_time, self._backend._lib.ASN1_GENERALIZEDTIME_free ) - time = self._backend._ffi.string( - self._backend._lib.ASN1_STRING_data( - self._backend._ffi.cast("ASN1_STRING *", generalized_time) - ) - ).decode("ascii") + time = _asn1_string_to_ascii( + self._backend, + self._backend._ffi.cast("ASN1_STRING *", generalized_time) + ) return datetime.datetime.strptime(time, "%Y%m%d%H%M%SZ") @property diff --git a/src/cryptography/hazmat/primitives/asymmetric/dsa.py b/src/cryptography/hazmat/primitives/asymmetric/dsa.py index 733a967c..184177e0 100644 --- a/src/cryptography/hazmat/primitives/asymmetric/dsa.py +++ b/src/cryptography/hazmat/primitives/asymmetric/dsa.py @@ -91,9 +91,6 @@ class DSAPublicKey(object): Returns an AsymmetricVerificationContext used for signing data. """ - -@six.add_metaclass(abc.ABCMeta) -class DSAPublicKeyWithSerialization(DSAPublicKey): @abc.abstractmethod def public_numbers(self): """ @@ -107,6 +104,9 @@ class DSAPublicKeyWithSerialization(DSAPublicKey): """ +DSAPublicKeyWithSerialization = DSAPublicKey + + def generate_parameters(key_size, backend): return backend.generate_dsa_parameters(key_size) diff --git a/src/cryptography/hazmat/primitives/asymmetric/ec.py b/src/cryptography/hazmat/primitives/asymmetric/ec.py index 631fcbf7..f1d39eed 100644 --- a/src/cryptography/hazmat/primitives/asymmetric/ec.py +++ b/src/cryptography/hazmat/primitives/asymmetric/ec.py @@ -85,9 +85,6 @@ class EllipticCurvePublicKey(object): The EllipticCurve that this key is on. """ - -@six.add_metaclass(abc.ABCMeta) -class EllipticCurvePublicKeyWithSerialization(EllipticCurvePublicKey): @abc.abstractmethod def public_numbers(self): """ @@ -101,6 +98,9 @@ class EllipticCurvePublicKeyWithSerialization(EllipticCurvePublicKey): """ +EllipticCurvePublicKeyWithSerialization = EllipticCurvePublicKey + + @utils.register_interface(EllipticCurve) class SECT571R1(object): name = "sect571r1" diff --git a/src/cryptography/hazmat/primitives/asymmetric/rsa.py b/src/cryptography/hazmat/primitives/asymmetric/rsa.py index 772473fd..89eac4d4 100644 --- a/src/cryptography/hazmat/primitives/asymmetric/rsa.py +++ b/src/cryptography/hazmat/primitives/asymmetric/rsa.py @@ -76,9 +76,6 @@ class RSAPublicKey(object): The bit length of the public modulus. """ - -@six.add_metaclass(abc.ABCMeta) -class RSAPublicKeyWithSerialization(RSAPublicKey): @abc.abstractmethod def public_numbers(self): """ @@ -92,6 +89,9 @@ class RSAPublicKeyWithSerialization(RSAPublicKey): """ +RSAPublicKeyWithSerialization = RSAPublicKey + + def generate_private_key(public_exponent, key_size, backend): if not isinstance(backend, RSABackend): raise UnsupportedAlgorithm( diff --git a/tests/test_x509_ext.py b/tests/test_x509_ext.py index 0ef84e79..d15d6669 100644 --- a/tests/test_x509_ext.py +++ b/tests/test_x509_ext.py @@ -1382,18 +1382,16 @@ class TestRSASubjectAlternativeNameExtension(object): dns = ext.value.get_values_for_type(x509.DNSName) assert dns == [u'*.\u043f\u044b\u043a\u0430.cryptography'] - def test_unsupported_other_name(self, backend): + def test_unsupported_gn(self, backend): cert = _load_cert( - os.path.join( - "x509", "custom", "san_other_name.pem" - ), - x509.load_pem_x509_certificate, + os.path.join("x509", "san_x400address.der"), + x509.load_der_x509_certificate, backend ) with pytest.raises(x509.UnsupportedGeneralNameType) as exc: cert.extensions - assert exc.value.type == 0 + assert exc.value.type == 3 def test_registered_id(self, backend): cert = _load_cert( diff --git a/vectors/cryptography_vectors/x509/san_edipartyname.der b/vectors/cryptography_vectors/x509/san_edipartyname.der Binary files differnew file mode 100644 index 00000000..95ec2042 --- /dev/null +++ b/vectors/cryptography_vectors/x509/san_edipartyname.der diff --git a/vectors/cryptography_vectors/x509/san_x400address.der b/vectors/cryptography_vectors/x509/san_x400address.der Binary files differnew file mode 100644 index 00000000..b0d10cf3 --- /dev/null +++ b/vectors/cryptography_vectors/x509/san_x400address.der |