/** * @expectedException \Paybox\OpenSSLException */ public function testCheckSignatureWithInvalidPublicKeyFile() { $openssl = new OpenSSL(); $openssl->checkSignature('', false, 'non-existent-file.pem'); }
/** * Checks the parameters received in the callback or return URL. * * Callback URL call (server-to-server) is a GET request. * Return URL call (user's browser) is a POST request. * * @param string $message The raw query or POST string. * @param bool $isPost Whether the message comes from a POST (true) or GET (false) request. * * @return RemoteMPIResponse * * @throws RemoteMPIException If the signature of the message is invalid. * @throws OpenSSLException If an OpenSSL error occurs. */ public function getResponse($message, $isPost) { $openSSL = new OpenSSL(); if (!$openSSL->checkSignature($message, $isPost)) { throw new RemoteMPIException('Invalid message signature.'); } parse_str($message, $data); return new RemoteMPIResponse($data); }