From abra9823 at mail.usyd.edu.au Fri Sep 24 07:24:47 2004 From: abra9823 at mail.usyd.edu.au (Ajay) Date: Fri, 24 Sep 2004 15:24:47 +1000 Subject: [pyOpenSSL] building PyOpenSSL Message-ID: <1096003487.4153af9f94e87@www-mail.usyd.edu.au> hi! i am wondering if anyone has used pyopenssl on a pocket pc. I have built openSSL for pocket pc (a few dll's) and it passed all the tests. To build pyopenssl, do i need openssl source or can i just use the dll's. thanks cheers ---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program. From msjogren at gmail.com Fri Sep 24 08:25:51 2004 From: msjogren at gmail.com (=?ISO-8859-1?Q?Martin_Sj=F6gren?=) Date: Fri, 24 Sep 2004 08:25:51 +0200 Subject: [pyOpenSSL] building PyOpenSSL In-Reply-To: <1096003487.4153af9f94e87@www-mail.usyd.edu.au> References: <1096003487.4153af9f94e87@www-mail.usyd.edu.au> Message-ID: <1e1bb1f004092323253806d6af@mail.gmail.com> On Fri, 24 Sep 2004 15:24:47 +1000, Ajay wrote: > i am wondering if anyone has used pyopenssl on a pocket pc. I have built > openSSL for pocket pc (a few dll's) and it passed all the tests. > To build pyopenssl, do i need openssl source or can i just use the dll's. > thanks Well, you need the OpenSSL header files, of course, but other than that, just the dlls. If you need to hack setup.py to get it to compile, please send me a patch and include the values of sys.platform and os.name so I know what to test for. /Martin From abra9823 at mail.usyd.edu.au Mon Sep 27 16:22:52 2004 From: abra9823 at mail.usyd.edu.au (Ajay) Date: Tue, 28 Sep 2004 00:22:52 +1000 Subject: [pyOpenSSL] building for winCE Message-ID: <1096294972.4158223cbe2f2@www-mail.usyd.edu.au> hi! i built PyOpenSSL for WinCE, but when i was getting an error on import. thinking that perhaps the way i went about doing it wasn't correct (i didn't use setup.py since i dont have enough knowhow about hacking it to make it work on WinCE, i simply combined all the C code and compiled it into a DLL). I then tried writing a simple C file that makes a few calls to the OpenSSL API. the code is below. this builds fine, but again when i do >>>import testssl i get ImportError: DLL load failed. The specified module could not be found. i am hoping people on this list, hopefully the developers of PyOpenSSL (who have written code like the one below), could shed some light on what it is thats wrong with my piece of code. thanks #include #include "openssl/bio.h" #include "openssl/ssl.h" #include "openssl/err.h" static PyObject * start(PyObject *self, PyObject *args) { int x; BIO * bio; char buf[1024]; int len = 512; SSL_load_error_strings(); ERR_load_BIO_strings(); OpenSSL_add_all_algorithms(); bio = BIO_new_connect("www.ibm.com:80"); if(bio==NULL) { //handle error x = -5; } if(BIO_do_connect(bio) <= 0) { //handle failed connection x = -4; } x = BIO_read(bio, buf, len); if(x == 0) { //handle closed connection x = -3; } else if(x<0) { if(! BIO_should_retry(bio)) { //handle failed read x = -2; } //do something to handle the retry } return Py_BuildValue("i", x); } static PyMethodDef testSSLMethods[] = { {"start", start, METH_VARARGS, "start and test SSL."}, {NULL, NULL, 0, NULL} }; PyMODINIT_FUNC inittestSSL(void) { (void) Py_InitModule("testSSL", testSSLMethods); } ---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program. From abra9823 at mail.usyd.edu.au Tue Sep 28 13:42:48 2004 From: abra9823 at mail.usyd.edu.au (Ajay) Date: Tue, 28 Sep 2004 21:42:48 +1000 Subject: [pyOpenSSL] importing pyopenssl Message-ID: <1096371768.41594e383bedc@www-mail.usyd.edu.au> hi! i correctly installed PyOpenSSL. however when i try >>> import OpenSSL Traceback (most recent call last): File "", line 1, in ? File "/local/usr/lib/python2.3/site-packages/OpenSSL/__init__.py", line 11, in ? import rand, crypto, SSL, tsafe ImportError: No module named rand how do i go about using the modules? thanks cheers ---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program. From msjogren at gmail.com Tue Sep 28 14:05:28 2004 From: msjogren at gmail.com (=?ISO-8859-1?Q?Martin_Sj=F6gren?=) Date: Tue, 28 Sep 2004 14:05:28 +0200 Subject: [pyOpenSSL] importing pyopenssl In-Reply-To: <1096371768.41594e383bedc@www-mail.usyd.edu.au> References: <1096371768.41594e383bedc@www-mail.usyd.edu.au> Message-ID: <1e1bb1f004092805051dce4689@mail.gmail.com> On Tue, 28 Sep 2004 21:42:48 +1000, Ajay wrote: > hi! > > i correctly installed PyOpenSSL. however when i try > >>> import OpenSSL > Traceback (most recent call last): > File "", line 1, in ? > File "/local/usr/lib/python2.3/site-packages/OpenSSL/__init__.py", line > 11, in > ? > import rand, crypto, SSL, tsafe > ImportError: No module named rand > > how do i go about using the modules? Well, if you get this kind of import error I highly doubt that you've got a fully working build. When you build pyopenssl (python setup.py build) you should end up with the following files in build/lib.something/OpenSSL: __init__.py, version.py, tsafe.py, rand.so, crypto.so, SSL.so. "import OpenSSL" or "from OpenSSL import crypto, SSL" or what have you *is* the right way to import the modules. If that doesn't work, something's wrong. /Martin From abra9823 at mail.usyd.edu.au Tue Sep 28 14:24:04 2004 From: abra9823 at mail.usyd.edu.au (Ajay) Date: Tue, 28 Sep 2004 22:24:04 +1000 Subject: [pyOpenSSL] importing pyopenssl In-Reply-To: <1e1bb1f004092805051dce4689@mail.gmail.com> References: <1096371768.41594e383bedc@www-mail.usyd.edu.au> <1e1bb1f004092805051dce4689@mail.gmail.com> Message-ID: <1096374244.415957e47287e@www-mail.usyd.edu.au> -- Ajay Brar, CS Honours 2004 Smart Internet Technology Research Group Quoting Martin Sj?gren : > On Tue, 28 Sep 2004 21:42:48 +1000, Ajay > wrote: > > hi! > > > > i correctly installed PyOpenSSL. however when i try > > >>> import OpenSSL > > Traceback (most recent call last): > > File "", line 1, in ? > > File "/local/usr/lib/python2.3/site-packages/OpenSSL/__init__.py", > line > > 11, in > > ? > > import rand, crypto, SSL, tsafe > > ImportError: No module named rand > > > > how do i go about using the modules? > > Well, if you get this kind of import error I highly doubt that you've > got a fully working build. When you build pyopenssl (python setup.py > build) you should end up with the following files in > build/lib.something/OpenSSL: __init__.py, version.py, tsafe.py, > rand.so, crypto.so, SSL.so. > > "import OpenSSL" or "from OpenSSL import crypto, SSL" or what have you > *is* the right way to import the modules. If that doesn't work, > something's wrong. > i thought you could only import Python .py or .pyd files. i am quite sure my build went okay. those are the files that i have. the system admin on my server has already built PyOpenSSL. i tried import then but that threw the same error. So i built again to my home directory, added that to the path and tried import from there. that gave the same error. buiild and install didn't throw any errors or warnings at all. i am running this on a solaris. > > /Martin > ---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program. From abra9823 at mail.usyd.edu.au Tue Sep 28 15:31:24 2004 From: abra9823 at mail.usyd.edu.au (Ajay) Date: Tue, 28 Sep 2004 23:31:24 +1000 Subject: [pyOpenSSL] importing pyopenssl In-Reply-To: <1096374244.415957e47287e@www-mail.usyd.edu.au> References: <1096371768.41594e383bedc@www-mail.usyd.edu.au> <1e1bb1f004092805051dce4689@mail.gmail.com> <1096374244.415957e47287e@www-mail.usyd.edu.au> Message-ID: <1096378284.415967ac9560f@www-mail.usyd.edu.au> > > -- > Ajay Brar, > CS Honours 2004 > Smart Internet Technology Research Group > > > Quoting Martin Sj?gren : > > > On Tue, 28 Sep 2004 21:42:48 +1000, Ajay > > wrote: > > > hi! > > > > > > i correctly installed PyOpenSSL. however when i try > > > >>> import OpenSSL > > > Traceback (most recent call last): > > > File "", line 1, in ? > > > File "/local/usr/lib/python2.3/site-packages/OpenSSL/__init__.py", > > line > > > 11, in > > > ? > > > import rand, crypto, SSL, tsafe > > > ImportError: No module named rand > > > > > > how do i go about using the modules? > > > > Well, if you get this kind of import error I highly doubt that you've > > got a fully working build. When you build pyopenssl (python setup.py > > build) you should end up with the following files in > > build/lib.something/OpenSSL: __init__.py, version.py, tsafe.py, > > rand.so, crypto.so, SSL.so. > > > > "import OpenSSL" or "from OpenSSL import crypto, SSL" or what have you > > *is* the right way to import the modules. If that doesn't work, > > something's wrong. > > import now works. it was a faulty build. but now from OpenSSL import SSL doesn't work. it throws the error >>> from OpenSSL import SSL Traceback (most recent call last): File "", line 1, in ? ImportError: ld.so.1: python: fatal: relocation error: file OpenSSL/SSL.so: symbol SSL_renegotiate_pending: referenced symbol not found while >>> import OpenSSL Traceback (most recent call last): File "", line 1, in ? File "/usr/hons2004/abrar1/lib/python/OpenSSL/__init__.py", line 11, in ? import rand, crypto, SSL, tsafe ImportError: ld.so.1: python: fatal: relocation error: file OpenSSL/crypto.so: symbol OPENSSL_add_all_algorithms_noconf: referenced symbol not found any ideas what may be wrong here? thanks cheers > > > > > > > /Martin > > > > > ---------------------------------------------------------------- > This message was sent using IMP, the Internet Messaging Program. > > > ------------------------------------------------------- > This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 > Project Admins to receive an Apple iPod Mini FREE for your judgement on > who ports your project to Linux PPC the best. Sponsored by IBM. > Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php > _______________________________________________ > pyopenssl-list mailing list > pyopenssl-list at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/pyopenssl-list > > ---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program. From abra9823 at mail.usyd.edu.au Wed Sep 29 09:16:57 2004 From: abra9823 at mail.usyd.edu.au (Ajay) Date: Wed, 29 Sep 2004 17:16:57 +1000 Subject: [pyOpenSSL] PyopenSSL examples Message-ID: <1096442217.415a616973544@www-mail.usyd.edu.au> hi! any chances of having examples of using PyOpenSSL? cheers ---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program. From abra9823 at mail.usyd.edu.au Wed Sep 29 10:03:44 2004 From: abra9823 at mail.usyd.edu.au (Ajay) Date: Wed, 29 Sep 2004 18:03:44 +1000 Subject: [pyOpenSSL] error creating SSL connection Message-ID: <1096445024.415a6c6080156@www-mail.usyd.edu.au> hi! i am trying to setup a simple SSL connection without any authentication whatsoever. the scripts for client and server are below. running client gives the error Traceback (most recent call last): File "ssl_client.py", line 28, in ? run_client() File "ssl_client.py", line 20, in run_client conn.send("ajay rules the world") OpenSSL.SSL.Error: [('SSL routines', 'SSL3_READ_BYTES', 'sslv3 alert handshake f ailure'), ('SSL routines', 'SSL3_WRITE_BYTES', 'ssl handshake failure')] running server gives Traceback (most recent call last): File "ssl_server.py", line 35, in ? run_server() File "ssl_server.py", line 29, in run_server str = sock.recv(1024) OpenSSL.SSL.Error: [('SSL routines', 'SSL3_GET_CLIENT_HELLO', 'no shared cipher )] and i cant figure out where the error is thanks #ssl_server.py import sys from OpenSSL.SSL import * import socket import signal SERVICE_PORT=6790 SERVICE_HOST="blade1" def handleintr(sig, frame): sys.exit(0) signal.signal(signal.SIGINT, handleintr) def run_server(): context = Context(SSLv3_METHOD) context.set_cipher_list("SSLv3") context.set_verify(VERIFY_NONE, authenticateClient) serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) addr = (SERVICE_HOST, SERVICE_PORT) conn = Connection(context, serversocket) conn.set_accept_state() conn.bind(addr) conn.listen(5) print "listening" while 1: print "waiting to receive" (sock, address) = conn.accept() str = sock.recv(1024) print str def authenticateClient(conn, x509, a, b, c): return 1 run_server() #ssl_client.py import sys from OpenSSL.SSL import * import socket SERVICE_PORT=6790 SERVICE_HOST="blade1" def run_client(): context = Context(SSLv3_METHOD) context.set_cipher_list("SSLv3") context.set_verify(VERIFY_NONE, authenticateServer) sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) addr = (SERVICE_HOST, SERVICE_PORT) conn = Connection(context, sock) conn.set_connect_state() conn.connect(addr) print "connected" conn.send("ajay rules the world") conn.close() def authenticateServer(conn, x509, a, b, c): print a,b,c print "called callback" return 1 run_client() ---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program. From abra9823 at mail.usyd.edu.au Wed Sep 29 11:35:07 2004 From: abra9823 at mail.usyd.edu.au (Ajay) Date: Wed, 29 Sep 2004 19:35:07 +1000 Subject: [pyOpenSSL] building and an error Message-ID: <1096450507.415a81cb3ceb9@www-mail.usyd.edu.au> hi! i have built PyOpenSSL for WinCE using eVC++, trouble is import doesn't work. what i have done is, instead of hacking around distutils, i have simply added all source and header files to a evc project and built them (building all crypto to crypto.pyd and so on). the trouble is import crypto throws an error saying initcrypto not defined. i have checked the source and initcrypto is defined...i build PyOpenSSL in the same way on a PC using VC++ 6.0 and that works okay so i dont know where the error is coming from. i am using the client.py and server.py in 'examples/simple' (i found the examples :)) and would like no authentication at all. just an encrypted exchange. But when do ctx.set_verify(VERIFY_NONE, verify_cb) on both the client and server end, the server does not call verify_cb (as expected) but the client makes the call and whats more it calls twice ( i have a print statement in there). how can i have no server authentication and where is the extra call (shouldn't it be called only once) thanks cheers ---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program. From dave at immunitysec.com Wed Sep 29 14:47:55 2004 From: dave at immunitysec.com (dave) Date: Wed, 29 Sep 2004 08:47:55 -0400 Subject: [pyOpenSSL] PyopenSSL examples In-Reply-To: <1096442217.415a616973544@www-mail.usyd.edu.au> References: <1096442217.415a616973544@www-mail.usyd.edu.au> Message-ID: <415AAEFB.5000105@immunitysec.com> SPIKE Proxy uses it - you can download it from www.immunitysec.com . -dave Ajay wrote: >hi! > >any chances of having examples of using PyOpenSSL? > >cheers > >---------------------------------------------------------------- >This message was sent using IMP, the Internet Messaging Program. > > >------------------------------------------------------- >This SF.net email is sponsored by: IT Product Guide on ITManagersJournal >Use IT products in your business? Tell us what you think of them. Give us >Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more >http://productguide.itmanagersjournal.com/guidepromo.tmpl >_______________________________________________ >pyopenssl-list mailing list >pyopenssl-list at lists.sourceforge.net >https://lists.sourceforge.net/lists/listinfo/pyopenssl-list > > From abra9823 at mail.usyd.edu.au Thu Sep 30 06:14:20 2004 From: abra9823 at mail.usyd.edu.au (Ajay) Date: Thu, 30 Sep 2004 14:14:20 +1000 Subject: [pyOpenSSL] rand and seeding the PRNG Message-ID: <1096517660.415b881c72dfa@www-mail.usyd.edu.au> hi! i cant do a handshake using OpenSSL on a pocket pc. it throws up an error saying PRNG not seeded(and it doesnt seed from the .rnd file since there is no concept of a C:\ on the pocket pc and no environment variables either) If i get PyOpenSSL working on the PDA would it be possible for me to use the rand interface to seed the PRNG and the use that to do the SSL handshake. Will that work? i'm really short on time and so dont want to try something that may not work. thanks cheers ---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program. From abra9823 at mail.usyd.edu.au Thu Sep 30 07:42:25 2004 From: abra9823 at mail.usyd.edu.au (Ajay) Date: Thu, 30 Sep 2004 15:42:25 +1000 Subject: [pyOpenSSL] build for WinCE Message-ID: <1096522945.415b9cc1d66c0@www-mail.usyd.edu.au> hi! i have built PyOpenSSL for WinCE. I didn't use the setup.py to build it, used Embedded Visual C++ 3.0. If you'd like i can submit the binaries along with a quick HOWTO for anyone who wants to build from source. let me know if you want that. cheers ---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program.