Crypto ++ / pycrypto with Google engine
I am using crypto ++ to send AES encrypted HTTP requests to the application engine, planning to decrypt them. My plan is to encrypt the part after the "?" so it's something like:
http://myurl.com/Command?eiwjfsdlfjldkjfs when it's encrypted. However, I am stuck figuring out how to decrypt it on the other end and still the user gets () a response to get the arguments. Can anyone advise if I am taking the wrong approach? Should I decrypt and not use get () but my own parser then?
+2
a source to share
1 answer
I think you should create a url like this:
http://myurl.com/Command?q=eiwjfsdlfjldkjfs
Then, in the request handler, you should be able to receive the encrypted message like this:
encrypted_string = self.request.get('q')
EDIT
Here's how to do it:
1) to create a url:
import Crypto
from Crypto.Cipher import ARC4
obj=ARC4.new('stackoverflow')
plain = urllib.urlencode({'param1': 'v1', 'param2': 'v2'})
ciph = obj.encrypt(plain)
url = 'myurl.com/Command?%s' % urllib.urlencode({'q': ciph})
#url should be 'myurl.com/Command?q=%D4%2B%E5%FA%04rE.%1C.%81%0C%B6t%DCl%F8%84%EB'
2) to decipher it:
ciph = self.request.get('q')
obj=ARC4.new('stackoverflow')
plain = obj.decrypt(ciph)
get_data = cgi.parse_qs(plain) # {'param2': ['v2'], 'param1': ['v1']}
+3
a source to share