473,770 Members | 3,710 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4966
"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.co m> 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
4277
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 appreciated: $handle = fopen("/home/public_html/testfolder/test.txt","r"); $buffer = fgets($handle, 4096); fclose($handle); // Encryption/decryption key $key = "twenty one years ago";
2
4197
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 opening the app the following wrror is generated: Exception decrypting. Decryption failed. Key not valid for use in specified state. Description: An unhandled exception occurred during the execution of the current web request. Please review the
2
7151
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 French grave... Anyway when I run encryption on a plaintext word like:
8
2745
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 understand why it is doing this. Below is my code, I would be greatfull if someone can guide me through the right path or even help me solve this issue. Problem: The old tool which was written in VB6 works perfect. But I needed to convert this to C#...
4
5705
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 = new RijndaelManaged(); cipher.KeySize = 256; cipher.BlockSize = 256;
0
2372
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 functions work fine when Two random prime numbers (required to generate public n private key) are within certain range but fails afterwords.All the variables are of datatype ULONGLONG. I m unable to fix up the problem. Is these really a storage problem...
3
3078
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 functions. While my functions read and write files the encryption/decryption is not working properly. My test file has an original length of 66,048 bytes. My encrypted file ends up with 66,056 bytes … 8 bytes more than my original. When I...
5
9531
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 code for a few hours: #dics Encryption={',':'hy{;',' ':'h4x0r2','':'zomg','?':'bko','a':'ika','b':'d0v','c':'ino', 'd':'maw', 'e':'aon', 'f':'que', 'g':'kip', 'h':'an', 'n':'ko print lol except KeyError: print 'These...
9
4817
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 . I didn't test script on windows. Here is the code, please send me your views. <?php /* Mother Eye Chipper with PHP :), Licence:GPL,
9
2441
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 Security; I simply want the contents of records in this file to remain unreadable, even by the client's IT supervisor who can look at the contents of the (MySQL) database using phpMyAdmin. I intend, periodically, to download these records to my local...
0
9432
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
10232
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10008
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
9873
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8891
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...
0
6682
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
5313
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3974
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
3
2822
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.