Compute Tor SAFECOOKIE response. * * ServerHash is computed as: * HMAC-SHA256("Tor safe cookie authentication server-to-controller hash", * CookieString | ClientNonce | ServerNonce) * (with the HMAC key as its first argument) * * After a controller sends a successful AUTHCHALLENGE command, the * next command sent on the connection must be an AUTHENTICATE c
| 596 | * |
| 597 | */ |
| 598 | static std::vector<uint8_t> ComputeResponse(std::string_view key, std::span<const uint8_t> cookie, std::span<const uint8_t> client_nonce, std::span<const uint8_t> server_nonce) |
| 599 | { |
| 600 | CHMAC_SHA256 computeHash((const uint8_t*)key.data(), key.size()); |
| 601 | std::vector<uint8_t> computedHash(CHMAC_SHA256::OUTPUT_SIZE, 0); |
| 602 | computeHash.Write(cookie.data(), cookie.size()); |
| 603 | computeHash.Write(client_nonce.data(), client_nonce.size()); |
| 604 | computeHash.Write(server_nonce.data(), server_nonce.size()); |
| 605 | computeHash.Finalize(computedHash.data()); |
| 606 | return computedHash; |
| 607 | } |
| 608 | |
| 609 | void TorController::authchallenge_cb(TorControlConnection& _conn, const TorControlReply& reply) |
| 610 | { |
no test coverage detected