View source
From Iris2
for
Encryption
Jump to:
navigation
,
search
= Ultima Online Protocol= Backup from: Keirs packet guide ([www.kairtech.com/uo/info/encryption.htm]) == Loginserver Packet Encryption == Ultima Online packets are encrypted in two ways: the first, during the login process; the second, during regular gameplay. The first encryption method is a simple algorithm which (I assume) was developed by Origin. The login encryption requires an encryption seed and two keys which can be found in the client and change now and then with client patches. Each client also needs a pair of keys which are initialized using the formula below: <pre> uint CurrentKey0; uint CurrentKey1; uint EncryptionSeed; // Set EncryptionSeed CurrentKey0 = (uint)((((~EncryptionSeed) ^ 0x00001357) << 16) | ((EncryptionSeed ^ 0xFFFFAAAA) & 0x0000FFFF)); CurrentKey1 = (uint)(((EncryptionSeed ^ 0x43210000) >> 16) | (((~EncryptionSeed) ^ 0xABCDFFFF) & 0xFFFF0000)); </pre> After receiving data from a client, you can decrypt or encrypt it using the following method: <pre> static uint FirstClientKey; // Set this to the first client key (not CurrentKey0). static uint SecondClientKey; // Set this to the second client key (not CurrentKey1). void Crypt(ref byte[] data) { int len = data.Length; for(int i = 0; i < len; i++) { // Decrypt the byte: data[i] = (byte)(CurrentKey0 ^ data[i]); // Reset the keys: uint oldkey0 = CurrentKey0; uint oldkey1 = CurrentKey1; CurrentKey0 = (uint)(((oldkey0 >> 1) | (oldkey1 << 31)) ^ SecondClientKey); CurrentKey1 = (uint)(((((oldkey1 >> 1) | (oldkey0 << 31)) ^ (FirstClientKey - 1)) >> 1) | (oldkey0 << 31)) ^ FirstClientKey); } } </pre> FirstClientKey and SecondClientKey refer to the two encryption keys found within the client. The location and values of these keys change from time to time. In Athena, known client keys are kept in the key configuration file. The 4.0.2a client keys are 0x2E63ADDD and 0xA225227F. == Gameserver Packet Encryption == The second encryption method is used after the client is redirected to a game server via the 0x8C packet and is usually used first with the game server login packet, 0x91. The second encryption is a bit more complex and uses the TwoFish encryption method in modern clients, and the BlowFish encryption method in old clients. Since most emulators require modern clients, the BlowFish method will not be discussed here. The second method of encryption is not currently supported by Athena. Supporting gameplay encryption is one of the long-term goals of Athena, and when a method is created for decrypting this encryption it will hopefully be detailed here.
Return to
Encryption
.
Views
Page
Discussion
View source
History
Personal tools
Log in
main
Main Page
Screenshots
download
Install Guide
Forum
FAQ
Macros
Credits
dev
Developer Blog
A Guide for Artists
Development
Item Model List
Iris-Testshard
Bugreports
SvnLog
API C++
API Lua
wiki
Recent changes
Random page
Help
Search
Toolbox
What links here
Related changes
Special pages