[Commits] (heikki) Now we can get our hands to the X509_STORE on the context and manually add certificates one by one, instead of loading from a flat file.

commits at osafoundation.org commits at osafoundation.org
Wed Apr 27 11:21:53 PDT 2005


Commit by: heikki
Modified files:
internal/m2crypto/M2Crypto/SSL/Context.py 1.2 1.3
internal/m2crypto/SWIG/_ssl.i 1.5 1.6

Log message:
Now we can get our hands to the X509_STORE on the context and manually add certificates one by one, instead of loading from a flat file.

ViewCVS links:
http://cvs.osafoundation.org/index.cgi/internal/m2crypto/M2Crypto/SSL/Context.py.diff?r1=text&tr1=1.2&r2=text&tr2=1.3
http://cvs.osafoundation.org/index.cgi/internal/m2crypto/SWIG/_ssl.i.diff?r1=text&tr1=1.5&r2=text&tr2=1.6

Index: internal/m2crypto/M2Crypto/SSL/Context.py
diff -u internal/m2crypto/M2Crypto/SSL/Context.py:1.2 internal/m2crypto/M2Crypto/SSL/Context.py:1.3
--- internal/m2crypto/M2Crypto/SSL/Context.py:1.2	Tue Mar 16 13:46:41 2004
+++ internal/m2crypto/M2Crypto/SSL/Context.py	Wed Apr 27 11:21:51 2005
@@ -6,11 +6,11 @@
 Copyright (C) 2004 OSAF. All Rights Reserved.
 """
 
-RCS_id='$Id: Context.py,v 1.2 2004/03/16 21:46:41 heikki Exp $'
+RCS_id='$Id: Context.py,v 1.3 2005/04/27 18:21:51 heikki Exp $'
 
 # M2Crypto
 import cb
-from M2Crypto import util, BIO, Err, RSA, m2
+from M2Crypto import util, BIO, Err, RSA, m2, X509
 
 class _ctxmap:
     singleton = None
@@ -205,3 +205,13 @@
 
     def set_options(self, op):
         return m2.ssl_ctx_set_options(self.ctx, op)
+
+    def get_cert_store(self):
+        """
+        Get the certificate store associated with this context.
+        """
+        # XXX This is tricky: ssl_ctx_get_cert_store() returns just a pointer
+        # XXX without increasing reference counts or anything. So
+        # XXX if the store now goes away, the value we returned will be
+        # XXX bogus. Dunno if we can do anything about this.
+        return X509.X509_Store(m2.ssl_ctx_get_cert_store(self.ctx))

Index: internal/m2crypto/SWIG/_ssl.i
diff -u internal/m2crypto/SWIG/_ssl.i:1.5 internal/m2crypto/SWIG/_ssl.i:1.6
--- internal/m2crypto/SWIG/_ssl.i:1.5	Fri Dec  3 20:53:48 2004
+++ internal/m2crypto/SWIG/_ssl.i	Wed Apr 27 11:21:51 2005
@@ -3,7 +3,7 @@
 ** Portions created by Open Source Applications Foundation (OSAF) are
 ** Copyright (C) 2004 OSAF. All Rights Reserved.
 */
-/* $Id: _ssl.i,v 1.5 2004/12/04 04:53:48 heikki Exp $ */
+/* $Id: _ssl.i,v 1.6 2005/04/27 18:21:51 heikki Exp $ */
 
 %{
 #include <pythread.h>
@@ -45,6 +45,7 @@
 %name(ssl_ctx_remove_session) extern int SSL_CTX_remove_session(SSL_CTX *, SSL_SESSION *);
 %name(ssl_ctx_set_session_timeout) extern long SSL_CTX_set_timeout(SSL_CTX *, long);
 %name(ssl_ctx_get_session_timeout) extern long SSL_CTX_get_timeout(SSL_CTX *);
+%name(ssl_ctx_get_cert_store) extern X509_STORE *SSL_CTX_get_cert_store(SSL_CTX *);
 
 %name(bio_new_ssl) extern BIO *BIO_new_ssl(SSL_CTX *, int);
 
@@ -169,6 +170,7 @@
     return i;
 }
 
+
 int ssl_ctx_use_privkey(SSL_CTX *ctx, char *file) {
     int i;
     



More information about the Commits mailing list