Compute Lux SAFECOOKIE response. * * ServerHash is computed as: * HMAC-SHA256("Lux 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
| 543 | * |
| 544 | */ |
| 545 | 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) |
| 546 | { |
| 547 | CHMAC_SHA256 computeHash((const uint8_t*)key.data(), key.size()); |
| 548 | std::vector<uint8_t> computedHash(CHMAC_SHA256::OUTPUT_SIZE, 0); |
| 549 | computeHash.Write(cookie.data(), cookie.size()); |
| 550 | computeHash.Write(clientNonce.data(), clientNonce.size()); |
| 551 | computeHash.Write(serverNonce.data(), serverNonce.size()); |
| 552 | computeHash.Finalize(computedHash.data()); |
| 553 | return computedHash; |
| 554 | } |
| 555 | |
| 556 | void LuxController::authchallenge_cb(LuxControlConnection& _conn, const LuxControlReply& reply) |
| 557 | { |
no test coverage detected