The currently implemented approach has the shortcoming that it encrypts and decrypts each 128-bit block separately. If the plaintext contains identical 128-byte blocks, the blocks will be encrypted identically. This makes some of the plaintext structure visible in the ciphertext, even to someone who does not have the key. DO NOT USE this functionality for any new place where you might need encryption. Because current code is meant for keeping backwards compatiblity with existing data. Better way to use AES would be integrated with authentication, for example, in AES-GCM mode.