The AES CBC cipher object

class AESCBCCipher

To create an AES (Advanced Encryption Standard) CBC (Cipher Block Chaining ) cipher for use with file encryption or decryption.

The cipher can be used when playing or recording files, and sending or receiving faxes, to encrypt or decrypt the file.

The cipher can be used to decrypt an audio file that is to be played, or a TIFF file that is to be sent using fax. The audio or TIFF file must exist in your cloud media store and will have been encrypted using AES CBC before being uploaded. The file can only be decrypted if the cipher is created using the same key and vector that were used to encrypt the file.

The cipher can be used to encrypt, using AES CBC, an audio file that is to be recorded, or a TIFF file that is to be received using fax. The audio or TIFF file will be saved to your cloud media store and will have been encrypted using the key and vector supplied by the cipher. The file can only be decrypted using AES CBC and the same key and vector that were used during encryption.

Supported key sizes are 128, 192 and 256 bits. Supported initialisation vector size is 128 bits.

To have access to the AESCBCCipher class it must be imported first: from prosody.uas import AESCBCCipher

Provide the key and the initialisation vector when constructing the cipher. The key must be represented as 16, 24 or 32 hexadecimal bytes and the initialisation vector must be represented as 16 hexadecimal bytes.

The tutorial has a record example you might want to look at.

Usage example:

# after having retrieved the correct key and vector to decrypt the file to play
my_cipher = AESCBCCipher(key="3e139a97574248d43bf01de3521474bf69f32ec2fc00edb866c26dcffff9d0a3",
                         vector="9b0ef243445da908976b7dc9c247c29e")
cause = channel.FilePlayer.play(filename=my_encrypted_file_name, cipher=my_cipher)