diff options
Diffstat (limited to 'pipermail/pycrypto/2011q3/000453.html')
-rw-r--r-- | pipermail/pycrypto/2011q3/000453.html | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/pipermail/pycrypto/2011q3/000453.html b/pipermail/pycrypto/2011q3/000453.html new file mode 100644 index 0000000..e933e7f --- /dev/null +++ b/pipermail/pycrypto/2011q3/000453.html @@ -0,0 +1,101 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> +<HTML> + <HEAD> + <TITLE> [pycrypto] checksum problem. + </TITLE> + <LINK REL="Index" HREF="index.html" > + <LINK REL="made" HREF="mailto:pycrypto%40lists.dlitz.net?Subject=%5Bpycrypto%5D%20checksum%20problem.&In-Reply-To="> + <META NAME="robots" CONTENT="index,nofollow"> + <META http-equiv="Content-Type" content="text/html; charset=us-ascii"> + <LINK REL="Previous" HREF="000452.html"> + <LINK REL="Next" HREF="000455.html"> + </HEAD> + <BODY BGCOLOR="#ffffff"> + <H1>[pycrypto] checksum problem.</H1> + <B>Dave Pawson</B> + <A HREF="mailto:pycrypto%40lists.dlitz.net?Subject=%5Bpycrypto%5D%20checksum%20problem.&In-Reply-To=" + TITLE="[pycrypto] checksum problem.">dave.pawson at gmail.com + </A><BR> + <I>Thu Sep 1 03:46:58 CST 2011</I> + <P><UL> + <LI>Previous message: <A HREF="000452.html">[pycrypto] RSA signature pycrypto openssl interoperability +</A></li> + <LI>Next message: <A HREF="000455.html">[pycrypto] Fail to build pycrypto 2.3 on Ubuntu +</A></li> + <LI> <B>Messages sorted by:</B> + <a href="date.html#453">[ date ]</a> + <a href="thread.html#453">[ thread ]</a> + <a href="subject.html#453">[ subject ]</a> + <a href="author.html#453">[ author ]</a> + </LI> + </UL> + <HR> +<!--beginarticle--> +<PRE>I've been ignoring a checksum error for some time now, and decided to +ask for help. +Workaround + +def decrypt(ciphertext, secret, lazy=True, checksum=True): + """decrypt ciphertext with secret + ciphertext - encrypted content to decrypt + secret - secret to decrypt ciphertext + lazy - pad secret if less than legal blocksize (default: True) + checksum - verify crc32 byte encoded checksum (default: True) + returns plaintext + """ + secret = _lazysecret(secret) if lazy else secret + encobj = AES.new(secret, AES.MODE_CFB) + plaintext = encobj.decrypt(ciphertext) + if checksum: + crc, plaintext = (plaintext[-4:], plaintext[:-4]) + if not crc == struct.pack("i", zlib.crc32(plaintext)): + print "Checksum error" + #raise CheckSumError("checksum mismatch") + return plaintext + +1. I'm not sure how its happening or what I can do to resolve it? + +Currently working on windows. +Reading the file using binary mode +Ditto writing. + +I'm creating a plain text file, +encrypting +then writing back to disk + +Access then reads the file, decrypts and returns the sought string. +The checksum error is showing in the decrypt fn above. + +Any help appreciated. + + + +-- +Dave Pawson +XSLT XSL-FO FAQ. +Docbook FAQ. +<A HREF="http://www.dpawson.co.uk">http://www.dpawson.co.uk</A> +</PRE> + + + +<!--endarticle--> + <HR> + <P><UL> + <!--threads--> + <LI>Previous message: <A HREF="000452.html">[pycrypto] RSA signature pycrypto openssl interoperability +</A></li> + <LI>Next message: <A HREF="000455.html">[pycrypto] Fail to build pycrypto 2.3 on Ubuntu +</A></li> + <LI> <B>Messages sorted by:</B> + <a href="date.html#453">[ date ]</a> + <a href="thread.html#453">[ thread ]</a> + <a href="subject.html#453">[ subject ]</a> + <a href="author.html#453">[ author ]</a> + </LI> + </UL> + +<hr> +<a href="http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto">More information about the pycrypto +mailing list</a><br> +</body></html> |