Documentation ¶
Index ¶
- Variables
- type WrathHeader
- func (h *WrathHeader) Decrypt(data []byte) error
- func (h *WrathHeader) Encode(opcode uint16, size uint32) ([]byte, error)
- func (h *WrathHeader) Encrypt(data []byte) error
- func (h *WrathHeader) Init(sessionKey []byte) error
- func (h *WrathHeader) InitKeys(sessionKey, decryptKey, encryptKey []byte) error
Constants ¶
This section is empty.
Variables ¶
var ( ErrCryptoNotInitialized = errors.New("srp/header: header crypto has not been initialized") ErrHeaderSizeTooLarge = errors.New("srp/header: header size is too large") )
Functions ¶
This section is empty.
Types ¶
type WrathHeader ¶
type WrathHeader struct {
// contains filtered or unexported fields
}
WrathHeader is used for encrypting/decrypting world packet headers in WotLK. Once the client has authenticated, all incoming/outgoing headers must be encrypted.
func (*WrathHeader) Decrypt ¶
func (h *WrathHeader) Decrypt(data []byte) error
Decrypt decrypts a client header in-place. If the decrypt cipher is not initialized, Decrypt returns ErrCryptoNotInitialized. Decrypt is safe to use concurrently. Client packet headers must be decrypted once the client has authenticated with the world/realm server.
func (*WrathHeader) Encode ¶
func (h *WrathHeader) Encode(opcode uint16, size uint32) ([]byte, error)
Encode returns a header with opcode and size. Encode expects size to not include the 2 bytes for the opcode, and will add +2 to size. In WotLK, server headers can be either 4 or 5 bytes. Headers will automatically be encrypted if [Init] was called.
func (*WrathHeader) Encrypt ¶
func (h *WrathHeader) Encrypt(data []byte) error
Encrypt encrypts a server header in-place. If the encrypt cipher is not initialized, Encrypt returns ErrCryptoNotInitialized. Encrypt is safe to use concurrently. Server packet headers must be encrypted once the client has authenticated with the world/realm server. [Encode] will call Encrypt once [Init] has been called.
func (*WrathHeader) Init ¶
func (h *WrathHeader) Init(sessionKey []byte) error
Init sets up the ciphers using sessionKey. Init must be called before trying to use [Encrypt] or [Decrypt].
func (*WrathHeader) InitKeys ¶
func (h *WrathHeader) InitKeys(sessionKey, decryptKey, encryptKey []byte) error
InitKeys initializes the ciphers. [Init] should be used instead, unless for some reason different keys are needed.