I am running this python script on APIGEE @Anil Sagar
Getting Error → ImportError: No module named Crypto
However, it runs fine on sublime text..Has anyone faced this error..
#!/usr/bin/env python
import base64
from datetime import datetime
from Crypto.Cipher import AES
BS = 16
pad = lambda s: s + (BS - len(s) % BS) * chr(BS - len(s) % BS)
unpad = lambda s : s[0:-ord(s[-1])]
class AESCipher:
def __init__( self, key ):
self.key = key
def encrypt( self, raw ):
raw = pad(raw)
IV = 16 * '\x00'
cipher = AES.new( self.key, AES.MODE_CBC, IV )
return base64.b64encode(cipher.encrypt( raw ) )
cipher = AESCipher('sEI099Zx1JUKkA8x1fW4HsxEmdfbBODi')
password = 'user_id=joeUser&user_tier=default&user_timestamp='+datetime.now().strftime('%Y%m%d%H%M%S');
encrypted = cipher.encrypt(password)
print password
print encrypted