mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-27 05:23:51 +00:00
Initial commit: wowee native WoW 3.3.5a client
This commit is contained in:
commit
ce6cb8f38e
147 changed files with 32347 additions and 0 deletions
75
include/auth/srp.hpp
Normal file
75
include/auth/srp.hpp
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
#pragma once
|
||||
|
||||
#include "auth/big_num.hpp"
|
||||
#include <vector>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
namespace wowee {
|
||||
namespace auth {
|
||||
|
||||
// SRP6a implementation for World of Warcraft authentication
|
||||
// Based on the original wowee JavaScript implementation
|
||||
class SRP {
|
||||
public:
|
||||
SRP();
|
||||
~SRP() = default;
|
||||
|
||||
// Initialize with username and password
|
||||
void initialize(const std::string& username, const std::string& password);
|
||||
|
||||
// Feed server challenge data (B, g, N, salt)
|
||||
void feed(const std::vector<uint8_t>& B,
|
||||
const std::vector<uint8_t>& g,
|
||||
const std::vector<uint8_t>& N,
|
||||
const std::vector<uint8_t>& salt);
|
||||
|
||||
// Get client public ephemeral (A) - send to server
|
||||
std::vector<uint8_t> getA() const;
|
||||
|
||||
// Get client proof (M1) - send to server
|
||||
std::vector<uint8_t> getM1() const;
|
||||
|
||||
// Verify server proof (M2)
|
||||
bool verifyServerProof(const std::vector<uint8_t>& serverM2) const;
|
||||
|
||||
// Get session key (K) - used for encryption
|
||||
std::vector<uint8_t> getSessionKey() const;
|
||||
|
||||
private:
|
||||
// WoW-specific SRP multiplier (k = 3)
|
||||
static constexpr uint32_t K_VALUE = 3;
|
||||
|
||||
// Helper methods
|
||||
std::vector<uint8_t> computeAuthHash(const std::string& username,
|
||||
const std::string& password) const;
|
||||
void computeClientEphemeral();
|
||||
void computeSessionKey();
|
||||
void computeProofs(const std::string& username);
|
||||
|
||||
// SRP values
|
||||
BigNum g; // Generator
|
||||
BigNum N; // Prime modulus
|
||||
BigNum k; // Multiplier (3 for WoW)
|
||||
BigNum s; // Salt
|
||||
BigNum a; // Client private ephemeral
|
||||
BigNum A; // Client public ephemeral
|
||||
BigNum B; // Server public ephemeral
|
||||
BigNum x; // Salted password hash
|
||||
BigNum u; // Scrambling parameter
|
||||
BigNum S; // Shared session key (raw)
|
||||
|
||||
// Derived values
|
||||
std::vector<uint8_t> K; // Interleaved session key (40 bytes)
|
||||
std::vector<uint8_t> M1; // Client proof (20 bytes)
|
||||
std::vector<uint8_t> M2; // Expected server proof (20 bytes)
|
||||
|
||||
// Stored credentials
|
||||
std::string stored_username;
|
||||
std::string stored_password;
|
||||
|
||||
bool initialized = false;
|
||||
};
|
||||
|
||||
} // namespace auth
|
||||
} // namespace wowee
|
||||
Loading…
Add table
Add a link
Reference in a new issue