示例#1
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");
    }
}
示例#2
0
std::string HttpDataProcessor::retrieveOperationResponse(const IHttpResponse& response)
{
    SharedBody rawResponse = response.getBody();
    return encDec_->decodeData(rawResponse.first.get(), rawResponse.second);
}