473,387 Members | 1,582 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

unknown protocol error when connecting to an server via ssl


Hi *,

I have just started to learn python and I am having a problem with
an python client connecting to a perl server using ssl (I tried this
with pyOpenSSL and with the build in SSL Module).

I don't want to check a cerificate, so i simply tried a

from OpenSSL import SSL

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("127.0.0.1", 2000)

s.sendall("100 Hello\n")

ctx = SSL.Context(SSL.SSLv23_METHOD)
ctx.set_verify(SSL_VERIFY_NONE,self.verify_cb)
ss = SSL.Connection(ctx,s)
ss.set_connect_state()

ss.sendall("101 User\n")

when writeing the 101 I'll get an SSL23_GET_SERVER_HELLO
unknown protocol error. If I don't do the ssl stuff, everything
works.

I also tried this with the socket.ssl(s,None, None) to get a secure
socket - but I got the same error.

The server is not written by me - so I can't change that to python.
The problem is, that there is first an unencrypted socket, that is
converted to a secure socket.

the perl (server) code is something like this:

# creating a socket
$socket = IO::Socket::INET->new(Listen => 5,
LocalPort => 2000,
Timeout => 15,
Resue => 1,
Proto => 'tcp');

# some more code

# accepting a remote connection
$session = $socket->accept;

# some more code

# convert the Socket to an ssl socket
$sslsocket = IO::Socket::SSL::socket_to_SSL($session,
SSL_verify_mode => 0x00)

# some more code

Does anybody know, where the UNKNOWN PROTOCOL error
comes from? I have changed the connection Mode to
SSLv2_METHOD but this gave me an GET_SERVER_HELLO
read wrong packet type error.

I have done this with python 2.3.4 under linux - and the perl stuff
is done via the IO-Socket-SSL package.

Thx,

Chris

Jul 18 '05 #1
0 2616

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Robert | last post by:
did you solve this problem? It seems to be still present here with py2.3.5. Robert -- From: Manish Jethani <manish.j@gmx.net> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US;...
0
by: Benjamin Schollnick | last post by:
Folks, With Windows XP, and Python v2.41 I am running into a problem.... The following code gives me an unknown protocol error.... And I am not sure how to resolve it... I have a API...
1
by: Fahad | last post by:
I am trying to send an e-mail using CDO I get this message when trying to send an e-mail. I am using the object Set ObjMsg = Server.CreateObject("CDO.Message") CDO.Message.1 (0x800C000D) The...
4
by: David Moore | last post by:
Hello I am using the System.DirectoryServices namespace classes to access Active Directory. We connect using the LDAP://DOMAIN method. The code works on local dev boxes, and in staging, but...
0
by: David Moore | last post by:
Hello I posted a thread about this a while back, but I can't actually find it again so I can reply to it with the solution I found, so I'm making a new thread and hoping it goes to the top of...
1
by: Robert | last post by:
On some connections only from some computers/network setups I get this error: Traceback (most recent call last): File "<interactive input>", line 1, in ? File...
12
by: Ann Marinas | last post by:
Hi all, I would like to ask for some help regarding separating the asp.net webserver and the sql server. I have created an asp.net application for a certain company. Initially, we installed...
0
by: Greg | last post by:
My app makes a call to a remote server (about which I know relatively little) using Webclient.UploadData. This is done once every 51/2 mins and is called by code within a worker thread. 95% of the...
0
by: aboutjav.com | last post by:
Hi, I need some help. I am getting this error after I complete the asp.net register control and click on the continue button. It crashed when it tries to get it calls this Profile property ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.