Documentation ¶
Overview ¶
World of Warcraft cryptography modules. WoWCrypt for packet header encryption in the world server, and SRP6 for auth server authentication.
Index ¶
- Constants
- Variables
- func AuthSessionProof(accountName string, serverSeed, clientSeed []byte, sessionKey []byte) []byte
- func CalculateServerProof(A, M, K *big.Int) *big.Int
- func Hash(parts ...[]byte) []byte
- type SRP6
- func (s *SRP6) CalculateClientSessionKey(salt, B *big.Int, I, P string) (*big.Int, *big.Int)
- func (s *SRP6) CalculateServerSessionKey(A, v, salt *big.Int, accountName string) (*big.Int, *big.Int)
- func (s *SRP6) G() *big.Int
- func (s *SRP6) GValue() int64
- func (s *SRP6) GenerateClientPubkey() *big.Int
- func (s *SRP6) GenerateServerPubKey(v *big.Int) *big.Int
- func (s *SRP6) GenerateVerifier(accountName, password string, salt *big.Int) *big.Int
- func (s *SRP6) N() *big.Int
- func (s *SRP6) RandomSalt() *big.Int
- func (s *SRP6) RandomScrambling(A, B *big.Int) *big.Int
- func (s *SRP6) SetServerPrivateKey(val string)
- type WowCrypt
Constants ¶
const CryptRecvLength = 6
CryptRecvLength the length of the cryptable header.
const CryptSendLength = 4
CryptSendLength the length of the outbound cryptable header.
Variables ¶
var ErrSizeNotMach = errors.New("digest size is not 20 bytes long")
ErrSizeNotMach the error when the digest size is not 20 bytes long.
Functions ¶
func AuthSessionProof ¶
Generates verifier hash and client seed.
func CalculateServerProof ¶
CalculateServerProof will calculate a proof to send back to the client so they know we are a legit server.
Types ¶
type SRP6 ¶
type SRP6 struct { // Client private (a) and public (A) key A *big.Int // Server private (b) and public (B) key B *big.Int // contains filtered or unexported fields }
The Secure Remote Password protocol (SRP) is an augmented password-authenticated key exchange (PAKE) protocol, specifically designed to work around existing patents.
func (*SRP6) CalculateClientSessionKey ¶
func (*SRP6) CalculateServerSessionKey ¶
func (s *SRP6) CalculateServerSessionKey(A, v, salt *big.Int, accountName string) (*big.Int, *big.Int)
CalculateServerSessionKey takes as input the client's proof and calculates the persistent session key. The function parameters are:
- A: Client's public key
- v: user's verifier
- salt: user's generated salt
- accountName: user's accout name or email
The two return values are:
K - Caclulated session key M - Proof verification
func (*SRP6) GenerateClientPubkey ¶
GenerateClientPubkey generates a client public key for the SRP6 struct.
This function does not take any parameters. It returns a pointer to a big.Int.
func (*SRP6) GenerateServerPubKey ¶
GenerateServerPubKey generates a public ephemeral pair (B, b) given a user's verifier. The private key stored in this instance for later use.
func (*SRP6) GenerateVerifier ¶
GenerateVerifier will generate a hash of the account name, password and salt which can be used as the SRP verifier.
func (*SRP6) RandomSalt ¶
func (*SRP6) SetServerPrivateKey ¶
SetServerPrivateKey sets server's private key. This is useful for testing purposes only. Use GenerateServerPubkey when it's possible! The val parameter should be a valid DECIMAL string.
type WowCrypt ¶
type WowCrypt struct {
// contains filtered or unexported fields
}
WowCrypt is a wrapper for rc4 ciphers. This crypter can be initialized with NewWowcrypt constructor.
func NewClientWoWCrypt ¶
NewClientWoWCrypt initializes a client side crypter. The only difference from the server crypter is the encoder/decoder key setup.
func NewServerWowcrypt ¶
NewServerWowcrypt initializes the wow packet header crypter. The key should be the session key The session key should be 40 bytes long. which has been created on the auth session packet. The default skip for WOTLK client is 1024.