473,395 Members | 1,969 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,395 software developers and data experts.

encryption/decryption help

drs
Hi, I need to send secure data over an insecure network. To that end, I am
needing to encrypt serialized data and then decrypt it. Is there a builtin
way to do this in Python? MD5, SHA, etc encrypt, but I am not seeing a way
to get back my data. Encryption is totally new to me, so any pointers of
what to read up on would be appreciated.

As a side note, I understand that I could use https, but this would involve
changing things that I may not be at liberty to change -- though if this
turns out to be the best solution, then I'll find a way to use it.

Thanks
Jul 18 '05 #1
4 4944
"drs" <dr*@remove-to-send-mail-ecpsoftware.com> writes:
Hi, I need to send secure data over an insecure network. To that end, I am
needing to encrypt serialized data and then decrypt it. Is there a builtin
way to do this in Python? MD5, SHA, etc encrypt, but I am not seeing a way
to get back my data.
No, Python doesn't include any reversible encryption functions, because
of regulatory obstacles in some countries. Here's a function based
on SHA:

http://www.nightsong.com/phr/crypto/p3.py

It's not ideal and it's nonstandard, but it's written in pure Python
and still has reasonable performance and should have ok security.

It works on 32-bit processors but a simple fix is needed to make it
work on 64-bit processors. I'll put that in when I get a chance.
Encryption is totally new to me, so any pointers of what to read up
on would be appreciated.
Rule #1 is that there are a lot of subtle mistakes that can kill you.
Try to use standard solutions when you can, instead of doing anything ad-hoc.

The standard reference about crypto implementation is "Applied
Cryptography" by Bruce Schneier. That's got all kinds of stuff about
algorithms and protocols. You could also look at "Practical
Cryptography" by Bruce Schneier and Niels Ferguson. That is more
about what kinds of precautions you should take when implementing
crypto. I disagree with some of what it says, but it's a start.

Also, anyone implementing any type of security system (crypto or not)
should read "Security Engineering" by Ross Anderson.
As a side note, I understand that I could use https, but this would involve
changing things that I may not be at liberty to change -- though if this
turns out to be the best solution, then I'll find a way to use it.


Using https is almost certainly a better solution than rolling up
something yourself. Do it if the option is available to you.
Jul 18 '05 #2
Hi,

Can you use ssh tunneling? You will not be changing anything except add
an extra ssh layer to tunnel your data through. There is how-to at
http://www.ccs.neu.edu/groups/system...sshtunnel.html

(or you can google for tunneling)

Please note you can not use MD5 as it is not reversible.
Thanks,
--Kartic

Jul 18 '05 #3
MD5 and SHA are by their very nature one way encryption. You cannot
decrypt them.

A quick google for other encrytion methods found this:
http://www.amk.ca/python/code/crypto.html

What you will need to do is find an encryption methos that uses a key
which you use to encrypt and decrypt the data.

You could get hold of something like GPG which has a command line
interface and encrypt and decrypt that way....

drs wrote:
Hi, I need to send secure data over an insecure network. To that end, I am
needing to encrypt serialized data and then decrypt it. Is there a builtin
way to do this in Python? MD5, SHA, etc encrypt, but I am not seeing a way
to get back my data. Encryption is totally new to me, so any pointers of
what to read up on would be appreciated.

As a side note, I understand that I could use https, but this would involve
changing things that I may not be at liberty to change -- though if this
turns out to be the best solution, then I'll find a way to use it.

Thanks


Jul 18 '05 #4
On 12 Jan 2005 12:39:05 -0800, Kartic <ka******************@gmail.com> wrote:
Hi,

Can you use ssh tunneling? You will not be changing anything except add
an extra ssh layer to tunnel your data through.


Or, rather, he wouldn't be changing anything at all in the program itself.
The approach would be "Ok, so this protocol is insecure. If you want to
protect yourself from eavesdropping and man-in-the-middle attacks along the
ways, you have to feed it through an ssh tunnel or something similar".

But we don't really know what this person wants to accomplish, so this may
or may not be a viable option.

/Jorgen

--
// Jorgen Grahn <jgrahn@ Ph'nglui mglw'nafh Cthulhu
\X/ algonet.se> R'lyeh wgah'nagl fhtagn!
Jul 18 '05 #5

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

Similar topics

3
by: Ralph Freshour | last post by:
I'm having trouble decrypting a file I encrypted and wrote to the server - the following code displays the $decrypted_string variable but the data is still encrypted - any help would be...
2
by: Dave Bailey | last post by:
I have developed a web app using DPAPI to encrypt a connection string in the web.config file. The application works perfectly on the development machine but when deployed to the server when...
2
by: almurph | last post by:
Hi everyone, Can you help me please? I am having a problem with the encryption/decryption of words with the Irish fada in them. The Irish fada is like this: áéíóú/ÁÉÍÓÚ. It's kind of like the...
8
by: manmit.walia | last post by:
Hello Everyone, Long time ago, I posted a small problem I had about converting a VB6 program to C#. Well with the help with everyone I got it converted. But I overlooked something and don't...
4
by: Fritjolf | last post by:
Hi. I've got a strange problem... I've made a simple program to test encryption/decryption. I use Rijndael encryption and here are the most important properties. RijndaelManaged cipher =...
0
by: Dipanwita | last post by:
I have written a RSA encryption/decryption function in c using the formula a = b^c %n. For solving the equation I have used Squaring and multiplying method for modulo exponentiation . These...
3
by: =?Utf-8?B?TG9yZW4=?= | last post by:
I’m trying to encrypt and decrypt a file in vb.net. I am using the TripleDESCryptoServiceProvider encryption found in System.Security.Cryptography. Below is the code for my Encrypt and Decrypt...
5
by: Netwatcher | last post by:
well, i started messing around with dictionaries, yet, most of the pages i found about them always talk about getting only one word out of it and turning it vice versa, i've been playing with that...
9
by: Betikci Boris | last post by:
I get bored last night and wrote a script that uses xor for encrypt- decrypt, however it woks fine under linux 2.6.25, text and documents are ok, but fails on compressed files *.jpg, *.pdf , etc ....
9
by: Alan M Dunsmuir | last post by:
In my (PHP-5) application I have to write some records to a table in my database, which I don't want even my clients using the system to be able to read. This is not a problem in National...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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,...
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.