From 538579f7037fc0b8c81dc091eb377fdc6bd51743 Mon Sep 17 00:00:00 2001 From: Mathias Laurin Date: Sat, 24 Feb 2018 23:38:26 +0100 Subject: [PATCH 1/9] CI: Fix deploy --- .circleci/config.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index cd247caf..58cbc038 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -112,7 +112,8 @@ jobs: name: Publish to Pypi command: | if [ "$CIRCLE_BRANCH" = "master" ]; then - echo "[pypi]\nusername = Synss" > $HOME/.pypirc + echo "[pypi]" > $HOME/.pypirc + echo "username = Synss" >> $HOME/.pypirc echo "password = $PYPI_PASSWORD" >> $HOME/.pypirc . venv/bin/activate python setup.py sdist From 728b86034f9f36cff26091c49c759d09b559a029 Mon Sep 17 00:00:00 2001 From: Mathias Laurin Date: Tue, 27 Feb 2018 21:26:56 +0100 Subject: [PATCH 2/9] Add {to,from}_{PEM,DER} to certs --- mbedtls/x509.pxd | 22 +++++++++-- mbedtls/x509.pyx | 58 ++++++++++++++++++++++++++-- tests/test_x509.py | 94 ++++++++++++++++++++++++++++++---------------- 3 files changed, 136 insertions(+), 38 deletions(-) diff --git a/mbedtls/x509.pxd b/mbedtls/x509.pxd index e33b946b..917db350 100644 --- a/mbedtls/x509.pxd +++ b/mbedtls/x509.pxd @@ -11,6 +11,13 @@ __copyright__ = "Copyright 2018, Mathias Laurin" __license__ = "MIT License" +cdef extern from "mbedtls/asn1.h": + cdef struct mbedtls_asn1_buf: + int tag + size_t len + unsigned char *p + + cdef extern from "mbedtls/bignum.h": ctypedef enum mbedtls_mpi: pass @@ -23,8 +30,14 @@ cdef extern from "mbedtls/pk.h": ctypedef enum mbedtls_pk_context: pass +cdef extern from "mbedtls/x509.h": + ctypedef mbedtls_asn1_buf mbedtls_x509_buf + + cdef extern from "mbedtls/x509_crt.h": - ctypedef enum mbedtls_x509_crt: pass + cdef struct mbedtls_x509_crt: + mbedtls_x509_buf raw + ctypedef enum mbedtls_x509_crt_profile: pass ctypedef enum mbedtls_x509write_cert: pass @@ -122,7 +135,9 @@ cdef extern from "mbedtls/x509_crt.h": cdef extern from "mbedtls/x509_csr.h": # Certificate signing request parsing and writing # ----------------------------------------------- - ctypedef enum mbedtls_x509_csr: pass + cdef struct mbedtls_x509_csr: + mbedtls_x509_buf raw + ctypedef enum mbedtls_x509write_csr: pass # mbedtls_x509_csr @@ -182,7 +197,8 @@ cdef extern from "mbedtls/x509_crl.h": # Certificate revocation list parsing # ----------------------------------- ctypedef enum mbedtls_x509_crl_entry: pass - ctypedef enum mbedtls_x509_crl: pass + cdef struct mbedtls_x509_crl: + mbedtls_x509_buf raw # mbedtls_x509_crl # ---------------- diff --git a/mbedtls/x509.pyx b/mbedtls/x509.pyx index d06f1ae8..3ef747ed 100644 --- a/mbedtls/x509.pyx +++ b/mbedtls/x509.pyx @@ -16,6 +16,22 @@ import base64 from mbedtls.exceptions import * +def PEM_to_DER(pem): + return base64.b64decode( + b"".join(line.encode("ascii") for line in pem.splitlines() + if not line.startswith("-----"))) + + +def DER_to_PEM(der, text): + chunk_size = 64 + pem = base64.b64encode(der).decode("ascii") + return "\n".join(( + "-----BEGIN %s-----" % text.upper(), + "\n".join(pem[n:n+chunk_size] for n in range(0, len(pem), chunk_size)), + "-----END %s-----" % text.upper(), + "")) + + cdef class Certificate: """X.509 certificate.""" @@ -32,7 +48,7 @@ cdef class Certificate: """Unallocate all certificate data.""" x509.mbedtls_x509_crt_free(&self._ctx) - def __str__(self): + def _info(self): cdef size_t osize = 2**24 cdef char* output = malloc(osize * sizeof(char)) cdef char* prefix = b"" @@ -75,6 +91,19 @@ cdef class Certificate: &self._ctx, &c_buffer[0], c_buffer.shape[0])) return self + @classmethod + def from_PEM(cls, pem): + return cls.from_DER(PEM_to_DER(pem)) + + def to_DER(self): + return bytes(self._ctx.raw.p[0:self._ctx.raw.len]) + + def to_PEM(self): + return DER_to_PEM(self.to_DER(), "Certificate") + + __bytes__ = to_bytes = to_DER + __str__ = to_PEM + @staticmethod def new(start, end, issuer, issuer_key, subject, subject_key, serial, md_alg): @@ -271,7 +300,7 @@ cdef class CSR: """Unallocate all CSR data.""" x509.mbedtls_x509_csr_free(&self._ctx) - def __str__(self): + def _info(self): cdef size_t osize = 2**24 cdef char* output = malloc(osize * sizeof(char)) cdef char* prefix = b"" @@ -310,6 +339,16 @@ cdef class CSR: &self._ctx, &c_buffer[0], c_buffer.shape[0])) return self + @classmethod + def from_PEM(cls, pem): + return cls.from_DER(PEM_to_DER(pem)) + + def to_DER(self): + return bytes(self._ctx.raw.p[0:self._ctx.raw.len]) + + def to_PEM(self): + return DER_to_PEM(self.to_DER(), "Certificate Request") + @staticmethod def new(key, md_alg, subject): """Return a new CSR.""" @@ -433,7 +472,7 @@ cdef class CRL: """Unallocate all CRL data.""" x509.mbedtls_x509_crl_free(&self._ctx) - def __str__(self): + def _info(self): cdef size_t osize = 2**24 cdef char* output = malloc(osize * sizeof(char)) cdef char* prefix = b"" @@ -471,3 +510,16 @@ cdef class CRL: check_error(x509.mbedtls_x509_crl_parse_der( &self._ctx, &c_buffer[0], c_buffer.shape[0])) return self + + @classmethod + def from_PEM(cls, pem): + return cls.from_DER(PEM_to_DER(pem)) + + def to_DER(self): + return bytes(self._ctx.raw.p[0:self._ctx.raw.len]) + + def to_PEM(self): + return DER_to_PEM(self.to_DER(), "X509 CRL") + + __bytes__ = to_bytes = to_DER + __str__ = to_PEM diff --git a/tests/test_x509.py b/tests/test_x509.py index 69dff60c..fc86ee59 100644 --- a/tests/test_x509.py +++ b/tests/test_x509.py @@ -12,12 +12,6 @@ from mbedtls.x509 import * -def pem_to_der(pem): - return base64.b64decode( - b"".join(line.encode("ascii") for line in pem.splitlines() - if not line.startswith("-----"))) - - @pytest.fixture def now(): return dt.datetime.utcnow() @@ -46,21 +40,33 @@ def crt_pem(self): @pytest.fixture def crt_der(self, crt_pem): - return pem_to_der(crt_pem) + return PEM_to_DER(crt_pem) def test_from_buffer(self, crt_der): crt = Certificate.from_buffer(crt_der) - assert "wikipedia.org" in str(crt) + assert "wikipedia.org" in crt._info() def test_from_DER(self, crt_der): crt = Certificate.from_DER(crt_der) - assert "wikipedia.org" in str(crt) + assert "wikipedia.org" in crt._info() + + def test_from_PEM(self, crt_pem): + crt = Certificate.from_PEM(crt_pem) + assert crt.to_PEM() == crt_pem def test_from_file(self, crt_der, tmpdir): path = tmpdir.join("key.der") path.write_binary(crt_der) crt = Certificate.from_file(path) - assert "wikipedia.org" in str(crt) + assert "wikipedia.org" in crt._info() + + def test_to_DER(self, crt_der): + crt = Certificate.from_DER(crt_der) + assert crt.to_DER() == crt_der + + def test_to_PEM(self, crt_pem): + crt = Certificate.from_PEM(crt_pem) + assert crt.to_PEM() == crt_pem def test_new(self, now, issuer_key, subject_key): crt = Certificate.new( @@ -72,7 +78,7 @@ def test_new(self, now, issuer_key, subject_key): subject_key=subject_key, serial=0x1234567890, md_alg=hash.sha1()) - assert "12:34:56:78:90" in str(crt) + assert "12:34:56:78:90" in crt._info() def test_revocation_bad_cast(self, crt_der): crt = Certificate.from_buffer(crt_der) @@ -93,34 +99,34 @@ def crt_writer(self, now, issuer_key, subject_key): def test_to_pem(self, crt_writer): pem = crt_writer.to_PEM() - assert pem == str(crt_writer.to_PEM()) + assert pem == crt_writer.to_PEM() assert pem.splitlines()[0] == "-----BEGIN CERTIFICATE-----" assert pem.splitlines()[-1] == "-----END CERTIFICATE-----" def test_to_der(self, crt_writer): - assert pem_to_der(crt_writer.to_PEM()) == crt_writer.to_DER() + assert PEM_to_DER(crt_writer.to_PEM()) == crt_writer.to_DER() def test_to_bytes(self, crt_writer): assert crt_writer.to_DER() == crt_writer.to_bytes() def test_to_certificate(self, crt_writer): crt = crt_writer.to_certificate() - assert "cert. version" in str(crt) - assert "PolarSSL" in str(crt) + assert "cert. version" in crt._info() + assert "PolarSSL" in crt._info() def test_set_serial(self, crt_writer): - assert "12:34:56:78:90" not in str(crt_writer.to_certificate()) + assert "12:34:56:78:90" not in crt_writer.to_certificate()._info() serial = 0x1234567890 crt_writer.set_serial(serial) - assert "12:34:56:78:90" in str(crt_writer.to_certificate()) + assert "12:34:56:78:90" in crt_writer.to_certificate()._info() def test_set_subject(self, crt_writer): - assert "Server 1" not in str(crt_writer.to_certificate()) + assert "Server 1" not in crt_writer.to_certificate()._info() subject = "C=NL,O=PolarSSL,CN=PolarSSL Server 1" crt_writer.set_subject(subject) - assert "Server 1" in str(crt_writer.to_certificate()) + assert "Server 1" in crt_writer.to_certificate()._info() class TestCSR: @@ -132,26 +138,38 @@ def csr_pem(self, subject_key): @pytest.fixture def csr_der(self, csr_pem): - return pem_to_der(csr_pem) + return PEM_to_DER(csr_pem) def test_from_buffer(self, csr_der): csr = CSR.from_buffer(csr_der) - assert "PolarSSL" in str(csr) + assert "PolarSSL" in csr._info() def test_from_DER(self, csr_der): csr = CSR.from_DER(csr_der) - assert "PolarSSL" in str(csr) + assert "PolarSSL" in csr._info() + + def test_from_PEM(self, csr_pem): + csr = CSR.from_PEM(csr_pem) + assert csr.to_PEM() == csr_pem def test_from_file(self, csr_der, tmpdir): path = tmpdir.join("key.der") path.write_binary(csr_der) csr = CSR.from_file(path) - assert "PolarSSL" in str(csr) + assert "PolarSSL" in csr._info() + + def test_to_DER(self, csr_der): + csr = CSR.from_DER(csr_der) + assert csr.to_DER() == csr_der + + def test_to_PEM(self, csr_pem): + csr = CSR.from_PEM(csr_pem) + assert csr.to_PEM() == csr_pem def test_new(self, subject_key): csr = CSR.new(subject_key, hash.sha1(), "C=NL,O=PolarSSL,CN=PolarSSL Server 1") - assert "PolarSSL" in str(csr) + assert "PolarSSL" in csr._info() class TestCSRWriter: @@ -163,12 +181,12 @@ def csr_writer(self, subject_key): def test_to_pem(self, csr_writer): pem = csr_writer.to_PEM() - assert pem == str(csr_writer.to_PEM()) + assert pem == csr_writer.to_PEM() assert pem.splitlines()[0] == "-----BEGIN CERTIFICATE REQUEST-----" assert pem.splitlines()[-1] == "-----END CERTIFICATE REQUEST-----" def test_to_der(self, csr_writer): - assert pem_to_der(csr_writer.to_PEM()) == csr_writer.to_DER() + assert PEM_to_DER(csr_writer.to_PEM()) == csr_writer.to_DER() def test_to_bytes(self, csr_writer): assert csr_writer.to_DER() == csr_writer.to_bytes() @@ -186,7 +204,7 @@ def crl_pem(self): @pytest.fixture def crl_der(self, crl_pem): - return pem_to_der(crl_pem) + return PEM_to_DER(crl_pem) @pytest.fixture def crt_pem(self): @@ -195,21 +213,33 @@ def crt_pem(self): @pytest.fixture def crt_der(self, crt_pem): - return pem_to_der(crt_pem) + return PEM_to_DER(crt_pem) def test_from_buffer(self, crl_der): crl = CRL.from_buffer(crl_der) - assert "CRL version" in str(crl) + assert "CRL version" in crl._info() def test_from_file(self, crl_der, tmpdir): path = tmpdir.join("key.der") path.write_binary(crl_der) crl = CRL.from_file(path) - assert "CRL version" in str(crl) + assert "CRL version" in crl._info() - def test_from_der(self, crl_der): + def test_from_DER(self, crl_der): crl = CRL.from_DER(crl_der) - assert "CRL version" in str(crl) + assert "CRL version" in crl._info() + + def test_from_PEM(self, crl_pem): + crl = CRL.from_PEM(crl_pem) + assert crl.to_PEM() == crl_pem + + def test_to_DER(self, crl_der): + crl = CRL.from_DER(crl_der) + assert crl.to_DER() == crl_der + + def test_to_PEM(self, crl_pem): + crl = CRL.from_PEM(crl_pem) + assert crl.to_PEM() == crl_pem def test_revocation_false(self, crl_der, crt_der): crt = Certificate.from_buffer(crt_der) From 2b1e9348b035c18b43cfaa82a0d37ebec78e3672 Mon Sep 17 00:00:00 2001 From: Mathias Laurin Date: Sat, 3 Mar 2018 20:55:26 +0100 Subject: [PATCH 3/9] x509: `__next__` returns the next crt in the chain --- README.rst | 9 ++++++-- mbedtls/x509.pxd | 4 ++++ mbedtls/x509.pyx | 54 +++++++++++++++++++++++++++++++++++++++------- tests/test_x509.py | 7 ++++++ 4 files changed, 64 insertions(+), 10 deletions(-) diff --git a/README.rst b/README.rst index 98221be7..f8e4307f 100644 --- a/README.rst +++ b/README.rst @@ -48,9 +48,11 @@ The bindings are tested with Python 2.7, 3.4, 3.5, and 3.6. `mbedtls` is available on Debian. Install with:: - # aptitude install libmbedtls-dev + # apt-get install libmbedtls-dev + # apt-get install libpython-dev # for Python 2, or + # apt-get install libpython3-dev # for Python 3 -and the `pyton-mbedtls`:: +and `pyton-mbedtls`:: $ python -m pip install python-mbedtls @@ -204,6 +206,9 @@ Create new X.509 certificates:: >>> csr = CSR.new(subject_key, hash.sha1(), "C=NL,O=PolarSSL,CN=PolarSSL Server 1") +Call ``next(crt)`` to obtain the next certificate in a chain. The +call raises `StopIteration` if there is no further certificate. + and load existing certificates from file:: >>> crl = CRL.from_file("ca/wp_crl.pem") diff --git a/mbedtls/x509.pxd b/mbedtls/x509.pxd index 917db350..ca924af8 100644 --- a/mbedtls/x509.pxd +++ b/mbedtls/x509.pxd @@ -37,6 +37,8 @@ cdef extern from "mbedtls/x509.h": cdef extern from "mbedtls/x509_crt.h": cdef struct mbedtls_x509_crt: mbedtls_x509_buf raw + mbedtls_x509_crt *next + int version ctypedef enum mbedtls_x509_crt_profile: pass ctypedef enum mbedtls_x509write_cert: pass @@ -199,6 +201,8 @@ cdef extern from "mbedtls/x509_crl.h": ctypedef enum mbedtls_x509_crl_entry: pass cdef struct mbedtls_x509_crl: mbedtls_x509_buf raw + mbedtls_x509_crl *next + int version # mbedtls_x509_crl # ---------------- diff --git a/mbedtls/x509.pyx b/mbedtls/x509.pyx index 3ef747ed..a081545f 100644 --- a/mbedtls/x509.pyx +++ b/mbedtls/x509.pyx @@ -48,6 +48,20 @@ cdef class Certificate: """Unallocate all certificate data.""" x509.mbedtls_x509_crt_free(&self._ctx) + def __hash__(self): + return hash(self.to_DER()) + + def __eq__(self, other): + if type(other) is not type(self): + return NotImplemented + return self.to_DER() == other.to_DER() + + def __next__(self): + if self._ctx.next == NULL or self._ctx.version == 0: + raise StopIteration + cdef mbedtls_x509_buf buf = self._ctx.next.raw + return type(self).from_DER(buf.p[0:buf.len]) + def _info(self): cdef size_t osize = 2**24 cdef char* output = malloc(osize * sizeof(char)) @@ -91,17 +105,18 @@ cdef class Certificate: &self._ctx, &c_buffer[0], c_buffer.shape[0])) return self + def to_DER(self): + return bytes(self._ctx.raw.p[0:self._ctx.raw.len]) + + __bytes__ = to_bytes = to_DER + @classmethod def from_PEM(cls, pem): return cls.from_DER(PEM_to_DER(pem)) - def to_DER(self): - return bytes(self._ctx.raw.p[0:self._ctx.raw.len]) - def to_PEM(self): return DER_to_PEM(self.to_DER(), "Certificate") - __bytes__ = to_bytes = to_DER __str__ = to_PEM @staticmethod @@ -300,6 +315,14 @@ cdef class CSR: """Unallocate all CSR data.""" x509.mbedtls_x509_csr_free(&self._ctx) + def __hash__(self): + return hash(self.to_DER()) + + def __eq__(self, other): + if type(other) is not type(self): + return NotImplemented + return self.to_DER() == other.to_DER() + def _info(self): cdef size_t osize = 2**24 cdef char* output = malloc(osize * sizeof(char)) @@ -472,6 +495,20 @@ cdef class CRL: """Unallocate all CRL data.""" x509.mbedtls_x509_crl_free(&self._ctx) + def __hash__(self): + return hash(self.to_DER()) + + def __eq__(self, other): + if type(other) is not type(self): + return NotImplemented + return self.to_DER() == other.to_DER() + + def __next__(self): + if self._ctx.next == NULL or self._ctx.version == 0: + raise StopIteration + cdef mbedtls_x509_buf buf = self._ctx.next.raw + return type(self).from_DER(buf.p[0:buf.len]) + def _info(self): cdef size_t osize = 2**24 cdef char* output = malloc(osize * sizeof(char)) @@ -511,15 +548,16 @@ cdef class CRL: &self._ctx, &c_buffer[0], c_buffer.shape[0])) return self + def to_DER(self): + return bytes(self._ctx.raw.p[0:self._ctx.raw.len]) + + __bytes__ = to_bytes = to_DER + @classmethod def from_PEM(cls, pem): return cls.from_DER(PEM_to_DER(pem)) - def to_DER(self): - return bytes(self._ctx.raw.p[0:self._ctx.raw.len]) - def to_PEM(self): return DER_to_PEM(self.to_DER(), "X509 CRL") - __bytes__ = to_bytes = to_DER __str__ = to_PEM diff --git a/tests/test_x509.py b/tests/test_x509.py index fc86ee59..b8da2792 100644 --- a/tests/test_x509.py +++ b/tests/test_x509.py @@ -5,6 +5,7 @@ except ImportError: from pathlib2 import Path +import certifi import pytest from mbedtls.pk import RSA @@ -85,6 +86,12 @@ def test_revocation_bad_cast(self, crt_der): with pytest.raises(TypeError): crt.check_revocation(crt) + def test_next(self): + crt = Certificate.from_file(certifi.where()) + with pytest.raises(StopIteration): + while True: + crt = next(crt) + class TestCRTWriter: From 1d9faab32a667ab4e0cd12b0ffa4deafce3f46a6 Mon Sep 17 00:00:00 2001 From: Mathias Laurin Date: Sat, 10 Mar 2018 21:31:01 +0100 Subject: [PATCH 4/9] x509: private writers --- mbedtls/x509.pxd | 4 ++-- mbedtls/x509.pyx | 12 ++++++------ tests/test_x509.py | 11 ++++++----- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/mbedtls/x509.pxd b/mbedtls/x509.pxd index ca924af8..9cc4b903 100644 --- a/mbedtls/x509.pxd +++ b/mbedtls/x509.pxd @@ -231,7 +231,7 @@ cdef class Certificate: cpdef _from_buffer(cls, unsigned char[:] buffer) -cdef class CertificateWriter: +cdef class _CertificateWriter: cdef mbedtls_x509write_cert _ctx @@ -240,7 +240,7 @@ cdef class CSR: cpdef _from_buffer(cls, unsigned char[:] buffer) -cdef class CSRWriter: +cdef class _CSRWriter: cdef mbedtls_x509write_csr _ctx diff --git a/mbedtls/x509.pyx b/mbedtls/x509.pyx index a081545f..fb9b7a3c 100644 --- a/mbedtls/x509.pyx +++ b/mbedtls/x509.pyx @@ -123,12 +123,12 @@ cdef class Certificate: def new(start, end, issuer, issuer_key, subject, subject_key, serial, md_alg): """Return a new certificate.""" - return CertificateWriter( + return _CertificateWriter( start, end, issuer, issuer_key, subject, subject_key, serial, md_alg).to_certificate() -cdef class CertificateWriter: +cdef class _CertificateWriter: """CRT writing context. This class should not be used directly. @@ -138,7 +138,7 @@ cdef class CertificateWriter: def __init__(self, start, end, issuer, issuer_key, subject, subject_key, serial, md_alg): - super(CertificateWriter, self).__init__() + super(_CertificateWriter, self).__init__() self.set_validity(start, end) self.set_issuer(issuer) self.set_issuer_key(issuer_key) @@ -375,17 +375,17 @@ cdef class CSR: @staticmethod def new(key, md_alg, subject): """Return a new CSR.""" - return CSRWriter(key, md_alg, subject).to_certificate() + return _CSRWriter(key, md_alg, subject).to_certificate() -cdef class CSRWriter: +cdef class _CSRWriter: """X.509 CSR writing context. This class should not be used directly. Use `CSR.new()` instead. """ def __init__(self, key, md_alg, subject): - super(CSRWriter, self).__init__() + super(_CSRWriter, self).__init__() self.set_key(key) self.set_algorithm(md_alg) self.set_subject(subject) diff --git a/tests/test_x509.py b/tests/test_x509.py index b8da2792..d6f65a8e 100644 --- a/tests/test_x509.py +++ b/tests/test_x509.py @@ -11,6 +11,7 @@ from mbedtls.pk import RSA from mbedtls import hash from mbedtls.x509 import * +from mbedtls.x509 import _CertificateWriter, _CSRWriter @pytest.fixture @@ -97,7 +98,7 @@ class TestCRTWriter: @pytest.fixture def crt_writer(self, now, issuer_key, subject_key): - return CertificateWriter( + return _CertificateWriter( start=now, end=now + dt.timedelta(days=90), issuer="C=NL,O=PolarSSL,CN=PolarSSL Test CA", issuer_key=issuer_key, subject=None, subject_key=subject_key, @@ -140,8 +141,8 @@ class TestCSR: @pytest.fixture def csr_pem(self, subject_key): - return CSRWriter(subject_key, hash.sha1(), - "C=NL,O=PolarSSL,CN=PolarSSL Server 1").to_PEM() + return _CSRWriter(subject_key, hash.sha1(), + "C=NL,O=PolarSSL,CN=PolarSSL Server 1").to_PEM() @pytest.fixture def csr_der(self, csr_pem): @@ -183,8 +184,8 @@ class TestCSRWriter: @pytest.fixture def csr_writer(self, subject_key): - return CSRWriter(subject_key, hash.sha1(), - "C=NL,O=PolarSSL,CN=PolarSSL Server 1") + return _CSRWriter(subject_key, hash.sha1(), + "C=NL,O=PolarSSL,CN=PolarSSL Server 1") def test_to_pem(self, csr_writer): pem = csr_writer.to_PEM() From aa03a319870c6a5dac222a1dbc5100a237a9cee2 Mon Sep 17 00:00:00 2001 From: Mathias Laurin Date: Mon, 12 Mar 2018 23:06:48 +0100 Subject: [PATCH 5/9] pk: Do not export CipherBase --- mbedtls/pk/_pk.pyx | 3 +-- tests/test_pk.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/mbedtls/pk/_pk.pyx b/mbedtls/pk/_pk.pyx index 477ae419..889565f3 100644 --- a/mbedtls/pk/_pk.pyx +++ b/mbedtls/pk/_pk.pyx @@ -14,8 +14,7 @@ from mbedtls.exceptions import check_error, PkError import mbedtls.hash as _hash -__all__ = ("CipherBase", "CIPHER_NAME", "check_pair", - "get_supported_ciphers", "get_rng") +__all__ = ("CIPHER_NAME", "check_pair", "get_supported_ciphers", "get_rng") CIPHER_NAME = ( diff --git a/tests/test_pk.py b/tests/test_pk.py index 9c62d0f5..e98890fc 100644 --- a/tests/test_pk.py +++ b/tests/test_pk.py @@ -9,7 +9,7 @@ import mbedtls.hash as _hash from mbedtls.exceptions import * from mbedtls.exceptions import _ErrorBase -from mbedtls.pk._pk import _type_from_name, _get_md_alg +from mbedtls.pk._pk import _type_from_name, _get_md_alg, CipherBase from mbedtls.pk import * From 75c4f9e7097edea3d6857ea7838db27cddf90679 Mon Sep 17 00:00:00 2001 From: Mathias Laurin Date: Sun, 11 Mar 2018 00:32:47 +0100 Subject: [PATCH 6/9] Cleaner abs / rel imports --- mbedtls/__init__.py | 16 ++++++++++++++++ mbedtls/__init__.pyx | 16 ---------------- mbedtls/_md.pyx | 2 +- mbedtls/_mpi.pyx | 2 +- mbedtls/cipher/AES.pyx | 4 ++-- mbedtls/cipher/ARC4.pyx | 4 ++-- mbedtls/cipher/Blowfish.pyx | 4 ++-- mbedtls/cipher/Camellia.pyx | 4 ++-- mbedtls/cipher/DES.pyx | 4 ++-- mbedtls/cipher/DES3.pyx | 4 ++-- mbedtls/cipher/DES3dbl.pyx | 4 ++-- mbedtls/cipher/__init__.py | 22 ++++++++++++++++++++++ mbedtls/cipher/__init__.pyx | 21 --------------------- mbedtls/cipher/_cipher.pyx | 2 +- mbedtls/hash.pyx | 4 ++-- mbedtls/hmac.pyx | 4 ++-- mbedtls/pk/RSA.pyx | 4 ++-- mbedtls/pk/__init__.py | 10 ++++++++++ mbedtls/pk/__init__.pyx | 10 ---------- mbedtls/pk/_pk.pyx | 2 +- mbedtls/random.pyx | 2 +- mbedtls/x509.pyx | 2 +- 22 files changed, 74 insertions(+), 73 deletions(-) delete mode 100644 mbedtls/__init__.pyx delete mode 100644 mbedtls/cipher/__init__.pyx delete mode 100644 mbedtls/pk/__init__.pyx diff --git a/mbedtls/__init__.py b/mbedtls/__init__.py index e69de29b..0b2830ca 100644 --- a/mbedtls/__init__.py +++ b/mbedtls/__init__.py @@ -0,0 +1,16 @@ +"""python-mbedtls is a this wrapper to ARM's mbed TLS library.""" + +__author__ = "Mathias Laurin" +__copyright__ = "Copyright 2015, Elaborated Networks GmbH" +__license__ = "MIT License" + + +import mbedtls.cipher as cipher +import mbedtls.exceptions as exceptions +import mbedtls.hash as hash +import mbedtls.hmac as hmac +import mbedtls.pk as pk +import mbedtls.random as random + + +__all__ = ("cipher", "exceptions", "hash", "hmac", "pk", "random") diff --git a/mbedtls/__init__.pyx b/mbedtls/__init__.pyx deleted file mode 100644 index fb13a7d0..00000000 --- a/mbedtls/__init__.pyx +++ /dev/null @@ -1,16 +0,0 @@ -"""python-mbedtls is a this wrapper to ARM's mbed TLS library.""" - -__author__ = "Mathias Laurin" -__copyright__ = "Copyright 2015, Elaborated Networks GmbH" -__license__ = "MIT License" - - -import mbedtls.cipher as cipher -import mbedtls.exceptions as exceptions -import mbedtls.hash as hash -import mbedtls.hmac as hmac -import mbedtls.pk as pk -import mbedtls.random as random - - -__all__ = "cipher", "exceptions", "hash", "hmac", "pk", "random" diff --git a/mbedtls/_md.pyx b/mbedtls/_md.pyx index 9a2adae9..2aeb2784 100644 --- a/mbedtls/_md.pyx +++ b/mbedtls/_md.pyx @@ -5,7 +5,7 @@ __copyright__ = "Copyright 2015, Elaborated Networks GmbH" __license__ = "MIT License" -cimport _md +cimport mbedtls._md as _md from libc.stdlib cimport malloc, free import binascii from mbedtls.exceptions import * diff --git a/mbedtls/_mpi.pyx b/mbedtls/_mpi.pyx index fcee867e..b4ef45f6 100644 --- a/mbedtls/_mpi.pyx +++ b/mbedtls/_mpi.pyx @@ -5,7 +5,7 @@ __copyright__ = "Copyright 2018, Mathias Laurin" __license__ = "MIT License" -cimport _mpi +cimport mbedtls._mpi as _mpi from libc.stdlib cimport malloc, free import numbers diff --git a/mbedtls/cipher/AES.pyx b/mbedtls/cipher/AES.pyx index dafd3c9f..20dfdd57 100644 --- a/mbedtls/cipher/AES.pyx +++ b/mbedtls/cipher/AES.pyx @@ -8,8 +8,8 @@ __copyright__ = "Copyright 2016, Elaborated Networks GmbH" __license__ = "MIT License" -cimport _cipher -import _cipher +cimport mbedtls.cipher._cipher as _cipher +import mbedtls.cipher._cipher as _cipher from mbedtls.exceptions import * diff --git a/mbedtls/cipher/ARC4.pyx b/mbedtls/cipher/ARC4.pyx index dcfc094c..1226ab17 100644 --- a/mbedtls/cipher/ARC4.pyx +++ b/mbedtls/cipher/ARC4.pyx @@ -7,8 +7,8 @@ __copyright__ = "Copyright 2016, Elaborated Networks GmbH" __license__ = "MIT License" -cimport _cipher -import _cipher +cimport mbedtls.cipher._cipher as _cipher +import mbedtls.cipher._cipher as _cipher from mbedtls.exceptions import * diff --git a/mbedtls/cipher/Blowfish.pyx b/mbedtls/cipher/Blowfish.pyx index 1a2429c9..fed74b86 100644 --- a/mbedtls/cipher/Blowfish.pyx +++ b/mbedtls/cipher/Blowfish.pyx @@ -6,8 +6,8 @@ __copyright__ = "Copyright 2016, Elaborated Networks GmbH" __license__ = "MIT License" -cimport _cipher -import _cipher +cimport mbedtls.cipher._cipher as _cipher +import mbedtls.cipher._cipher as _cipher from mbedtls.exceptions import * diff --git a/mbedtls/cipher/Camellia.pyx b/mbedtls/cipher/Camellia.pyx index 93f112f0..04e7499d 100644 --- a/mbedtls/cipher/Camellia.pyx +++ b/mbedtls/cipher/Camellia.pyx @@ -5,8 +5,8 @@ __copyright__ = "Copyright 2016, Elaborated Networks GmbH" __license__ = "MIT License" -cimport _cipher -import _cipher +cimport mbedtls.cipher._cipher as _cipher +import mbedtls.cipher._cipher as _cipher from mbedtls.exceptions import * diff --git a/mbedtls/cipher/DES.pyx b/mbedtls/cipher/DES.pyx index 896bcfb4..86f6efe2 100644 --- a/mbedtls/cipher/DES.pyx +++ b/mbedtls/cipher/DES.pyx @@ -7,8 +7,8 @@ __copyright__ = "Copyright 2016, Elaborated Networks GmbH" __license__ = "MIT License" -cimport _cipher -import _cipher +cimport mbedtls.cipher._cipher as _cipher +import mbedtls.cipher._cipher as _cipher from mbedtls.exceptions import * diff --git a/mbedtls/cipher/DES3.pyx b/mbedtls/cipher/DES3.pyx index 8f9ad643..aa379004 100644 --- a/mbedtls/cipher/DES3.pyx +++ b/mbedtls/cipher/DES3.pyx @@ -7,8 +7,8 @@ __copyright__ = "Copyright 2016, Elaborated Networks GmbH" __license__ = "MIT License" -cimport _cipher -import _cipher +cimport mbedtls.cipher._cipher as _cipher +import mbedtls.cipher._cipher as _cipher from mbedtls.exceptions import * diff --git a/mbedtls/cipher/DES3dbl.pyx b/mbedtls/cipher/DES3dbl.pyx index 58e9f5de..5e17b79b 100644 --- a/mbedtls/cipher/DES3dbl.pyx +++ b/mbedtls/cipher/DES3dbl.pyx @@ -7,8 +7,8 @@ __copyright__ = "Copyright 2016, Elaborated Networks GmbH" __license__ = "MIT License" -cimport _cipher -import _cipher +cimport mbedtls.cipher._cipher as _cipher +import mbedtls.cipher._cipher as _cipher from mbedtls.exceptions import * diff --git a/mbedtls/cipher/__init__.py b/mbedtls/cipher/__init__.py index e69de29b..6fef1484 100644 --- a/mbedtls/cipher/__init__.py +++ b/mbedtls/cipher/__init__.py @@ -0,0 +1,22 @@ +"""The cipher package provide symmetric encryption and decryption. + +The API follows the recommendations from PEP 272 "API for Block +Encryption Algorithms" + +""" +__author__ = "Mathias Laurin" +__copyright__ = "Copyright 2016, Elaborated Networks GmbH" +__license__ = "MIT License" + +from ._cipher import * +from . import AES +from . import ARC4 +from . import Blowfish +from . import Camellia +from . import DES +from . import DES3 +from . import DES3dbl + + +__all__ = _cipher.__all__ + ( + "AES", "ARC4", "Blowfish", "Camellia", "DES", "DES3", "DES3dbl") diff --git a/mbedtls/cipher/__init__.pyx b/mbedtls/cipher/__init__.pyx deleted file mode 100644 index 3f8334f9..00000000 --- a/mbedtls/cipher/__init__.pyx +++ /dev/null @@ -1,21 +0,0 @@ -"""The cipher package provide symmetric encryption and decryption. - -The API follows the recommendations from PEP 272 "API for Block -Encryption Algorithms" - -""" -__author__ = "Mathias Laurin" -__copyright__ = "Copyright 2016, Elaborated Networks GmbH" -__license__ = "MIT License" - -from _cipher import * -import AES -import ARC4 -import Blowfish -import Camellia -import DES -import DES3 -import DES3dbl - - -__all__ = _cipher.__all__ diff --git a/mbedtls/cipher/_cipher.pyx b/mbedtls/cipher/_cipher.pyx index 3c7a4eb6..517339b5 100644 --- a/mbedtls/cipher/_cipher.pyx +++ b/mbedtls/cipher/_cipher.pyx @@ -6,7 +6,7 @@ __copyright__ = "Copyright 2015, Elaborated Networks GmbH" __license__ = "MIT License" -cimport _cipher +cimport mbedtls.cipher._cipher as _cipher from libc.stdlib cimport malloc, free from mbedtls.exceptions import * diff --git a/mbedtls/hash.pyx b/mbedtls/hash.pyx index 805fb248..b5fe4c43 100644 --- a/mbedtls/hash.pyx +++ b/mbedtls/hash.pyx @@ -6,8 +6,8 @@ __license__ = "MIT License" from libc.stdlib cimport malloc, free -cimport _md -import _md +cimport mbedtls._md as _md +import mbedtls._md as _md from mbedtls.exceptions import * diff --git a/mbedtls/hmac.pyx b/mbedtls/hmac.pyx index 8449700a..469de428 100644 --- a/mbedtls/hmac.pyx +++ b/mbedtls/hmac.pyx @@ -6,8 +6,8 @@ __license__ = "MIT License" from libc.stdlib cimport malloc, free -cimport _md -import _md +cimport mbedtls._md as _md +import mbedtls._md as _md from mbedtls.exceptions import * diff --git a/mbedtls/pk/RSA.pyx b/mbedtls/pk/RSA.pyx index 0a73c620..5456fe50 100644 --- a/mbedtls/pk/RSA.pyx +++ b/mbedtls/pk/RSA.pyx @@ -5,8 +5,8 @@ __copyright__ = "Copyright 2016, Elaborated Networks GmbH" __license__ = "MIT License" -cimport _pk -import mbedtls.pk as _pk +cimport mbedtls.pk._pk as _pk +import mbedtls.pk._pk as _pk cimport mbedtls.random as _random import mbedtls.random as _random from mbedtls.exceptions import check_error diff --git a/mbedtls/pk/__init__.py b/mbedtls/pk/__init__.py index e69de29b..604b1ae3 100644 --- a/mbedtls/pk/__init__.py +++ b/mbedtls/pk/__init__.py @@ -0,0 +1,10 @@ +"""The pk package provides asymmetric encryption and decryption.""" + +__author__ = "Mathias Laurin" +__copyright__ = "Copyright 2016, Elaborated Networks GmbH" +__license__ = "MIT License" + +from ._pk import * +from .RSA import RSA + +__all__ = _pk.__all__ + ("RSA",) diff --git a/mbedtls/pk/__init__.pyx b/mbedtls/pk/__init__.pyx deleted file mode 100644 index 5115f81a..00000000 --- a/mbedtls/pk/__init__.pyx +++ /dev/null @@ -1,10 +0,0 @@ -"""The pk package provides asymmetric encryption and decryption.""" - -__author__ = "Mathias Laurin" -__copyright__ = "Copyright 2016, Elaborated Networks GmbH" -__license__ = "MIT License" - -from _pk import * -from RSA import RSA - -__all__ = _pk.__all__ + ("RSA",) diff --git a/mbedtls/pk/_pk.pyx b/mbedtls/pk/_pk.pyx index 889565f3..4cfeae1e 100644 --- a/mbedtls/pk/_pk.pyx +++ b/mbedtls/pk/_pk.pyx @@ -6,7 +6,7 @@ __license__ = "MIT License" from libc.stdlib cimport malloc, free -cimport _pk +cimport mbedtls.pk._pk as _pk cimport mbedtls.random as _random from functools import partial import mbedtls.random as _random diff --git a/mbedtls/random.pyx b/mbedtls/random.pyx index e3b7dc4e..0d321ad2 100644 --- a/mbedtls/random.pyx +++ b/mbedtls/random.pyx @@ -6,7 +6,7 @@ __license__ = "MIT License" from libc.stdlib cimport malloc, free -cimport random +cimport mbedtls.random as random import binascii from mbedtls.exceptions import check_error diff --git a/mbedtls/x509.pyx b/mbedtls/x509.pyx index fb9b7a3c..571d535d 100644 --- a/mbedtls/x509.pyx +++ b/mbedtls/x509.pyx @@ -6,7 +6,7 @@ __license__ = "MIT License" from libc.stdlib cimport malloc, free -cimport x509 +cimport mbedtls.x509 as x509 cimport mbedtls._mpi as _mpi cimport mbedtls.pk._pk as _pk From 58d3a4077d2d7eafbaeb9804b17b57274ad910b3 Mon Sep 17 00:00:00 2001 From: Mathias Laurin Date: Tue, 13 Mar 2018 22:25:09 +0100 Subject: [PATCH 7/9] md: Implement block_size property --- mbedtls/_md.pxd | 12 +++++++----- mbedtls/_md.pyx | 5 +++-- mbedtls/hash.pyx | 3 ++- mbedtls/hmac.pyx | 3 ++- tests/test_md.py | 4 ++++ 5 files changed, 18 insertions(+), 9 deletions(-) diff --git a/mbedtls/_md.pxd b/mbedtls/_md.pxd index 1f166271..d297b2ae 100644 --- a/mbedtls/_md.pxd +++ b/mbedtls/_md.pxd @@ -5,15 +5,17 @@ __copyright__ = "Copyright 2015, Elaborated Networks GmbH" __license__ = "MIT License" +cdef extern from "mbedtls/md_internal.h": + ctypedef struct mbedtls_md_info_t: + int block_size + + cdef extern from "mbedtls/md.h": ctypedef enum mbedtls_md_type_t: pass - ctypedef enum mbedtls_md_info_t: - pass - - ctypedef enum mbedtls_md_context_t: - pass + ctypedef struct mbedtls_md_context_t: + const mbedtls_md_info_t *md_info const int *mbedtls_md_list() const mbedtls_md_info_t *mbedtls_md_info_from_string( diff --git a/mbedtls/_md.pyx b/mbedtls/_md.pyx index 2aeb2784..76d15271 100644 --- a/mbedtls/_md.pyx +++ b/mbedtls/_md.pyx @@ -58,7 +58,8 @@ cdef class MDBase: Attributes: digest_size (int): The size of the message digest, in bytes. - block_size (int): Not implemented. + block_size (int): The internal block size of the hash + algorithm in bytes. name (bytes): The name of the message digest. """ @@ -94,7 +95,7 @@ cdef class MDBase: property block_size: """The internal block size of the hash algorithm in bytes.""" def __get__(self): - raise NotImplementedError + return self._ctx.md_info.block_size property name: """The canonical name of the hashing algorithm.""" diff --git a/mbedtls/hash.pyx b/mbedtls/hash.pyx index b5fe4c43..8163dcff 100644 --- a/mbedtls/hash.pyx +++ b/mbedtls/hash.pyx @@ -28,7 +28,8 @@ cdef class Hash(_md.MDBase): Attributes: digest_size (int): The size of the message digest, in bytes. - block_size (int): Not implemented. + block_size (int): The internal block size of the hash + algorithm in bytes. name (bytes): The name of the message digest. """ diff --git a/mbedtls/hmac.pyx b/mbedtls/hmac.pyx index 469de428..e26cc8ea 100644 --- a/mbedtls/hmac.pyx +++ b/mbedtls/hmac.pyx @@ -33,7 +33,8 @@ cdef class Hmac(_md.MDBase): Attributes: digest_size (int): The size of the message digest, in bytes. - block_size (int): Not implemented. + block_size (int): The internal block size of the hash + algorithm in bytes. name (bytes): The name of the message digest. """ diff --git a/tests/test_md.py b/tests/test_md.py index 444cda26..14042360 100644 --- a/tests/test_md.py +++ b/tests/test_md.py @@ -48,6 +48,10 @@ def test_type_accessor(algorithm): assert 0 <= algorithm._type < len(MD_NAME) +def test_block_size_accessor(algorithm): + assert algorithm.block_size in {16, 32, 64, 128, 256} + + def test_copy_hash(algorithm, randbytes): buf0 = randbytes(512) buf1 = randbytes(512) From 0e593517ae68488ab6aa5d4f6919d6234f167456 Mon Sep 17 00:00:00 2001 From: Mathias Laurin Date: Sat, 10 Mar 2018 22:01:51 +0100 Subject: [PATCH 8/9] Update conf / packaging --- .circleci/config.yml | 35 +++++++++++++++++++---------------- Makefile | 16 +++++----------- setup.py | 12 ++++++++---- tox.ini | 8 ++++---- 4 files changed, 36 insertions(+), 35 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 58cbc038..69f20e57 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -37,33 +37,33 @@ jobs: - restore_cache: keys: - - py34-3.4.7 + - py34-3.4.8 - run: - name: install python 3.4.7 + name: install python 3.4.8 command: | - if [ ! -d ".pyenv/versions/3.4.7" ]; then + if [ ! -d ".pyenv/versions/3.4.8" ]; then eval "$(pyenv init -)" - pyenv install 3.4.7 + pyenv install 3.4.8 fi - save_cache: - key: py34-3.4.7 + key: py34-3.4.8 paths: - - .pyenv/versions/3.4.7 + - .pyenv/versions/3.4.8 - restore_cache: keys: - - py35-3.5.4 + - py35-3.5.5 - run: - name: install python 3.5.4 + name: install python 3.5.5 command: | - if [ ! -d ".pyenv/versions/3.5.4" ]; then + if [ ! -d ".pyenv/versions/3.5.5" ]; then eval "$(pyenv init -)" - pyenv install 3.5.4 + pyenv install 3.5.5 fi - save_cache: - key: py35-3.5.4 + key: py35-3.5.5 paths: - - .pyenv/versions/3.5.4 + - .pyenv/versions/3.5.5 - restore_cache: keys: @@ -93,18 +93,21 @@ jobs: - run: name: install mbedtls command: | - ./install-mbedtls.sh "$VERSION" "$DESTDIR" + echo 'deb http://deb.debian.org/debian jessie-backports main' |\ + sudo tee /etc/apt/sources.list.d/backports.list + sudo apt-get update + sudo apt-get install libmbedtls-dev - run: name: install tox command: | python -m venv venv . venv/bin/activate - pip install tox tox-pyenv + pip install tox==2.9.1 tox-pyenv==1.1.0 - run: name: run tests command: | eval "$(pyenv init -)" - pyenv shell 2.7.14 3.5.4 3.4.7 3.6.4 + pyenv shell 2.7.14 3.4.8 3.5.5 3.6.4 . venv/bin/activate tox @@ -117,7 +120,7 @@ jobs: echo "password = $PYPI_PASSWORD" >> $HOME/.pypirc . venv/bin/activate python setup.py sdist - pip install twine + pip install twine==1.10.0 twine upload dist/* fi - store_artifacts: diff --git a/Makefile b/Makefile index f83616ee..3885be2d 100644 --- a/Makefile +++ b/Makefile @@ -6,24 +6,18 @@ PYX += $(wildcard mbedtls/pk/*.pyx) LIBMBEDTLS = $(HOME)/lib/mbedtls-2.4.2 -release: - cython $(PYX) - python setup.py build_ext - debug: cython -a -X linetrace=True $(PYX) CFLAGS='-DCYTHON_TRACE=1' python setup.py build_ext --inplace \ -L$(LIBMBEDTLS)/lib \ -I$(LIBMBEDTLS)/include -test: - pytest --cov mbedtls tests - html: cd docs && make html clean: - $(RM) mbedtls/*.c mbedtls/*.so mbedtls/*.pyc - $(RM) mbedtls/cipher/*.c mbedtls/cipher/*.so mbedtls/cipher/*.pyc - $(RM) mbedtls/pk/*.c mbedtls/pk/*.so mbedtls/pk/*.pyc - $(RM) -r build + $(RM) mbedtls/*.c mbedtls/*.so mbedtls/*.pyc mbedtls/*.html + $(RM) mbedtls/cipher/*.c mbedtls/cipher/*.so mbedtls/cipher/*.pyc \ + mbedtls/cipher/*.html + $(RM) mbedtls/pk/*.c mbedtls/pk/*.so mbedtls/pk/*.pyc mbedtls/pk/*.html + $(RM) -r build dist diff --git a/setup.py b/setup.py index 9c696df9..312a3169 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ import sys from setuptools import setup, Extension -version = "0.8" +version = "0.9" download_url = "https://github.com/Synss/python-mbedtls/tarball/%s" % version @@ -13,11 +13,14 @@ if ext != ".pyx": continue mod = ".".join(dirpath.split(os.sep) + [root]) - extensions.append(Extension( + extension = Extension( mod, [os.path.join(dirpath, fn)], - libraries=["mbedtls"], - )) + libraries=["mbedcrypto", "mbedtls", "mbedx509"], + include_dirs=["."], + ) + extension.cython_c_in_temp = True + extensions.append(extension) setup_requires = [ @@ -45,6 +48,7 @@ def readme(): url="https://github.com/Synss/python-mbedtls", download_url=download_url, ext_modules=extensions, + packages=["mbedtls", "mbedtls.cipher", "mbedtls.pk"], setup_requires=setup_requires, classifiers=[ "Development Status :: 4 - Beta", diff --git a/tox.ini b/tox.ini index 56ace39c..ce6832f6 100644 --- a/tox.ini +++ b/tox.ini @@ -1,11 +1,11 @@ [tox] -# skipsdist = True envlist = py27, py34, py35, py36 +skipsdist = True [testenv] deps = -rrequirements.txt py27: pathlib2 -usedevelop = true -passenv=DYLD_LIBRARY_PATH LD_LIBRARY_PATH -commands=pytest mbedtls tests +commands = + python setup.py install + pytest mbedtls tests From 4a6b2901d1f5e819ec9596ff71d51aad0f0de66e Mon Sep 17 00:00:00 2001 From: Mathias Laurin Date: Tue, 13 Mar 2018 21:57:25 +0100 Subject: [PATCH 9/9] ChangeLog: Update for 0.9 --- ChangeLog | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index bf7d4943..f0486a4a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,18 @@ -[0.8] - 2018-02-24 +[0.9] - 2018-03-13 + +API Changes + +* x509/Certificate: next() returns the next certificate in a chain. +* md: Implement block_size property. + +Misc. + +* Clean up imports. +* Fix tests and packaging. +* Change git merge policy to fast-forward. + + +[0.8 withdrawn] - 2018-02-24 Support X.509 Certificates