src/eric7/Utilities/crypto/py3AES.py

branch
eric7
changeset 10692
9becf9ca115c
parent 10439
21c28b0f9e41
child 10908
ef1b3cd9a6ca
equal deleted inserted replaced
10691:d1a603a70f83 10692:9becf9ca115c
1625 if keysize not in AES.KeySize.values(): 1625 if keysize not in AES.KeySize.values():
1626 raise ValueError("invalid key size: {0}".format(keysize)) 1626 raise ValueError("invalid key size: {0}".format(keysize))
1627 # create a new iv using random data 1627 # create a new iv using random data
1628 iv = bytearray([i for i in os.urandom(16)]) 1628 iv = bytearray([i for i in os.urandom(16)])
1629 moo = AESModeOfOperation() 1629 moo = AESModeOfOperation()
1630 mode, length, ciph = moo.encrypt(data, mode, key, keysize, iv) 1630 _mode, _length, ciph = moo.encrypt(data, mode, key, keysize, iv)
1631 # With padding, the original length does not need to be known. It's a bad 1631 # With padding, the original length does not need to be known. It's a bad
1632 # idea to store the original message length. 1632 # idea to store the original message length.
1633 # prepend the iv. 1633 # prepend the iv.
1634 return bytes(iv) + bytes(ciph) 1634 return bytes(iv) + bytes(ciph)
1635 1635

eric ide

mercurial