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
| 561 | * |
| 562 | */ |
| 563 | static std::vector<uint8_t> ComputeResponse(const std::string &key, const std::vector<uint8_t> &cookie, const std::vector<uint8_t> &clientNonce, const std::vector<uint8_t> &serverNonce) |
| 564 | { |
| 565 | CHMAC_SHA256 computeHash((const uint8_t*)key.data(), key.size()); |
| 566 | std::vector<uint8_t> computedHash(CHMAC_SHA256::OUTPUT_SIZE, 0); |
| 567 | computeHash.Write(cookie.data(), cookie.size()); |
| 568 | computeHash.Write(clientNonce.data(), clientNonce.size()); |
| 569 | computeHash.Write(serverNonce.data(), serverNonce.size()); |
| 570 | computeHash.Finalize(computedHash.data()); |
| 571 | return computedHash; |
| 572 | } |
| 573 | |
| 574 | void TorController::authchallenge_cb(TorControlConnection& _conn, const TorControlReply& reply) |
| 575 | { |
no test coverage detected