MCPcopy Create free account
hub / github.com/apache/trafficserver / getPayloadSha256

Function getPayloadSha256

plugins/origin_server_auth/aws_auth_v4.cc:266–279  ·  view source on GitHub ↗

* @brief: Payload SHA 256 = Hex(SHA256Hash( ) (no new-line char at end) * * @todo support for signing of PUSH, POST content / payload * @param signPayload specifies whether the content / payload should be signed * @return signature of the content or "UNSIGNED-PAYLOAD" to mark that the payload is not signed */

Source from the content-addressed store, hash-verified

264 * @return signature of the content or "UNSIGNED-PAYLOAD" to mark that the payload is not signed
265 */
266String
267getPayloadSha256(bool signPayload)
268{
269 static const String UNSIGNED_PAYLOAD("UNSIGNED-PAYLOAD");
270
271 if (!signPayload) {
272 return UNSIGNED_PAYLOAD;
273 }
274
275 unsigned char payloadHash[SHA256_DIGEST_LENGTH];
276 SHA256(reinterpret_cast<const unsigned char *>(""), 0, payloadHash); /* empty content */
277
278 return base16Encode(reinterpret_cast<char *>(payloadHash), SHA256_DIGEST_LENGTH);
279}
280
281/**
282 * @brief Get Canonical Uri SHA256 Hash

Callers 2

getPayloadHashMethod · 0.85

Calls 2

SHA256Class · 0.85
base16EncodeFunction · 0.85

Tested by

no test coverage detected