aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cryptography/bindings/openssl/api.py7
-rw-r--r--tests/bindings/test_openssl.py7
2 files changed, 12 insertions, 2 deletions
diff --git a/cryptography/bindings/openssl/api.py b/cryptography/bindings/openssl/api.py
index 87ed38fa..2c8fae3d 100644
--- a/cryptography/bindings/openssl/api.py
+++ b/cryptography/bindings/openssl/api.py
@@ -55,9 +55,12 @@ class API(object):
int EVP_CIPHER_block_size(const EVP_CIPHER *);
""")
- """ Friendly string name of linked OpenSSL. """
def openssl_version_text(self):
- return self._ffi.string(api._lib.OPENSSL_VERSION_TEXT)
+ """ Friendly string name of linked OpenSSL.
+
+ Example: OpenSSL 1.0.1e Feb 11, 2013
+ """
+ return self._ffi.string(api._lib.OPENSSL_VERSION_TEXT).decode("ascii")
def create_block_cipher_context(self, cipher, mode):
ctx = self._ffi.new("EVP_CIPHER_CTX *")
diff --git a/tests/bindings/test_openssl.py b/tests/bindings/test_openssl.py
index 8704d933..db71e328 100644
--- a/tests/bindings/test_openssl.py
+++ b/tests/bindings/test_openssl.py
@@ -19,4 +19,11 @@ class TestOpenSSL(object):
assert api
def test_openssl_version_text(self):
+ """ This test checks the value of OPENSSL_VERSION_TEXT.
+
+ Unfortunately, this define does not appear to have a
+ formal content definition, so for now we'll test to see
+ if it starts with OpenSSL as that appears to be true
+ for every OpenSSL.
+ """
assert api.openssl_version_text().find("OpenSSL") == 0