[pyOpenSSL] [PATCH] trusted branch: add exception for non-PEM trust output

Joe Orton jorton at redhat.com
Thu Aug 9 11:30:45 CEST 2012


Hi, this is patch against the "trusted" branch:

dump_certificate() only works with trusted certs in PEM mode; so throw 
an exception if an unsupported argument combination is used.

Regards, Joe

=== modified file 'src/crypto/crypto.c'
--- src/crypto/crypto.c	2010-07-16 15:00:32 +0000
+++ src/crypto/crypto.c	2012-08-09 09:28:28 +0000
@@ -297,6 +297,11 @@
         return NULL;
     }
 
+    if (trust && type != X509_FILETYPE_PEM) {
+        PyErr_SetString(PyExc_ValueError, "can only write trusted certs with FILETYPE_PEM");
+        return NULL;
+    }
+
     bio = BIO_new(BIO_s_mem());
     switch (type)
     {





More information about the pyopenssl-users mailing list