Need help to convert mcrypt to openssl

Hi,

I need help to convert mcrypt code to openssl. Currently I am using mcrypt but that is not supported anymore with php 7.3, I need help to convert it to openssl. Any help is appericiated.

The code is following:

	protected function encryptAndEncode($strIn) {
		$strIn = $this->pkcs5_pad($strIn, 16);
		return "@".bin2hex(@mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $this->encryptPassword, $strIn, MCRYPT_MODE_CBC, $this->encryptPassword));
	}

	protected function decodeAndDecrypt($strIn) {
		$strIn = substr($strIn, 1);
		$strIn = pack('H*', $strIn);
		return @mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $this->encryptPassword, $strIn, MCRYPT_MODE_CBC, $this->encryptPassword);
	}

Thanks in advance.

https://odan.github.io/2017/07/14/replace-mcrypt-encrypt-with-openssl-encrypt.html

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.