Hi,

I’m having to get some ssl code to work. Since I’ve never done any SSL programming I started with the page that Alan Kennedy started/wrote on the wiki at http://wiki.python.org/jython/NewSocketModule and read some old ML message with nabble like http://www.nabble.com/Re%3A-SSL-support-p8995253.html

 

So using jython 2.2 I tried the code that was said to work at http://docs.python.org/lib/socket-example.html however I was less then successful.

 

with a 1.4.2 JVM this is what I got:

Jython Completion Shell

Jython 2.2 on java1.4.2_07

>>> import socket

>>> s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

>>> s.connect(('localhost', 443))

>>> ssl_sock = socket.ssl(s)

Traceback (most recent call last):

  File "<input>", line 1, in ?

  File "C:\jython2.2\Lib\socket.py", line 850, in __init__

    self.ssl_sock = self.make_ssl_socket(plain_sock)

  File "C:\jython2.2\Lib\socket.py", line 860, in make_ssl_socket

    ssl_socket.startHandshake()

javax.net.ssl.SSLHandshakeException: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: No trusted certificate found

 

with a 1.5 JVM using the same code above; I got a similar message:

Traceback (most recent call last):

  File "<input>", line 1, in ?

  File "C:\jython2.2\Lib\socket.py", line 850, in __init__

    self.ssl_sock = self.make_ssl_socket(plain_sock)

  File "C:\jython2.2\Lib\socket.py", line 860, in make_ssl_socket

    ssl_socket.startHandshake()

javax.net.ssl.SSLHandshakeException: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

 

For the purposes of what I’m doing I don’t really want (or even need) to deal with certificates. I just need to post some xml to an internal server however I might need to add proxy support but I don’t think so.  In case your wondering the localhost referenced above is a xampp apache server.

 

Any suggestions? is there something I need to setup ahead of time. jython/ python would be an easier solution but should I go with using the java classes. As I mentioned I’m new to SSL programming so any help is greatly appreciated so socket to me. (sorry couldn’t resist the pun)

 

Thanks in advance.

Greg.


This message and any attachments are intended only for the use of the addressee and may contain information that is privileged and confidential. If the reader of the message is not the intended recipient or an authorized representative of the intended recipient, you are hereby notified that any dissemination of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail and delete the message and any attachments from your system.