Takes in the encrypted response from the server and decrypts it

        :param response: The response that needs to be decrytped
        :return: The unencrypted message from the server
172696
def parse_encrypted_response(self, response):
        
        content_type = response.headers['Content-Type']
        if 'protocol="{0}"'.format(self.protocol_string.decode()) in content_type:
            host = urlsplit(response.request.url).hostname
            msg = self._decrypt_response(response, host)
        else:
            msg = response.text

        return msg
214411
def decrypt(self, txt, key):
        
        # log.debug("decrypt(txt='%s', key='%s')", txt, key)
        assert isinstance(txt, six.text_type), "txt: %s is not text type!" % repr(txt)
        assert isinstance(key, six.text_type), "key: %s is not text type!" % repr(key)

        pbkdf2_hash, crypted = txt.rsplit("$",1)

        # if not seed_generator.DEBUG and len(pbkdf2_hash)!=SALT_HASH_LEN:
        #     raise SecureJSLoginError(
        #         "encrypt error: Salt-hash %s with length %i must be length %i!" % (
        #             repr(pbkdf2_hash), len(pbkdf2_hash), SALT_HASH_LEN
        #         )
        #     )

        try:
            crypted = binascii.unhexlify(crypted)
        except (binascii.Error, TypeError) as err:
            # Py2 will raise TypeError - Py3 the binascii.Error
            raise SecureJSLoginError("unhexlify error: %s with data: %s" % (err, crypted))

        if len(crypted) != len(key):
            raise SecureJSLoginError("encrypt error: %s and '%s' must have the same length!" % (crypted, key))

        key=force_bytes(key)
        decrypted = self.xor(crypted, key)

        try:
            decrypted = force_text(decrypted)
        except UnicodeDecodeError:
            raise SecureJSLoginError("Can't decode data.")

        test = PBKDF2SHA1Hasher1().verify(decrypted, pbkdf2_hash)
        if not test:
            raise SecureJSLoginError("XOR decrypted data: PBKDF2 hash test failed")

        return decrypted
331415
def decrypt_email(enc_email):
    
    aes = SimpleAES(flask.current_app.config["AES_KEY"])
    return aes.decrypt(enc_email)
1263925
def encrypt(self):
        
        value = self.parameters.get("Plaintext")
        if isinstance(value, six.text_type):
            value = value.encode('utf-8')
        return json.dumps({"CiphertextBlob": base64.b64encode(value).decode("utf-8"), 'KeyId': 'key_id'})
1106077
def _handle_response(self, response):
        
        if not str(response.status_code).startswith('2'):
            raise BinanceAPIException(response)
        try:
            return response.json()
        except ValueError:
            raise BinanceRequestException('Invalid Response: %s' % response.text)
814967
def parse_response(response):
    
    if isinstance(response, tuple):
        if len(response) > 2:
            return response[0], response[1], response[2]
        elif len(response) > 1:
            return response[0], response[1], {}
    try:
        return response.data, response.status_code, response.headers
    except AttributeError:
        return response, 200, {}
49291
def response(response)
  		raw_response = CGI::parse(decrypt_data(response,@working_Key,"AES-128-CBC"))

  		auth_desc = raw_response["AuthDesc"][0]
  		order_id = raw_response["Order_Id"][0]
  		amount = raw_response["Amount"][0]
  		checksum = raw_response["Checksum"][0]

  		verification = verifyChecksum(order_id,amount,auth_desc,checksum)
  		return auth_desc,verification,raw_response
  	end
423378
def process_response(self, request, response):
        
        # A higher middleware layer may return a request which does not contain
        # messages storage, so make no assumption that it will be there.
        if hasattr(request, '_messages'):
            unstored_messages = request._messages.update(response)
            if unstored_messages and settings.DEBUG:  # pragma: no-cover
                raise ValueError('Not all temporary messages could be stored.')
        if hasattr(request, '_alarms'):
            unstored_alarms = request._alarms.update(response)
            if unstored_alarms and settings.DEBUG:  # pragma: no-cover
                raise ValueError('Not all temporary alarms could be stored.')
        return response
550248
def _parse_certificate(cls, response):
        
        links = _parse_header_links(response)
        try:
            cert_chain_uri = links[u'up'][u'url']
        except KeyError:
            cert_chain_uri = None
        return (
            response.content()
            .addCallback(
                lambda body: messages.CertificateResource(
                    uri=cls._maybe_location(response),
                    cert_chain_uri=cert_chain_uri,
                    body=body))
            )
877173
def decrypt(self, key, flags=0):
        
        bio = Membio()
        if libcrypto.CMS_EncryptedData_decrypt(self.ptr, key, len(key), None,
                                               bio.bio, flags) <= 0:
            raise CMSError("decrypt data")
        return str(bio)
378323
def _from_json(cls, response_raw, wrapper=None):
        

        json = response_raw.body_bytes.decode()
        obj = converter.json_to_class(dict, json)
        value = converter.deserialize(
            cls,
            cls._unwrap_response_single(obj, wrapper)
        )

        return client.BunqResponse(value, response_raw.headers)
972712
def _handle_response(response):
        

        if not str(response.status_code).startswith('2'):
            raise KucoinAPIException(response)
        try:
            res = response.json()

            if 'code' in res and res['code'] != "200000":
                raise KucoinAPIException(response)

            if 'success' in res and not res['success']:
                raise KucoinAPIException(response)

            # by default return full response
            # if it's a normal response we have a data attribute, return that
            if 'data' in res:
                res = res['data']
            return res
        except ValueError:
            raise KucoinRequestException('Invalid Response: %s' % response.text)
608825
def decrypt_result(self, *args, **kwargs):
        
        if self.response is None:
            raise ValueError('Empty response')
        if self.response.response is None \
                or 'result' not in self.response.response \
                or self.response.response['result'] is None:
            raise ValueError('No result data')

        res_hex = self.response.response['result']

        # Strip out the plaintext part
        plain_length = bytes_to_long(from_hex(res_hex[0:4]))
        if plain_length > 0:
            res_hex = res_hex[4 + plain_length:]
        else:
            res_hex = res_hex[4:]

        # Optionally strip trailing _... string
        idx_trail = res_hex.find('_')
        if idx_trail != -1:
            res_hex = res_hex[0:idx_trail]

        # Decode hex coding
        res_bytes = from_hex(res_hex)

        # Crypto stuff - check the length & padding
        if len(res_bytes) < 16:
            raise InvalidResponse('Result too short')

        mac_given = res_bytes[-16:]
        res_bytes = res_bytes[:-16]

        # Check the MAC
        mac_computed = cbc_mac(self.uo.mac_key, res_bytes)
        if not str_equals(mac_given, mac_computed):
            raise CryptoError('MAC invalid')

        # Decrypt
        decrypted = aes_dec(self.uo.enc_key, res_bytes)
        if len(decrypted) < 1 + 4 + 8 or decrypted[0:1] != bchr(0xf1):
            raise InvalidResponse('Invalid format')

        self.resp_object_id = bytes_to_long(decrypted[1:5])
        self.resp_nonce = EBUtils.demangle_nonce(decrypted[5:5 + EBConsts.FRESHNESS_NONCE_LEN])
        self.decrypted = decrypted[5 + EBConsts.FRESHNESS_NONCE_LEN:]
        self.decrypted = PKCS7.unpad(self.decrypted)
        return self.response
199732
def decode_response(client_message, to_object=None):
    
    parameters = dict(status=None, address=None, uuid=None, owner_uuid=None, serialization_version=None, server_hazelcast_version=None, client_unregistered_members=None)
    parameters['status'] = client_message.read_byte()
    if not client_message.read_bool():
        parameters['address'] = AddressCodec.decode(client_message, to_object)
    if not client_message.read_bool():
        parameters['uuid'] = client_message.read_str()
    if not client_message.read_bool():
        parameters['owner_uuid'] = client_message.read_str()
    parameters['serialization_version'] = client_message.read_byte()
    if client_message.is_complete():
        return parameters
    parameters['server_hazelcast_version'] = client_message.read_str()
    if not client_message.read_bool():
        client_unregistered_members_size = client_message.read_int()
        client_unregistered_members = []
        for _ in range(0, client_unregistered_members_size):
            client_unregistered_members_item = MemberCodec.decode(client_message, to_object)
            client_unregistered_members.append(client_unregistered_members_item)
        parameters['client_unregistered_members'] = ImmutableLazyDataList(client_unregistered_members, to_object)
    return parameters
623261
def decrypt(crypt_text) -> str:
        
        cipher = Fernet(current_app.config['KEY'])
        if not isinstance(crypt_text, bytes):
            crypt_text = str.encode(crypt_text)
        return cipher.decrypt(crypt_text).decode("utf-8")
1292028
def unpack_response(self, cursor_id=None,
                        codec_options=_UNICODE_REPLACE_CODEC_OPTIONS,
                        user_fields=None, legacy_response=False):
        
        # If _OpMsg is in-use, this cannot be a legacy response.
        assert not legacy_response
        return bson._decode_all_selective(
            self.payload_document, codec_options, user_fields)
629416
def decrypt(self, data, decode=False):
		

		#result = self.cipher().decrypt(data)
		result = self.cipher().decrypt_block(data)

		padding = self.mode().padding()
		if padding is not None:
			result = padding.reverse_pad(result, WAESMode.__data_padding_length__)

		return result.decode() if decode else result