Move RSA class to Crypt

This commit is contained in:
Henrique Santiago
2012-08-04 10:54:35 -03:00
parent fa15c25951
commit fb7ab21e71
15 changed files with 120 additions and 159 deletions

View File

@@ -1,4 +1,4 @@
local currentRsa = OTSERV_RSA
local currentRsa
function g_game.getRsa()
return currentRsa
@@ -6,14 +6,17 @@ end
function g_game.chooseRsa(host)
if host:match('.*\.tibia\.com') or host:match('.*\.cipsoft\.com') then
currentRsa = CIPSOFT_RSA
g_game.setRsa(CIPSOFT_RSA)
else
currentRsa = OTSERV_RSA
g_game.setRsa(OTSERV_RSA)
end
end
function g_game.setRsa(rsa)
currentRsa = rsa
if currentRsa ~= rsa then
currentRsa = rsa
g_crypt.rsaSetPublicKey(currentRsa, '65537')
end
end
function g_game.isOfficialTibia()
@@ -45,3 +48,4 @@ function g_game.getSupportedProtocols()
}
end
g_game.setRsa(OTSERV_RSA)

View File

@@ -65,7 +65,7 @@ function ProtocolLogin:sendLoginPacket()
end
msg:addPaddingBytes(paddingBytes, 0)
msg:encryptRsa(128, g_game.getRsa())
msg:encryptRsa(128)
self:send(msg)
self:enableXteaEncryption()