// Copyright (C) 2007-2025 EQ2EMulator // Licensed under GPL v3 #pragma once #include #include #include #include "rc4.h" #include "../types.h" class Crypto { public: Crypto() noexcept = default; ~Crypto() = default; static int64 RSADecrypt(uchar* text, int16 size) noexcept; void RC4Encrypt(uchar* text, int32 size) noexcept; void RC4Decrypt(uchar* text, int32 size) noexcept; [[nodiscard]] int64 getRC4Key() const noexcept { return rc4_key; } void setRC4Key(int64 key) noexcept; [[nodiscard]] bool isEncrypted() const noexcept { return encrypted; } void setEncrypted(bool in_val) noexcept { encrypted = in_val; } private: std::unique_ptr server{}; std::unique_ptr client{}; bool encrypted{false}; int64 rc4_key{0}; std::mutex m_crypto_mutex{}; };