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

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.encStringToAscii(msg)
print cipher
msg_back = k.decStringFromAscii(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(cipher)
print type(recovered_msg) # A message string is returned (good)
print len(recovered_msg) # The string is EMPTY! (not good)
print recovered_msg # No message returned (not good)
f.close()

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

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

scott$ python testezPyCrypto10.py
Meeting delayed 30 hours
--------------------
<StartPycryptoMessage>
5AAoVQNSU0FxAChjQ3J5cHRvLlB1YmxpY0tleS5SU0EKUlNBb2 JqCnEBb3ECfXEEKFUBZXEFTDY1
NTM3TApVAW5xBkw3MDg1MTU0ODQ3Nzg2Mzg1NzA3ODYxMzQ0ND cwNDQ3MDkzMTQ0NzkxNDIyMzAy
MDMwMjQxMTcxNjY2NzQ3MjQ3Njc0MTAxMTYwNjA4OTA0ODUxMz gxMDkyMjkwNjk5OTM3MTUwMTc0
Njc3MzI5NjY3NjQzOTUzNjQzMDQ4MTEwMTYwMTMyMDE3Nzk4MT cxOTYzOTkwMTY0MzIxTAp1YnRx
By5DAAFAAB0nHmncdr+reFXlH3sqlTD3sGzljukoy7bD0CqTIx 0G/wUBQikdDz/jUPG1lJeDpc3V
yW5alZnazsunbv9ck6RDAAFAAINJBPMc/j8FQznrDhrd5bIjsEIdYgL8Mhuyz4duDF2usmzKG+B0
zjuatNSSgYr6D3NsBnGc8kgcZFFsSldWql5DAAFAABuHpHTspB rEF4I9RWBMFdaw8bpAAaEx69w5
wAu5jx1PiPLHY+8VVWshIaIjKjTPnWuD1OmSIr17k0R5XTNoLa kIKBLNld6+SaoIb1AIRsYowggI
y/BY6VP0e70A
<EndPycryptoMessage>

Meeting delayed 30 hours
--------------------
<StartPycryptoKey>
KEkwMApOVeQoVQNSU0FxAChjQ3J5cHRvLlB1YmxpY0tleS5SU0 EKUlNBb2JqCnEBb3ECfXEEKFUB
ZXEFTDY1NTM3TApVAW5xBkw3MDg1MTU0ODQ3Nzg2Mzg1NzA3OD YxMzQ0NDcwNDQ3MDkzMTQ0Nzkx
NDIyMzAyMDMwMjQxMTcxNjY2NzQ3MjQ3Njc0MTAxMTYwNjA4OT A0ODUxMzgxMDkyMjkwNjk5OTM3
MTUwMTc0Njc3MzI5NjY3NjQzOTUzNjQzMDQ4MTEwMTYwMTMyMD E3Nzk4MTcxOTYzOTkwMTY0MzIx
TAp1YnRxBy5xAHRxAS4=
<EndPycryptoKey>

<ezPyCrypto.key instance at 0xc00f8>
<type 'str'>
0
Jul 19 '05 #1
0 1099

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

Similar topics

1
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...
0
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
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?...
4
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...
0
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...
13
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...
10
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...
1
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...
2
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...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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.