| 1 | /* |
| 2 | * Class that implements the SRP-3 based authentication schema |
| 3 | * used by Blizzards WarCraft 3. Implementations is based upon |
| 4 | * public information available under |
| 5 | * http://www.javaop.com/@ron/documents/SRP.html |
| 6 | * |
| 7 | * Copyright (C) 2008 - Olaf Freyer |
| 8 | * |
| 9 | * This program is free software; you can redistribute it and/or |
| 10 | * modify it under the terms of the GNU Affero General Public License |
| 11 | * as published by the Free Software Foundation; either version 3 |
| 12 | * of the License, or (at your option) any later version. |
| 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | * GNU Affero General Public License for more details. |
| 18 | */ |
| 19 | |
| 20 | #ifndef __BNET_SRP3_INCLUDED__ |
| 21 | #define __BNET_SRP3_INCLUDED__cxx . . $ `src/common/bnetsrp3.h:21:9`! |
| 22 | |
| 23 | #include <string> |
| 24 | #include "common/bigint.h"cxx . . $ `<file>/src/common/bigint.h`/ |
| 25 | |
| 26 | namespace pvpgncxx . . $ pvpgn/ |
| 27 | { |
| 28 | |
| 29 | class BnetSRP3cxx . . $ pvpgn/BnetSRP3# |
| 30 | { |
| 31 | public: |
| 32 | BnetSRP3cxx . . $ pvpgn/BnetSRP3#BnetSRP3(1adce25d148ffb4c).(const char* username, BigIntcxx . . $ pvpgn/BigInt#& salt); |
| 33 | BnetSRP3cxx . . $ pvpgn/BnetSRP3#BnetSRP3(955a996b079cdb58).(const stdcxx . . $ std/::stringcxx . . $ std/string#& username, BigIntcxx . . $ pvpgn/BigInt#& salt); |
| 34 | BnetSRP3cxx . . $ pvpgn/BnetSRP3#BnetSRP3(2fa786934fe80e24).(const char* username, const char* password); |
| 35 | BnetSRP3cxx . . $ pvpgn/BnetSRP3#BnetSRP3(c3ca1c130ce09c52).(const stdcxx . . $ std/::stringcxx . . $ std/string#& username, const stdcxx . . $ std/::stringcxx . . $ std/string#& password); |
| 36 | ~cxx . . $ pvpgn/BnetSRP3#`~BnetSRP3`(ced63f7c635d850d).BnetSRP3cxx . . $ pvpgn/BnetSRP3#(); |
| 37 | BigIntcxx . . $ pvpgn/BigInt# getVerifiercxx . . $ pvpgn/BnetSRP3#getVerifier(386d3f2c8bc32279).() const; |
| 38 | BigIntcxx . . $ pvpgn/BigInt# getSaltcxx . . $ pvpgn/BnetSRP3#getSalt(386d3f2c8bc32279).() const; |
| 39 | void setSaltcxx . . $ pvpgn/BnetSRP3#setSalt(29cbcaec537b00e2).(BigIntcxx . . $ pvpgn/BigInt# salt); |
| 40 | BigIntcxx . . $ pvpgn/BigInt# getClientSessionPublicKeycxx . . $ pvpgn/BnetSRP3#getClientSessionPublicKey(386d3f2c8bc32279).() const; |
| 41 | BigIntcxx . . $ pvpgn/BigInt# getServerSessionPublicKeycxx . . $ pvpgn/BnetSRP3#getServerSessionPublicKey(3c5fe9d91d82707a).(BigIntcxx . . $ pvpgn/BigInt#& v); |
| 42 | BigIntcxx . . $ pvpgn/BigInt# getHashedClientSecretcxx . . $ pvpgn/BnetSRP3#getHashedClientSecret(59a9847b0f9ae014).(BigIntcxx . . $ pvpgn/BigInt#& B) const; |
| 43 | BigIntcxx . . $ pvpgn/BigInt# getHashedServerSecretcxx . . $ pvpgn/BnetSRP3#getHashedServerSecret(804960666f5ec39a).(BigIntcxx . . $ pvpgn/BigInt#& A, BigIntcxx . . $ pvpgn/BigInt#& v); |
| 44 | BigIntcxx . . $ pvpgn/BigInt# getClientPasswordProofcxx . . $ pvpgn/BnetSRP3#getClientPasswordProof(f61cf7c7bab94069).(BigIntcxx . . $ pvpgn/BigInt#& A, BigIntcxx . . $ pvpgn/BigInt#& B, BigIntcxx . . $ pvpgn/BigInt#& K) const; |
| 45 | BigIntcxx . . $ pvpgn/BigInt# getServerPasswordProofcxx . . $ pvpgn/BnetSRP3#getServerPasswordProof(f61cf7c7bab94069).(BigIntcxx . . $ pvpgn/BigInt#& A, BigIntcxx . . $ pvpgn/BigInt#& M, BigIntcxx . . $ pvpgn/BigInt#& K) const; |
| 46 | |
| 47 | private: |
| 48 | int initcxx . . $ pvpgn/BnetSRP3#init(9a326b18acc2bb5b).(const char* username, const char* password, BigIntcxx . . $ pvpgn/BigInt#* salt); |
| 49 | BigIntcxx . . $ pvpgn/BigInt# getClientPrivateKeycxx . . $ pvpgn/BnetSRP3#getClientPrivateKey(386d3f2c8bc32279).() const; |
| 50 | BigIntcxx . . $ pvpgn/BigInt# getScramblercxx . . $ pvpgn/BnetSRP3#getScrambler(59a9847b0f9ae014).(BigIntcxx . . $ pvpgn/BigInt#& B) const; |
| 51 | BigIntcxx . . $ pvpgn/BigInt# getClientSecretcxx . . $ pvpgn/BnetSRP3#getClientSecret(59a9847b0f9ae014).(BigIntcxx . . $ pvpgn/BigInt#& B) const; |
| 52 | BigIntcxx . . $ pvpgn/BigInt# getServerSecretcxx . . $ pvpgn/BnetSRP3#getServerSecret(804960666f5ec39a).(BigIntcxx . . $ pvpgn/BigInt#& A, BigIntcxx . . $ pvpgn/BigInt#& v); |
| 53 | BigIntcxx . . $ pvpgn/BigInt# hashSecretcxx . . $ pvpgn/BnetSRP3#hashSecret(59a9847b0f9ae014).(BigIntcxx . . $ pvpgn/BigInt#& secret) const; |
| 54 | static BigIntcxx . . $ pvpgn/BigInt# Ncxx . . $ pvpgn/BnetSRP3#N.; // modulus |
| 55 | static BigIntcxx . . $ pvpgn/BigInt# gcxx . . $ pvpgn/BnetSRP3#g.; // generator |
| 56 | static BigIntcxx . . $ pvpgn/BigInt# Icxx . . $ pvpgn/BnetSRP3#I.; // H(g) xor H(N) where H() is standard SHA1 |
| 57 | BigIntcxx . . $ pvpgn/BigInt# acxx . . $ pvpgn/BnetSRP3#a.; // client session private key |
| 58 | BigIntcxx . . $ pvpgn/BigInt# bcxx . . $ pvpgn/BnetSRP3#b.; // server session private key |
| 59 | BigIntcxx . . $ pvpgn/BigInt# scxx . . $ pvpgn/BnetSRP3#s.; // salt |
| 60 | BigIntcxx . . $ pvpgn/BigInt# *Bcxx . . $ pvpgn/BnetSRP3#B.; // server public key cache |
| 61 | char* usernamecxx . . $ pvpgn/BnetSRP3#username.; |
| 62 | size_t username_lengthcxx . . $ pvpgn/BnetSRP3#username_length.; |
| 63 | char* passwordcxx . . $ pvpgn/BnetSRP3#password.; |
| 64 | size_t password_lengthcxx . . $ pvpgn/BnetSRP3#password_length.; |
| 65 | unsigned char raw_saltcxx . . $ pvpgn/BnetSRP3#raw_salt.[32]; |
| 66 | }; |
| 67 | |
| 68 | } |
| 69 | |
| 70 | #endif /* __BNET_SRP3_INCLUDED__ */ |