virtual std::string retrieveResponse(const IHttpResponse& response)
 {
     if (response.getStatusCode() != HttpStatusCode::OK) {
         throw HttpTransportException(response.getStatusCode(), (boost::format("Invalid response code %1%") % response.getStatusCode()).str());
     }
     return getHttpDataProcessor()->retrieveOperationResponse(response);
 }
Exemplo n.º 2
0
void HttpDataProcessor::verifyResponse(const IHttpResponse& response)
{
    if (response.getStatusCode() != 200) {
        throw TransportException(boost::format("Invalid response code %1%") % response.getStatusCode());
    }
    SharedBody rawResponse = response.getBody();
    const std::string& signature = response.getHeaderField("X-SIGNATURE");
    boost::scoped_array<std::uint8_t> decodedSignature(new std::uint8_t[signature.length() / 3 * 4]);
    size_t sigLength = Botan::base64_decode(decodedSignature.get(), signature);
    if (!encDec_->verifySignature(rawResponse.first.get(), rawResponse.second, decodedSignature.get(), sigLength)) {
        throw TransportException("Failed to verify signature");
    }
}