Hi Baba, It looks like you're trying to pass binary data through a URL by copying and pasting it. The escape sequences that Python strings use (\xxx) are not the same as the escape sequences used in URLs (%xx), so the result is that your browser is escaping your already-python-escaped string. What you get in 'val' is not the 16 character binary string, but the 43 character escaped representation of the string.
Your best bet is to use an encoding such as base64 for any data you pass in via forms (eg, query string parameters), and decode it in your app before using it. -Nick Johnson On Fri, Aug 7, 2009 at 12:07 AM, Baba Ganoush<[email protected]> wrote: > > Hi all, > > please pardon my ignorance (I am new to Python and App Engine). I am > encountering an issue with a query string parameter I am trying to > decrypt. > > The following code > val = self.request.get('ciph') >>>> t\x88h{\xbe\xc2\x86\...@\xf5\xf8\xaek"\xbf@ > len(val) >>>> 43 > obj = AES.new(conf['secretKey'], AES.MODE_ECB) > return obj.decrypt(val) >>>> ValueError: Input strings must be a multiple of 16 in length > > When I run this same code in an interactive shell the length returned > is 16. > Can someone please poor some fool a bone on this one? > > Thanks in advance > > > > -- Nick Johnson, Developer Programs Engineer, App Engine --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~----------~----~----~----~------~----~------~--~---
