diff -ru ../pyOpenSSL-0.7.orig/src/crypto/crypto.c ./src/crypto/crypto.c
--- ../pyOpenSSL-0.7.orig/src/crypto/crypto.c	2008-03-21 23:34:42.000000000 +0100
+++ ./src/crypto/crypto.c	2008-08-18 17:30:48.000000000 +0200
@@ -425,6 +425,51 @@
     return buffer;
 }
 
+static char crypto_dump_pkcs12_doc[] = "\n\
+Dump a private key to a buffer\n\
+\n\
+Arguments: spam - Always NULL\n\
+           args - The Python argument tuple, should be:\n\
+             p12 - The pkcs12 object to dump\n\
+             passphrase - \n\
+\             
+Returns:   The buffer with the dumped pkcs12 in\n\
+";
+
+static PyObject *
+crypto_dump_pkcs12(PyObject *spam, PyObject *args)
+{
+    int type, ret, buf_len;
+    char *temp;
+    BIO *bio;
+    PyObject *buffer;
+    crypto_PKCS12Obj *p12;
+    PKCS12 *p12_data;
+    crypto_PKeyObj *key;
+    crypto_X509Obj *cert;
+    char *pass;
+
+    if (!PyArg_ParseTuple(args, "O!s:dump_pkcs12",
+			  &crypto_PKCS12_Type, &p12, &pass))
+        return NULL;
+    key = (crypto_PKeyObj *)p12->key;
+    cert = (crypto_X509Obj *)p12->cert;
+    p12_data = PKCS12_create(pass, 0, key->pkey, cert->x509, 0, 0, 0, 0, 0, 0);
+    bio = BIO_new(BIO_s_mem());
+    ret = i2d_PKCS12_bio(bio, p12_data);
+    if (ret == 0)
+	    {
+		    BIO_free(bio);
+		    exception_from_error_queue();
+		    return NULL;
+	    }
+    buf_len = BIO_get_mem_data(bio, &temp);
+    buffer = PyString_FromStringAndSize(temp, buf_len);
+    PKCS12_free(p12_data);
+    BIO_free(bio);
+    return buffer;
+}
+
 static char crypto_load_pkcs7_data_doc[] = "\n\
 Load pkcs7 data from a buffer\n\
 \n\
@@ -532,6 +577,29 @@
     return (PyObject *)crypto_X509_New(X509_new(), 1);
 }
 
+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 PyObject *
+crypto_PKCS12(PyObject *spam, PyObject *args)
+{
+	crypto_PKCS12Obj *self;
+	
+	if (!PyArg_ParseTuple(args, ":PKCS12"))
+		return NULL;
+
+	if (!(self = PyObject_GC_New(crypto_PKCS12Obj, &crypto_PKCS12_Type)))
+		return NULL;
+
+	return (PyObject *)self;
+}
+
 static char crypto_X509Name_doc[] = "\n\
 The factory function inserted in the module dictionary as a copy\n\
 constructor for X509Name objects.\n\
@@ -683,8 +751,10 @@
     { "dump_certificate_request", (PyCFunction)crypto_dump_certificate_request, METH_VARARGS, crypto_dump_certificate_request_doc },
     { "load_pkcs7_data", (PyCFunction)crypto_load_pkcs7_data, METH_VARARGS, crypto_load_pkcs7_data_doc },
     { "load_pkcs12", (PyCFunction)crypto_load_pkcs12, METH_VARARGS, crypto_load_pkcs12_doc },
+    { "dump_pkcs12", (PyCFunction)crypto_dump_pkcs12, METH_VARARGS, crypto_dump_pkcs12_doc },
     /* Factory functions */
     { "X509",    (PyCFunction)crypto_X509,    METH_VARARGS, crypto_X509_doc },
+    { "PKCS12",    (PyCFunction)crypto_PKCS12,    METH_VARARGS, crypto_PKCS12_doc },
     { "X509Name",(PyCFunction)crypto_X509Name,METH_VARARGS, crypto_X509Name_doc },
     { "X509Req", (PyCFunction)crypto_X509Req, METH_VARARGS, crypto_X509Req_doc },
     { "PKey",    (PyCFunction)crypto_PKey,    METH_VARARGS, crypto_PKey_doc },
@@ -715,6 +785,7 @@
 
     /* Initialize the C API pointer array */
     crypto_API[crypto_X509_New_NUM]      = (void *)crypto_X509_New;
+    crypto_API[crypto_PKCS12_New_NUM]      = (void *)crypto_PKCS12_New;
     crypto_API[crypto_X509Name_New_NUM]  = (void *)crypto_X509Name_New;
     crypto_API[crypto_X509Req_New_NUM]   = (void *)crypto_X509Req_New;
     crypto_API[crypto_X509Store_New_NUM] = (void *)crypto_X509Store_New;
Seulement dans ./src/crypto: crypto.c.orig
diff -ru ../pyOpenSSL-0.7.orig/src/crypto/crypto.h ./src/crypto/crypto.h
--- ../pyOpenSSL-0.7.orig/src/crypto/crypto.h	2008-03-03 21:16:06.000000000 +0100
+++ ./src/crypto/crypto.h	2008-08-18 16:31:19.000000000 +0200
@@ -70,6 +70,10 @@
 
 #define crypto_API_pointers             8
 
+#define crypto_PKCS12_New_NUM            9
+#define crypto_PKCS12_New_RETURN         crypto_PKCS12Obj *
+#define crypto_PKCS12_New_PROTO          (PKCS12 *, char *)
+
 #ifdef crypto_MODULE
 
 extern crypto_X509_New_RETURN      crypto_X509_New      crypto_X509_New_PROTO;
@@ -79,6 +83,7 @@
 extern crypto_PKey_New_RETURN      crypto_PKey_New      crypto_PKey_New_PROTO;
 extern crypto_X509Extension_New_RETURN crypto_X509Extension_New crypto_X509Extension_New_PROTO;
 extern crypto_PKCS7_New_RETURN     crypto_PKCS7_New     crypto_PKCS7_New_PROTO;
+extern crypto_PKCS12_New_RETURN     crypto_PKCS12_New     crypto_PKCS12_New_PROTO;
 extern crypto_NetscapeSPKI_New_RETURN  crypto_NetscapeSPKI_New  crypto_NetscapeSPKI_New_PROTO;
 
 #else /* crypto_MODULE */
@@ -99,6 +104,8 @@
  (*(crypto_X509Extension_New_RETURN (*)crypto_X509Extension_New_PROTO) crypto_API[crypto_X509Extension_New_NUM])
 #define crypto_PKCS7_New        \
  (*(crypto_PKCS7_New_RETURN (*)crypto_PKCS7_New_PROTO) crypto_API[crypto_PKCS7_New_NUM])
+#define crypto_PKCS12_New        \
+ (*(crypto_PKCS12_New_RETURN (*)crypto_PKCS12_New_PROTO) crypto_API[crypto_PKCS12_New_NUM])
 #define crypto_NetscapeSPKI_New     \
  (*(crypto_NetscapeSPKI_New_RETURN (*)crypto_NetscapeSPKI_New_PROTO) crypto_API[crypto_NetscapeSPKI_New_NUM])
 
diff -ru ../pyOpenSSL-0.7.orig/src/crypto/pkcs12.c ./src/crypto/pkcs12.c
--- ../pyOpenSSL-0.7.orig/src/crypto/pkcs12.c	2008-03-03 21:16:06.000000000 +0100
+++ ./src/crypto/pkcs12.c	2008-08-18 17:23:49.000000000 +0200
@@ -57,6 +57,54 @@
     return self->key;
 }
 
+static char crypto_PKCS12_set_certificate_doc[] = "\n\
+Set the certificate (with public key) to include into PKCS12\n\
+\n\
+Arguments: self - The PKCS12 object\n\
+           args - The Python argument tuple, should be:\n\
+             cert - The certificate\n\
+Returns:   None\n\
+";
+
+static PyObject *
+crypto_PKCS12_set_certificate(crypto_PKCS12Obj *self, PyObject *args)
+{
+    crypto_X509Obj *cert;
+
+    if (!PyArg_ParseTuple(args, "O!:set_certificate", &crypto_X509_Type, &cert))
+        return NULL;
+
+    self->cert = (PyObject *)cert;
+    Py_INCREF(cert);
+    Py_INCREF(Py_None);
+    return Py_None;
+}
+
+static char crypto_PKCS12_set_privatekey_doc[] = "\n\
+Set the private key to include into PKCS12\n\
+\n\
+Arguments: self - The PKCS12 object\n\
+           args - The Python argument tuple, should be:\n\
+             pkey - The private key\n\
+Returns:   None\n\
+";
+
+static PyObject *
+crypto_PKCS12_set_privatekey(crypto_PKCS12Obj *self, PyObject *args)
+{
+    crypto_PKeyObj *pkey;
+
+    if (!PyArg_ParseTuple(args, "O!:set_privatekey", &crypto_PKey_Type, &pkey))
+        return NULL;
+
+    self->key = (PyObject *)pkey;
+    Py_INCREF(Py_None);
+    Py_INCREF(pkey);
+    return Py_None;
+}
+
+
+
 static char crypto_PKCS12_get_ca_certificates_doc[] = "\n\
 Return CA certificates within of the PKCS12 object\n\
 \n\
@@ -85,7 +133,9 @@
 static PyMethodDef crypto_PKCS12_methods[] =
 {
     ADD_METHOD(get_certificate),
+    ADD_METHOD(set_certificate),
     ADD_METHOD(get_privatekey),
+    ADD_METHOD(set_privatekey),
     ADD_METHOD(get_ca_certificates),
     { NULL, NULL }
 };
