Handle unset notBefore and notAfter values
diff --git a/src/crypto/x509.c b/src/crypto/x509.c
index 68f34b7..ff1f3de 100644
--- a/src/crypto/x509.c
+++ b/src/crypto/x509.c
@@ -432,7 +432,10 @@
* There must be a way to do this without touching timestamp->data
* directly. -exarkun
*/
- if (timestamp->type == V_ASN1_GENERALIZEDTIME) {
+ if (timestamp->length == 0) {
+ Py_INCREF(Py_None);
+ return Py_None;
+ } else if (timestamp->type == V_ASN1_GENERALIZEDTIME) {
return PyString_FromString(timestamp->data);
} else {
ASN1_TIME_to_generalizedtime(timestamp, >_timestamp);