Update tests to pass bytes to the {set,get}_not{Before,After} APIs; adjust the argument parser for the implementation of these APIs to accept only bytes on Py 3.x
diff --git a/OpenSSL/crypto/x509.c b/OpenSSL/crypto/x509.c
index 1dc6506..d5f5946 100644
--- a/OpenSSL/crypto/x509.c
+++ b/OpenSSL/crypto/x509.c
@@ -365,11 +365,17 @@
@return: None\n\
";
+#ifdef PY3
+#define FMT(name) ("y" name)
+#else
+#define FMT(name) ("s" name)
+#endif
+
static PyObject*
crypto_X509_set_notBefore(crypto_X509Obj *self, PyObject *args)
{
return _set_asn1_time(
- "s:set_notBefore", X509_get_notBefore(self->x509), args);
+ FMT(":set_notBefore"), X509_get_notBefore(self->x509), args);
}
static char crypto_X509_set_notAfter_doc[] = "\n\
@@ -388,9 +394,11 @@
crypto_X509_set_notAfter(crypto_X509Obj *self, PyObject *args)
{
return _set_asn1_time(
- "s:set_notAfter", X509_get_notAfter(self->x509), args);
+ FMT(":set_notAfter"), X509_get_notAfter(self->x509), args);
}
+#undef FMT
+
PyObject*
_get_asn1_time(char *format, ASN1_TIME* timestamp, PyObject *args)
{