3
Guys I’m trying to decrypt AES, only I’m facing the following mistake:
Traceback (Most recent call last):
File ". /teste2.py", line 190, in main()
File ". /teste2.py", line 186, in main Decrypt(password)
File ". /teste2.py", line 172, in Decrypt Dec = Base64.b64decode(crypt.Decrypt(password))
File "/usr/lib/python2.7/Base64.py", line 76, in b64decode raise Typeerror(msg)
Typeerror: Incorrect padding
This is my code:
def decrypt(password):
iv = ''.join(chr(random.randint(0, 0xFF)) for i in range(16))
crypt = AES.new(password, AES.MODE_CBC, iv)
dec = base64.b64decode(crypt.decrypt(password))
print "[+] Result: %s" % dec
I have already solved this problem, but it returns the password to me like this: Ṃ. "-} R Y # Υ Ӵ A
– Littl3
Note that it is not using the "crypt" library (whatever: Unix, C, or PHP), simply the variable is called
crypt
. But your remark about Base64 is correct.– mgibsonbr
Thank you - corrected in the text.
– jsbueno
@exploitsec: the password in this way that you demonstrate that the string contains non-printable characters. I don’t know if it was your idea to have it in "clear text" at that point (because of the call to Crypt) - if so, there is something wrong there. If you only want a printable version that can be serialized as text, use Base64.base64encode at that value
– jsbueno