Interface AES_CBC
access this type via: sec.crypto.AES_CBC (provides, requires or uses)
AES-CBC implementation. AES-CBC provides confidentiality but not authenticity of the encrypted ciphertext data.
Constants
byte ENCRYPT
byte DECRYPT
int KEY_128
int KEY_192
int KEY_256
Functions
AES_CBC(byte mode, int keyLength, char key[], char iv[])
byte[] encryptPart(byte content[])
byte[] encryptFinish()
bool encryptOK()
byte[] decryptPart(byte content[])
byte[] decryptFinish()
bool decryptOK()
Constants
ENCRYPT
DECRYPT
KEY_128
KEY_192
KEY_256
AES_CBC(byte mode, int keyLength, char key[], char iv[])
Create the cipher using a given key length, shared secret key, and IV. The provided key must be the same length, in bits, as keyLength. Applications will typically use an SHA algorithm to convert an arbitrary-length key (like a user password) into a fixed-length key for use with a cipher. IV should be a randomly-generated string, and must be of length 16 (128 bits). The same IV value must be used when decrypting the ciphertext (it is generally considered safe to store / transmit the IV in plain text to allow decryption).
mode Encryption or decryption mode, using the constants ENCRYPT or DECRYPT.
keyLength The length of the key, in bits. This must be one of KEY_128, KEY_192, or KEY_256.
key The shared secret key, which must be the same length as the specified key length (e.g., 32 bytes for KEY_256). Applications will typically use an SHA algorithm to convert an arbitrary-length key (like a user password) into a fixed-length key for use with a cipher.
iv A string of characters, which must be of length 16 (128 bits). This is used to help generate the first encrypted block, and the same iv value must later be used to decrypt.
byte[] encryptPart(byte content[])
Encrypt part (or all) of a plain-text message. This function can be called repeatedly on each successive part of a message / data, or can be called once on the entirety of that item.
byte[] encryptFinish()
Finish encryption. This function must always be called to return any final bytes of ciphertext.
bool encryptOK()
Check if encryption process has occurred without errors so far. Because it is potentially 'normal' for encryptPart() or encryptFinish() to return an empty / null byte array, and this return status can also occur due to an exception, this function can be called to differentiate the two cases.
byte[] decryptPart(byte content[])
Decrypt part (or all) of a ciphertext message. This function can be called repeatedly on each successive part of a ciphertext message / data, or can be called once on the entirety of that item.
byte[] decryptFinish()
Finish decryption. This function must always be called to return any final bytes of decrypted plain text.
bool decryptOK()
Check if decryption process has occurred without errors so far. Because it is potentially 'normal' for decryptPart() or decryptFinish() to return an empty / null byte array, and this return status can also occur due to an exception, this function can be called to differentiate the two cases.