summaryrefslogtreecommitdiff
path: root/pipermail/pycrypto/2009q4/000133.html
blob: 7c8cc65ed43b9af7ededb2027adbabb4e4b4e711 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
 <HEAD>
   <TITLE> [pycrypto] AES decrypting issues
   </TITLE>
   <LINK REL="Index" HREF="index.html" >
   <LINK REL="made" HREF="mailto:pycrypto%40lists.dlitz.net?Subject=%5Bpycrypto%5D%20AES%20decrypting%20issues&In-Reply-To=4ACCCB38.9040601%40cryptography.com">
   <META NAME="robots" CONTENT="index,nofollow">
   <META http-equiv="Content-Type" content="text/html; charset=us-ascii">
   <LINK REL="Previous"  HREF="000132.html">
   <LINK REL="Next"  HREF="000134.html">
 </HEAD>
 <BODY BGCOLOR="#ffffff">
   <H1>[pycrypto] AES decrypting issues</H1>
    <B>Mike Driscoll</B> 
    <A HREF="mailto:pycrypto%40lists.dlitz.net?Subject=%5Bpycrypto%5D%20AES%20decrypting%20issues&In-Reply-To=4ACCCB38.9040601%40cryptography.com"
       TITLE="[pycrypto] AES decrypting issues">mdriscoll at co.marshall.ia.us
       </A><BR>
    <I>Wed Oct  7 12:54:58 CST 2009</I>
    <P><UL>
        <LI>Previous message: <A HREF="000132.html">[pycrypto] AES decrypting issues
</A></li>
        <LI>Next message: <A HREF="000134.html">[pycrypto] AES decrypting issues
</A></li>
         <LI> <B>Messages sorted by:</B> 
              <a href="date.html#133">[ date ]</a>
              <a href="thread.html#133">[ thread ]</a>
              <a href="subject.html#133">[ subject ]</a>
              <a href="author.html#133">[ author ]</a>
         </LI>
       </UL>
    <HR>  
<!--beginarticle-->
<PRE>Hi Luke,
&gt;<i> Does it decrypt with the PHP example?
</I>&gt;<i>   
</I>
I asked my colleague and he doesn't use that decrypt method...he just 
uses the encrypt one.

&gt;<i> You might try encrypting/decrypting an example with Python, then
</I>&gt;<i> decrypting the encrypted example with PHP to make sure you have the
</I>&gt;<i> right configuration settings.
</I>&gt;<i>
</I>&gt;<i> It's also possible that the data was corrupted. Is there any kind of
</I>&gt;<i> integrity check for the file?
</I>&gt;<i>   
</I>
I don't think so.

&gt;<i> Luke
</I>&gt;<i>   
</I>
My guess is that either I'm doing something stupid or the encryption is 
screwed up.

- Mike

&gt;<i> Mike Driscoll wrote:
</I>&gt;<i>   
</I>&gt;&gt;<i> Hi,
</I>&gt;&gt;<i>
</I>&gt;&gt;<i> I am working on a project where I need to decrypt some data that has
</I>&gt;&gt;<i> been encrypted with AES. Our webmaster gave me a PHP example that he 
</I>&gt;&gt;<i> uses, but I'm supposed to use Python. Here's the PHP code:
</I>&gt;&gt;<i>
</I>&gt;&gt;<i> $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
</I>&gt;&gt;<i> $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
</I>&gt;&gt;<i> return rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key,
</I>&gt;&gt;<i> $data,MCRYPT_MODE_ECB, $iv),&quot;\0&quot;);
</I>&gt;&gt;<i>
</I>&gt;&gt;<i> I've been told on c.l.py that the iv in this case should be 16 bytes.
</I>&gt;&gt;<i>
</I>&gt;&gt;<i> I tried following the example on this blog by modifying it as needed:
</I>&gt;&gt;<i>
</I>&gt;&gt;<i> <A HREF="http://www.codekoala.com/blog/2009/aes-encryption-python-using-pycrypto/">http://www.codekoala.com/blog/2009/aes-encryption-python-using-pycrypto/</A>
</I>&gt;&gt;<i>
</I>&gt;&gt;<i> But no matter which base64 decode method I use, I get some kind of 
</I>&gt;&gt;<i> error: b32decode, b64decode and decodestring all return a padding error 
</I>&gt;&gt;<i> whereas b16decode claims that I don't have only 16-bit characters in my 
</I>&gt;&gt;<i> data string.
</I>&gt;&gt;<i>
</I>&gt;&gt;<i> I've never done this before, so I'm not sure where I'm going wrong. Any 
</I>&gt;&gt;<i> advice would be appreciated. I'm on Windows XP with Python 2.5.
</I>&gt;&gt;<i>
</I>&gt;&gt;<i> Thanks,
</I>&gt;&gt;<i>
</I>&gt;&gt;<i> Mike
</I>&gt;&gt;<i>
</I>&gt;&gt;<i> _______________________________________________
</I>&gt;&gt;<i> pycrypto mailing list
</I>&gt;&gt;<i> <A HREF="http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto">pycrypto at lists.dlitz.net</A>
</I>&gt;&gt;<i> <A HREF="http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto">http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto</A>
</I>&gt;&gt;<i>
</I>&gt;&gt;<i>   
</I>&gt;&gt;<i>     
</I>&gt;<i>
</I>&gt;<i>   
</I>
</PRE>


<!--endarticle-->
    <HR>
    <P><UL>
        <!--threads-->
	<LI>Previous message: <A HREF="000132.html">[pycrypto] AES decrypting issues
</A></li>
	<LI>Next message: <A HREF="000134.html">[pycrypto] AES decrypting issues
</A></li>
         <LI> <B>Messages sorted by:</B> 
              <a href="date.html#133">[ date ]</a>
              <a href="thread.html#133">[ thread ]</a>
              <a href="subject.html#133">[ subject ]</a>
              <a href="author.html#133">[ 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>