Test parmencrypt and parmdecrypt encryption functionalities and their migration from MCRYPT to OPENSSL.
Definition at line 113 of file sharedHcuCuTrustedDetailTest.php.
◆ test_current_openssl_encryption_mode_agnostic_nature_parm()
| HcuCuTrustedParmEncryptionTest::test_current_openssl_encryption_mode_agnostic_nature_parm |
( |
| ) |
|
Test parm encryption with several popular aes 256bits key size based aes encryption modes with openssl. Our openssl encryption implementation is expected to work properly for the listed encryption modes at the least.
Definition at line 226 of file sharedHcuCuTrustedDetailTest.php.
228 $openssl_aes_256_modes = array(
"aes-256-ctr",
236 $previous_decrypted_data =
"";
237 foreach($openssl_aes_256_modes as $aes_cipher_mode) {
238 $openssl_ciphertext =
"";
239 $obtained_decrypted_text =
"";
242 $openssl_ciphertext = parmencrypt($this->trusted_data,
244 $cipher_method=$aes_cipher_mode);
249 $obtained_decrypted_text = parmdecrypt($openssl_ciphertext,
251 $cipher_method=$aes_cipher_mode);
253 $this->assertEquals($obtained_decrypted_text, $this->trusted_data);
255 if ($previous_decrypted_data !=
"") {
256 $this->assertEquals($previous_decrypted_data, $obtained_decrypted_text);
259 $previous_decrypted_dat = $obtained_decrypted_text;
◆ test_current_standard_openssl_encryption_mode()
| HcuCuTrustedParmEncryptionTest::test_current_standard_openssl_encryption_mode |
( |
| ) |
|
Verify that the current standard is maintained eg. we are upgrading from mcrypt ecb to aes-256-cbc on March, 2019. Current standard for parm encryption is therefore aes-256-cbc.
Definition at line 199 of file sharedHcuCuTrustedDetailTest.php.
200 $this->assertEquals($this->hcu_standard_encryption_mode_for_parm, PARMENCDEC_CIPHER_MODE);
201 $this->assertEquals($this->hcu_standard_auth_hash_algo, PARMENCDEC_AUTH_HASH_ALGO);
◆ test_parm_with_current_default_encryption_mode()
| HcuCuTrustedParmEncryptionTest::test_parm_with_current_default_encryption_mode |
( |
| ) |
|
Test parmencrypt and parmdecrypt with default arguments
Definition at line 207 of file sharedHcuCuTrustedDetailTest.php.
210 $openssl_ciphertext = parmencrypt($this->trusted_data,
213 $obtained_decrypted_text = parmdecrypt($openssl_ciphertext,
216 $this->assertEquals($obtained_decrypted_text, $this->trusted_data);
◆ test_parmecrypt_mcrypt_to_openssl_transition_with_ecb()
| HcuCuTrustedParmEncryptionTest::test_parmecrypt_mcrypt_to_openssl_transition_with_ecb |
( |
| ) |
|
We still use ECB mode of operations mainly due to vendor/interfaces requirements and specifications. Wherever possible, these must be upgraded based on the latest crypto standards and guidelines.
Definition at line 150 of file sharedHcuCuTrustedDetailTest.php.
152 if(function_exists(
"parmencrypt_mcrypt")) {
157 $obtained_ciphertext_mcrypt = parmencrypt_mcrypt($this->trusted_data,
160 $this->assertEquals($obtained_ciphertext_mcrypt,
161 $this->expected_trusted_data_mcrypt_ecb_cipher_base64);
164 $obtained_decrypted_data_mcrypt = parmdecrypt($obtained_ciphertext_mcrypt,
166 $cipher_method=
"aes-256-ecb");
168 $this->assertEquals($obtained_decrypted_data_mcrypt,
169 $this->trusted_data);
176 $obtained_ciphertext_openssl = parmencrypt($this->trusted_data,
178 $cipher_method=
"aes-256-ecb");
179 $this->assertEquals($obtained_ciphertext_openssl,
180 $this->expected_trusted_data_openssl_ecb_cipher_base64);
183 $obtained_decrypted_data_openssl = parmdecrypt($obtained_ciphertext_openssl,
185 $cipher_method=
"aes-256-ecb");
186 $this->assertEquals($obtained_decrypted_data_openssl, $this->trusted_data);
189 if(function_exists(
"paramencrypt_mcrypt")) {
190 $this->assertEquals($obtained_decrypted_data_openssl, $obtained_decrypted_data_mcrypt);
The documentation for this class was generated from the following file: