Decrypt string by key and iv from config

@param string $string
@return string
763530
private function decrypt($string = "")
    {
        $key = $this->config->get('gateway.asanpardakht.key');
        $iv = $this->config->get('gateway.asanpardakht.iv');

        try {

            $soap = new SoapClient("https://services.asanpardakht.net/paygate/internalutils.asmx?WSDL");
            $params = array(
                'aesKey' => $key,
                'aesVector' => $iv,
                'toBeDecrypted' => $string
            );

            $response = $soap->DecryptInAES($params);
            return $response->DecryptInAESResult;

        } catch (\SoapFault $e) {
            return "";
        }
    }
548624
public static function rijndael($string, $key, $operation = self::ENCRYPT) {
        if ($operation === static::ENCRYPT) {
            return static::encrypt($string, $key, static::RIJNDAEL);
        } else {
            return static::decrypt($string, $key, static::RIJNDAEL);
        }
    }
1052737
public function encrypt($string)
    {
        $td = mcrypt_module_open($this->cypher, '', $this->mode, '');
        $iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td), mcrypt_RAND);
        mcrypt_generic_init($td, $this->key, $iv);
        $encrypted = mcrypt_generic($td, $string);
        mcrypt_generic_deinit($td);

        return $iv.$encrypted;
    }
82054
public function readString($string)
    {
        if (!is_string($string))
            throw new IniReadingException('The expected type is string');

        // PHP 5.3.3, an empty line return is needed at the end.
        $string .= "\n";

        $data = @parse_ini_string($string, true);
        if ($data === false) {
            $e = error_get_last();
            throw new IniReadingException('Syntax error in INI configuration: ' . $e['message']);
        }

        $rawValues = @parse_ini_string($string, true, INI_SCANNER_RAW);

        return $this->toCollection($this->decode($data, $rawValues));
    }
133178
protected function getKeysFromString($string)
    {
        $string = str_replace($this->identifierArray, $this->replaceWith, $string);
        $parts = explode($this->defaultIdentifier, $string);

        return array_map(
            function ($part) {
                return str_replace($this->replaceWith, $this->defaultIdentifier, $part);
            },
            $parts
        );
    }
786410
public function decrypt(string $data) {
        $keyHash = md5(Config::getConfig()->encrypt->key);
        $key = substr($keyHash, 0, mcrypt_get_key_size(self::$cipher, self::$mode));
        $iv = substr($keyHash, 0, mcrypt_get_block_size(self::$cipher, self::$mode));
        return mcrypt_decrypt(self::$cipher, $key, base64_decode($data), self::$mode, $iv);
    }
112017
public static function decrypt($data)
    {
        $iv_size = openssl_cipher_iv_length(static::$cipher);
        
        $iv = Str::slice(sha1(static::$key), 0, $iv_size);

        return openssl_decrypt($data, static::$cipher, static::$key, 0, $iv);
    }
1046621
public static function safeBase64Decode($string)
    {
        $data = str_replace(array('-', '_'), array('+', '/'), $string);
        $mod4 = strlen($data) % 4;
        if ($mod4) {
            $data .= substr('====', $mod4);
        }

        return static::base64Decode($data);
    }
1011892
public static function des($string, $key, $operation = self::ENCRYPT) {
        if ($operation === static::ENCRYPT) {
            return static::encrypt($string, $key, static::DES);
        } else {
            return static::decrypt($string, $key, static::DES);
        }
    }
243382
public function tokenize($iv, $string = '')
    {
        if (empty($string)) {
            $string = $this->random_string();
        }

        return openssl_encrypt($string, 'AES-256-CBC', $this->_config->get('token'), 0, $iv);
    }
1098183
function decrypt($ciphertext)
    {
        if ($this->k <= 0) {
            return false;
        }

        $ciphertext = str_split($ciphertext, $this->k);
        $ciphertext[count($ciphertext) - 1] = str_pad($ciphertext[count($ciphertext) - 1], $this->k, chr(0), STR_PAD_LEFT);

        $plaintext = '';

        switch ($this->encryptionMode) {
            case CRYPT_RSA_ENCRYPTION_NONE:
                $decrypt = '_raw_encrypt';
                break;
            case CRYPT_RSA_ENCRYPTION_PKCS1:
                $decrypt = '_rsaes_pkcs1_v1_5_decrypt';
                break;
            //case CRYPT_RSA_ENCRYPTION_OAEP:
            default:
                $decrypt = '_rsaes_oaep_decrypt';
        }

        foreach ($ciphertext as $c) {
            $temp = $this->$decrypt($c);
            if ($temp === false) {
                return false;
            }
            $plaintext.= $temp;
        }

        return $plaintext;
    }
1212093
public static String decryptString(String string, String key) {
        if (!StringUtils.isEmpty(string)) {
            try {
                return Encryption.decryptString(
                        string, key);
            } catch (EncryptionException e) {
                LOG.error(e.getMessage());
            }
        }
        return "";
    }
677025
protected static function decode($string, $key)
    {
        for ($i = 0; $i < strlen($key); $i++) {
            $char   = $key[$i];
            $string = str_replace("%{$i}", "{$char}", $string);
        }

        return $string;
    }
446468
public static function decodeToInteger($string)
    {
        $stringLength = strlen($string);

        $baseLength = strlen(static::$chars);

        $id = 0;

        for($i = 0; $i < $stringLength; $i++){

            $pos = strpos(static::$chars, $string[$i]);

            $id = ($id * $baseLength) + $pos;

        }

        return $id;
    }
168550
protected function decrypt($string)
	{
		// only if we want the cookie to be encrypted
		if ($this->config['cookie']['encrypt_cookie'])
		{
			// we require the mcrypt PECL extension for this
			if ( ! function_exists('mcrypt_decrypt'))
			{
				throw new \BadMethodCallException('The Session Cookie driver requires the PHP mcrypt extension to be installed.');
			}

			// create the encyption key
			$key = hash('SHA256', $this->config['cookie']['crypt_key'], true);

			// key the IV from the payload
			$iv = base64_decode(substr($string, 0, 22) . '==');
			$string = substr($string, 22);

			// decrypt the payload
			$string = rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $key, base64_decode($string), MCRYPT_MODE_CBC, $iv), "\0\4");

			// split the hash from the payload
			$hash = substr($string, -32);
			$string = substr($string, 0, -32);

			// double-check it wasn't tampered with
			if (md5($string) != $hash)
			{
				return false;
			}
		}

		return $string;
	}
162895
public function parseString($string)
    {
        //argument 1 must be a string
        Argument::i()->test(1, 'string');
        
        foreach ($this->data as $key => $value) {
            $string = str_replace($key, $value, $string);
        }

        return $string;
    }
1277808
public function decrypt(string $data)
  {
    $iv_strlen = 2  * $this->iv_bytes();
    if(preg_match("/^(.{" . $iv_strlen . "})(.+)$/", $data, $regs)) {
      list(, $iv, $crypted_string) = $regs;
      $decrypted_string = openssl_decrypt($crypted_string, $this->method, $this->key, 0, hex2bin($iv));
      return $decrypted_string;
    } else {
      return false;
    }
  }