public function decrypt($strEncryptedData)
    {
        if ($this->blnBase64) {
            $strEncryptedData = QString::base64UrlSafeDecode($strEncryptedData);
        }
        $strIv = $this->strIv;
        if ($this->strIvHashKey) {
            $offset = strrpos($strEncryptedData, ":");
            if ($offset === null) {
                throw new Q\Exception\Cryptography("Hash value not found.");
            }
            $hash1 = substr($strEncryptedData, $offset + 1);
            $strEncryptedData = substr($strEncryptedData, 0, $offset);

            // check for tampering
            $hash2 = hash_hmac('sha256', $strEncryptedData, $this->strIvHashKey);
            if ($hash1 != $hash2) {
                throw new Q\Exception\Cryptography("Encryption tampering detected");
            }

            $offset2 = strrpos($strEncryptedData, ":");

            if ($offset2 === null) {
                throw new Q\Exception\Cryptography("IV not found.");
            }
            $strIv = substr($strEncryptedData, $offset2 + 1);
            $strIv = hex2bin($strIv);    // undo our serialization encoding
            $strEncryptedData = substr($strEncryptedData, 0, $offset2);
        }
        $strDecryptedData = openssl_decrypt($strEncryptedData, $this->strCipher, $this->strKey, 0, $strIv);

        return $strDecryptedData;
    }