We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 417b353 commit 3209a99Copy full SHA for 3209a99
1 file changed
paddingoracle.py
@@ -259,11 +259,16 @@ def xor(data, key):
259
260
def test():
261
import os
262
- from M2Crypto.util import pkcs7_pad
263
from Crypto.Cipher import AES
264
265
teststring = 'The quick brown fox jumped over the lazy dog'
266
+ def pkcs7_pad(data, blklen=16):
267
+ if blklen > 255:
268
+ raise ValueError('Illegal block size %d' % (blklen, ))
269
+ pad = (blklen - (len(data) % blklen))
270
+ return data + chr(pad) * pad
271
+
272
class PadBuster(PaddingOracle):
273
def oracle(self, data):
274
_cipher = AES.new(key, AES.MODE_CBC, str(iv))
0 commit comments