Commit 76785279 authored by Nigel McNie's avatar Nigel McNie
Browse files

When an CryptException occurs when sending an XMLRPC request (because the...

When an CryptException occurs when sending an XMLRPC request (because the response was using an old key for example), fail in a nicer manner.

Update the message for the primary cause of this (old key) so it's more obvious in the logs.
parent 1ac3ba0f
......@@ -96,16 +96,21 @@ class Client {
throw new XmlrpcClientException('Payload is not a valid XML document (payload is above)', 6001);
}
if ($xml->getName() == 'encryptedMessage') {
$payload_encrypted = true;
$wwwroot = (string)$xml->wwwroot;
$payload = xmlenc_envelope_strip($xml);
}
try {
if ($xml->getName() == 'encryptedMessage') {
$payload_encrypted = true;
$wwwroot = (string)$xml->wwwroot;
$payload = xmlenc_envelope_strip($xml);
}
if ($xml->getName() == 'signedMessage') {
$payload_signed = true;
$remote_timestamp = $xml->timestamp;
$payload = xmldsig_envelope_strip($xml);
if ($xml->getName() == 'signedMessage') {
$payload_signed = true;
$remote_timestamp = $xml->timestamp;
$payload = xmldsig_envelope_strip($xml);
}
}
catch (CryptException $e) {
throw new XmlrpcClientException("An error occured while decrypting a message sent by $wwwroot. Unable to authenticate the user.");
}
if ($xml->getName() == 'methodResponse') {
......
......@@ -787,7 +787,7 @@ class OpenSslRepo {
}
}
}
throw new CryptException('Invalid certificate', 7025);
throw new CryptException('We know nothing about the key used to encrypt this message', 7025);
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment