--- a/Utilities/crypto/py3AES.py Fri Oct 18 23:00:41 2013 +0200 +++ b/Utilities/crypto/py3AES.py Fri Nov 01 15:48:48 2013 +0100 @@ -47,6 +47,7 @@ @param b data to be stripped (bytes) @return stripped data (bytes) + @exception ValueError data padding is invalid """ if len(b) % 16 or not b: raise ValueError( @@ -173,6 +174,7 @@ rotate(1d2c3a4f) == 2c3a4f1d. @param data data of size 4 (bytearray) + @return rotated data (bytearray) """ return data[1:] + data[:1] @@ -491,6 +493,7 @@ @param key key to be used (bytes or bytearray) @param size key size (16, 24 or 32) @return encrypted data (bytes) + @exception ValueError key size is invalid """ output = bytearray(16) # the number of rounds @@ -547,6 +550,7 @@ @param key key to be used (bytes or bytearray) @param size key size (16, 24 or 32) @return decrypted data (bytes) + @exception ValueError key size is invalid """ output = bytearray(16) # the number of rounds @@ -641,6 +645,7 @@ @param IV initialisation vector (bytearray) @return tuple with mode of operation, length of the input and the encrypted data (integer, integer, bytes) + @exception ValueError key size is invalid or decrypted data is invalid """ if len(key) % size: raise ValueError("Illegal size ({0}) for key '{1}'.".format( @@ -724,7 +729,7 @@ """ Public method to perform the decryption operation. - @param input data to be encrypted (bytes) + @param cipherIn data to be decrypted (bytes) @param originalsize unencrypted string length (required for CBC) (integer) @param mode mode of operation (0, 1 or 2) @@ -732,6 +737,7 @@ @param size length of the key (16, 24 or 32) @param IV initialisation vector (bytearray) @return decrypted data (bytes) + @exception ValueError key size is invalid or decrypted data is invalid """ if len(key) % size: raise ValueError("Illegal size ({0}) for key '{1}'.".format( @@ -842,7 +848,6 @@ (bytes) @param mode mode of operations (0, 1 or 2) @return decrypted data (bytes) - @exception ValueError key size is invalid or decrypted data is invalid """ key = bytearray(key) keysize = len(key)