473,569 Members | 2,782 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ezPyCrypto confusion

I am experimenting with ezPyCrypto
( http://www.freenet.org.nz/ezPyCrypto/ ).
Having difficulty making the key portable (ie put in a file). I don't
get an error message, I just recover a message string that is empty
instead of one that contains my message.

The code is below with a few extra print statements and comments that
hopefully make my problem clearer. Any help in getting it to work as
expected is appreciated. System is Mac OS 10.3 / Python 2.4.1 framework.

START PROGRAM--------------------------------------------

import ezPyCrypto

msg = 'Meeting delayed 30 hours'
print msg
print '--------------------'
k = ezPyCrypto.key( 512)
cipher = k.encStringToAs cii(msg)
print cipher
msg_back = k.decStringFrom Ascii(cipher)
print msg_back
print '--------------------'

# So far so good. encrypted and decrypted as expected.
# Now try to put the key in a file for transport on eg a USB drive.

key_as_string = k.exportKey()
print key_as_string
f = open('/Users/scott/pyprogs/the_key.txt', 'w')
f.write(key_as_ string)
f.close()

# Now get string representation of k (the key object above) and use it
# to create a key object (ke) that should decode the original cipher

f=open('/Users/scott/pyprogs/the_key.txt', 'r')
x = f.read()
ke = ezPyCrypto.key( x)
print ke # Key object exists (good)
recovered_msg = ke.decString(ci pher)
print type(recovered_ msg) # A message string is returned (good)
print len(recovered_m sg) # The string is EMPTY! (not good)
print recovered_msg # No message returned (not good)
f.close()

END PROGRAM-----------------------------------------------

RUN PROGRAM----------------------------------------------

scott$ python testezPyCrypto1 0.py
Meeting delayed 30 hours
--------------------
<StartPycryptoM essage>
5AAoVQNSU0FxACh jQ3J5cHRvLlB1Ym xpY0tleS5SU0EKU lNBb2JqCnEBb3EC fXEEKFUBZXEFTDY 1
NTM3TApVAW5xBkw 3MDg1MTU0ODQ3Nz g2Mzg1NzA3ODYxM zQ0NDcwNDQ3MDkz MTQ0NzkxNDIyMzA y
MDMwMjQxMTcxNjY 2NzQ3MjQ3Njc0MT AxMTYwNjA4OTA0O DUxMzgxMDkyMjkw Njk5OTM3MTUwMTc 0
Njc3MzI5NjY3NjQ zOTUzNjQzMDQ4MT EwMTYwMTMyMDE3N zk4MTcxOTYzOTkw MTY0MzIxTAp1YnR x
By5DAAFAAB0nHmn cdr+reFXlH3sqlT D3sGzljukoy7bD0 CqTIx0G/wUBQikdDz/jUPG1lJeDpc3V
yW5alZnazsunbv9 ck6RDAAFAAINJBP Mc/j8FQznrDhrd5bIj sEIdYgL8Mhuyz4d uDF2usmzKG+B0
zjuatNSSgYr6D3N sBnGc8kgcZFFsSl dWql5DAAFAABuHp HTspBrEF4I9RWBM Fdaw8bpAAaEx69w 5
wAu5jx1PiPLHY+8 VVWshIaIjKjTPnW uD1OmSIr17k0R5X TNoLakIKBLNld6+ SaoIb1AIRsYowgg I
y/BY6VP0e70A
<EndPycryptoMes sage>

Meeting delayed 30 hours
--------------------
<StartPycryptoK ey>
KEkwMApOVeQoVQN SU0FxAChjQ3J5cH RvLlB1YmxpY0tle S5SU0EKUlNBb2Jq CnEBb3ECfXEEKFU B
ZXEFTDY1NTM3TAp VAW5xBkw3MDg1MT U0ODQ3Nzg2Mzg1N zA3ODYxMzQ0NDcw NDQ3MDkzMTQ0Nzk x
NDIyMzAyMDMwMjQ xMTcxNjY2NzQ3Mj Q3Njc0MTAxMTYwN jA4OTA0ODUxMzgx MDkyMjkwNjk5OTM 3
MTUwMTc0Njc3MzI 5NjY3NjQzOTUzNj QzMDQ4MTEwMTYwM TMyMDE3Nzk4MTcx OTYzOTkwMTY0MzI x
TAp1YnRxBy5xAHR xAS4=
<EndPycryptoKey >

<ezPyCrypto.k ey instance at 0xc00f8>
<type 'str'>
0
Jul 19 '05 #1
0 1107

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

Similar topics

1
1907
by: John Hunter | last post by:
I have been playing around with ezPyCrypto. I generated and printed a key with >>> import ezPyCrypto >>> k = ezPyCrypto.key(2048) >>> print k.exportKey() I noticed there were a lot of N's and M's, too many to occur by chance s=k.exportKeyPrivate()
0
1181
by: Bill Seitz | last post by:
pyCrypto says it does, but nowhere in the ezPyCrypto docs do I see a reference to it, though I see other protocols specified.
3
2316
by: jlocc | last post by:
Hi!! I finally decided to use ezPyCrypto for my project but I can't download it from http://www.freenet.org.nz/ezPyCrypto/ ... Does anyone know of a different mirror? Maybe a similar wrapper? My goal is to encrypt a nine-digit number so that it can be safely used as a student ID number.
4
2535
by: JMCN | last post by:
object invalid or no longer set - confusion of the recordset in access 2003. i am currently converting from access 97 to access 2003. majority of the codes converted over perfectly fine, though my recordset did not. i read from pasts posts that some references will not convert. so i tried to change the dao 3.51 reference to dao 3.6 in...
0
1392
by: i_have_control | last post by:
I'd be grateful for any input on this one: I have three web domains. The destinations of two are set to folders on the first, though that fact is transparent to the user (i.e: it does not REDIRECT to the first domain). Example: http://www.maindomain.com (main hosted package) http://www.subdomain1.com -> www.maindomain.com/subdomain1/...
13
2081
by: Steve | last post by:
I have a form with a dataset and a datagrid. I created a dataview on this dataset. When the user modifies the datagrid, I look up this record in the dataview to make sure it is unique. Here is the confusion......... I thought that the DataView is the view from the dataset, but it seems that the dataview has the records that are in the...
10
3633
by: joelagnel | last post by:
hi friends, i've been having this confusion for about a year, i want to know the exact difference between text and binary files. using the fwrite function in c, i wrote 2 bytes of integers in binary mode. according to me, notepad opens files and each byte of the file read, it converts that byte from ascii to its correct character and...
1
3156
by: Richard Lewis Haggard | last post by:
I'm having a problem with what appears to be some sort of confusion with references. I have a single solution with a dozen projects which has been working quite nicely for a while. The references between projects in the solution were established through project references, not by browsing to an assembly DLL. All of the projects are strongly...
2
1528
by: Riaaaa | last post by:
Hello, We are doing the project in VB.Net. We had a great confusion for ASP.Net and VB.Net. Is VB.Net project performed in Microsoft Visual Studio 2005 ?? We have created forms in ASP.Net Website selecting the language as Visual Basic in Visual 2005. We want to do the VB.Net project for the central server...
0
7697
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...
0
7612
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...
0
7924
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. ...
0
7968
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...
0
6283
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...
1
5512
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...
0
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2113
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
1
1212
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.