convert PKCS12 to more modern type.
diff --git a/src/crypto/crypto.c b/src/crypto/crypto.c
index 4a25eae..decf722 100644
--- a/src/crypto/crypto.c
+++ b/src/crypto/crypto.c
@@ -515,23 +515,6 @@
 }
 
 
-static char crypto_PKCS12_doc[] = "\n\
-The factory function inserted in the module dictionary to create PKCS12\n\
-objects\n\
-\n\
-Arguments: spam - Always NULL\n\
-           args - The Python argument tuple, should be empty\n\
-Returns:   The PKCS12 object\n\
-";
-
-static crypto_PKCS12Obj *
-crypto_PKCS12(PyObject *spam, PyObject *args)
-{
-    if (!PyArg_ParseTuple(args, ":PKCS12"))
-        return NULL;
-    return crypto_PKCS12_New(NULL, NULL);
-}
-
 static char crypto_X509_verify_cert_error_string_doc[] = "\n\
 Get X509 verify certificate error string.\n\
 \n\
@@ -576,7 +559,6 @@
     { "load_pkcs12", (PyCFunction)crypto_load_pkcs12, METH_VARARGS, crypto_load_pkcs12_doc },
     { "X509_verify_cert_error_string", (PyCFunction)crypto_X509_verify_cert_error_string, METH_VARARGS, crypto_X509_verify_cert_error_string_doc },
     { "_exception_from_error_queue", (PyCFunction)crypto_exception_from_error_queue, METH_NOARGS, crypto_exception_from_error_queue_doc },
-    { "PKCS12",    (PyCFunction)crypto_PKCS12, METH_VARARGS|METH_VARARGS, crypto_PKCS12_doc },
     { NULL, NULL }
 };
 
diff --git a/src/crypto/pkcs12.c b/src/crypto/pkcs12.c
index de844d9..c5c84b5 100644
--- a/src/crypto/pkcs12.c
+++ b/src/crypto/pkcs12.c
@@ -349,6 +349,23 @@
     return NULL;
 }
 
+static char crypto_PKCS12_doc[] = "\n\
+PKCS12() -> PKCS12 instance\n\
+\n\
+Create a new PKCS12 object.\n\
+\n\
+@returns: The PKCS12 object\n\
+";
+static PyObject *
+crypto_PKCS12_new(PyTypeObject *subtype, PyObject *args, PyObject *kwargs)
+{
+    if (!PyArg_ParseTuple(args, ":PKCS12")) {
+        return NULL;
+    }
+
+    return (PyObject *)crypto_PKCS12_New(NULL, NULL);
+}
+
 /*
  * Find attribute
  *
@@ -440,9 +457,24 @@
     NULL, /* setattro */
     NULL, /* as_buffer */
     Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
-    NULL, /* doc */
+    crypto_PKCS12_doc, 
     (traverseproc)crypto_PKCS12_traverse,
     (inquiry)crypto_PKCS12_clear,
+    NULL, /* tp_richcompare */
+    0, /* tp_weaklistoffset */
+    NULL, /* tp_iter */
+    NULL, /* tp_iternext */
+    crypto_PKCS12_methods, /* tp_methods */
+    NULL, /* tp_members */
+    NULL, /* tp_getset */
+    NULL, /* tp_base */
+    NULL, /* tp_dict */
+    NULL, /* tp_descr_get */
+    NULL, /* tp_descr_set */
+    0, /* tp_dictoffset */
+    NULL, /* tp_init */
+    NULL, /* tp_alloc */
+    crypto_PKCS12_new, /* tp_new */
 };
 
 /*
@@ -457,6 +489,10 @@
         return 0;
     }
 
+    if (PyModule_AddObject(module, "PKCS12", (PyObject *)&crypto_PKCS12_Type) != 0) {
+        return 0;
+    }
+
     if (PyModule_AddObject(module, "PKCS12Type", (PyObject *)&crypto_PKCS12_Type) != 0) {
         return 0;
     }