aes command


The AES(Advanced Encryption Standard) is a widely-used crypto specification made by the NIST. There are ECB and CBC methods in the AES.

The following is an explanation to encrypt/decrypt data with the ECB.

This command is for initializing PHPoC's AES crypto engine. So this command should be executed prior to the encryption/decryption. This command returns a context which is used for encryption and decryption.

Parameter Description
enc/dec enc - encryption
dec - decryption
$ecb_key the 128/192/256 bits key to be used encryption and decryption


The AES encryption or decryption is performed with this command according to initialization command. It returns the data which was encrypted or decrypted.

Parameter Description
$aes the context when the crypto engine was initialized
$text plain text to be encrypted or cipher text to be decrypted


The following is an explanation to encrypt/decrypt data with the CBC.

This command is for initializing PHPoC's AES crypto engine. So this command should be executed prior to the encryption/decryption. This command returns a context which is used for encryption and decryption.

Parameter Description
$enc/dec enc - encryption / dec - decryption
$cbc_key the 128/192/256 bits key to be used in encryption and decryption
$iv 128 bits initialization vector


The AES encryption or decryption is performed with this command according to initialization command. It returns the data which was encrypted or decrypted.

Parameter Description
$aes the context when the crypto engine was initialized
$text plain text to be encrypted or cipher text to be decrypted


The following is an example of the CBC-based AES encryption and decryption.

// encryption
$aes = system("aes init cbc enc %1 %2", $cbc_key, $cbc_iv);
$out = system("aes crypt %1 %2", $aes, $cbc_pt16);

// decryption
$aes = system("aes init cbc dec %1 %2", $cbc_key, $cbc_iv);
$out = system("aes crypt %1 %2", $aes, $cbc_ct16);