473,698 Members | 2,888 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

socket.ssl with key files?

I need to use socket.ssl() to open a connection using key files. I
have been provided with a text file called cert_key_pem.tx t containing
my keys that looks like this:

-----BEGIN RSA PRIVATE KEY-----
MIICXgIBAAKBgQD KwLuk/UpICOnZvH3mf9rF QvCkDPA8XQZLpa8 0Z0liMVYu4GQT
<snip>
-----END RSA PRIVATE KEY-----
-----BEGIN CERTIFICATE-----
MIICkTCCAfqgAwI BAgICNqUwDQYJKo ZIhvcNAQEFBQAwg Z8xCzAJBgNVBAYT AlVT
<snip>
-----END CERTIFICATE-----

I see that socket.ssl takes "keyfile" and "certfile" parameters. So do
I just take the text file that I've been given and break it into two
files, then specify those file names when I open the connection? At
the moment, I'm getting

File "/usr/local/lib/python2.4/httplib.py", line 1070, in connect
ssl = socket.ssl(sock , self.key_file, self.cert_file)
File "/usr/local/lib/python2.4/socket.py", line 74, in ssl
return _realssl(sock, keyfile, certfile)
socket.sslerror : (1, 'error:14094410 :SSL routines:SSL3_R EAD_BYTES:sslv3
alert handshake failure')

Many thanks for any ideas!

-Chris

Jan 19 '06 #1
4 2450
Chris Curvey wrote:
I see that socket.ssl takes "keyfile" and "certfile" parameters. So do
I just take the text file that I've been given and break it into two
files, then specify those file names when I open the connection?


This might help, or it might not. If you have a passphrase on the
private key, somehow the passphrase needs to be provided as well,
but I'm unsure how.

This code is mostly untested, so you might have to modify _ssl.c
as well to make it work.

Regards,
Martin
Jan 19 '06 #2
thanks for the info.

1) Am I correct that I should just be splitting the files?
2) The passphrase question was in the back of my mind, but I guess I
need to move it to the front. Hopefully someone here will have an
idea. (I wonder if M2Crypto handles that?)

I guess it's better to know that the code is fairly untested, rather
than finding that out on my own.

-Chris

Jan 19 '06 #3
Chris Curvey wrote:
1) Am I correct that I should just be splitting the files?


Nobody knows. Just try it and report whether it works.

Regards,
Martin
Jan 19 '06 #4
Rats, you beat me to it.

It seems to work if I just give the same, combined file as the argument
to both the key_file and cert_file parameters. (that's not to say that
it doesn't work if I do something else).

In my case, the passphrase is packaged up in the xml payload and sent
over.

Thank you everyone.

Jan 19 '06 #5

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

Similar topics

6
3823
by: Al Wilkerson | last post by:
Is anyone aware of any special things to remember when sending Objects back in forth between Client and Sever, other than every readObject() should have a writeObject() and vice versa ? Does the ordering of statements before the read and write matter? Thanks, -- Al
5
4721
by: Jean-Pierre Bergamin | last post by:
Dear python-Community We are forced to use a quite old simulation software that's based on Modula-2. The idea is now to let this software "talk" to the outside world over a TCP/IP network. Since the program has no possibility to use sockets or other mechanisms to send data over the network we have the idea to let python do the network part and let the simu software communicate with the python script in some other way:
8
3189
by: Paulo da Silva | last post by:
How are those "files" of type "socket", whose name begins with "=", created? How can I create them with python? Thanks.
0
2875
by: Sean | last post by:
I am working with an OLD copy of Perl 5.004_04 with a "buggy" Socket module (version 1.6) and IO::Socket::Inet version 1.1603. The problem I am having is with Socket timeout issues - they just don't work. Looking into it I found that this version used signals to try to timeout whereas Grahm's new version uses blocking and IO::Select calls. Anyways, the Sys Admins REFUSE to install the new Perl and/or new Sockets *(don't ask - long...
7
2931
by: | last post by:
Hi all, I have a simple .aspx page running on net 2.0 that is trying to do a http post to a remote server. Here is the code Private Function ProcessRequests(ByVal strbody As String) As String Dim returnstr As String Dim URL As String = "http://www.dydomain.com/test.asp"
11
8602
by: atlaste | last post by:
Hi, In an attempt to create a full-blown webcrawler I've found myself writing a wrapper around the Socket class in an attempt to make it completely async, supporting timeouts and some scheduling mechanisms. I use a non-blocking approach for this, using the call to 'poll' to support the async mechanism - rather than the 'begin' and 'end' functions. I already found that connecting doesn't set the "isconnected" variable correctly...
1
2549
by: orehian | last post by:
Construct a one-time password system. · Write a server code and a client code. The server code takes as input a username and a one-time password from the client and then sends a message back to the client if they are correct. Specifications add the function of password-based user authentication to the client/server. The goal of the program is very simple: the server prints out a message only when the user has entered his/her...
0
3581
by: george585 | last post by:
Hello! I am new to network programming, and understand just basics. Using some sample code, and having read documentation, I managed to create a simple app in C# and VB.NET. The application is supposed to do the following: monitor ALL INCOMING TCP traffic on the local computer, and save certain parts of it as files - not log files though, but actual files that are sent to the computer as part of http or ftp. Basically if a user browse a page...
1
7159
by: keksy | last post by:
Hi every1, I am writing a small client/server application and in it I want to send an image asynchronous from the client to the server through a TCP socket. I found an example code on the MSDN site, which is actually for sending strings. I tried to adapt this code so that the client sends an image instead of a string. However, there is something wrong on the server side (i guess)... The server starts listening, the client starts sending...
0
8683
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8611
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9031
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8904
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7741
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6531
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5867
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4624
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.