POT
POT
POT
Main menu

Download

Forum

SVN

Class: OTS_RSA

Source Location: /classes/OTS_RSA.php

Class OTS_RSA

Class Overview

Implements interfaces:

RSA encryption/decryption mechanism.

RSA encryption/decryption mechanism. This code bases in large part on Alexander Valyalkin'es Crypt_RSA's source code.

Located in /classes/OTS_RSA.php [line 28]



		
				Author(s):
		
Information Tags:
Version:  0.1.3
Version:  0.1.2
Since:  0.1.2

Methods

[ Top ]
Constant Summary
D  
OTSERV_D   OTServ key part.
OTSERV_P   OTServ key part.
OTSERV_Q   OTServ key part.
P  
Q  

[ Top ]
Method Summary
OTS_RSA   __construct()   Initializes new encryption session.
string   decrypt()   Decrypts RSA-encrypted message.
string   encrypt()   Ecnrypts message with RSA algorithm.

[ Top ]
Methods
Constructor __construct  [line 109]

  OTS_RSA __construct( [string $p = self::OTSERV_P], [string $q = self::OTSERV_Q], [string $d = self::OTSERV_D]  )

Initializes new encryption session.

Initializes new encryption session. If you won't pass any parameters default OTServ keys will be generated. It is recommended action for compatibility with oryginal Tibia servers and clients as well as default Open Tibia implementation.

Note: You must be sure your p, q and d values are proper for RSA keys generation as class won't change it for you.

Parameters:
string   $p:  Key part.
string   $q:  Key part.
string   $d:  Key part.

API Tags:
Access:  public

Information Tags:
Version:  0.1.2
Throws:  LogicException When BCMath extension is not loaded.
Since:  0.1.2

[ Top ]
decrypt  [line 169]

  string decrypt( string $message  )

Decrypts RSA-encrypted message.

Decrypts RSA-encrypted message. As OTServ clients use RSA encryption only for sending requests we don't need decryption here. If it will be needed, then this method will be implemented. At the moment it will throw exception.

Parameters:
string   $message:  RSA-encrypted message.

API Tags:
Return:  Decrypted content.
Access:  public

Information Tags:
Version:  0.1.2
Throws:  LogicException Always as this method is not implemented.
Since:  0.1.2

Implementation of:
IOTS_Cipher::decrypt()
Decrypts encrypted message.

[ Top ]
encrypt  [line 149]

  string encrypt( string $message  )

Ecnrypts message with RSA algorithm.

Ecnrypts message with RSA algorithm.

Parameters:
string   $message:  Message to be encrypted.

API Tags:
Return:  Encrypted message.
Access:  public

Information Tags:
Version:  0.1.2
Since:  0.1.2

Implementation of:
IOTS_Cipher::encrypt()
Ecnrypts message.

[ Top ]
Constants
D = self::OTSERV_D [line 63]

API Tags:
Deprecated:  0.1.3 Use OTS_RSA::OTSERV_D.

Information Tags:
Version:  0.1.2
Since:  0.1.2

[ Top ]
OTSERV_D = '46730330223584118622160180015036832148732986808519344675210555262940258739805766860224610646919605860206328024326703361630109888417839241959507572247284807035235569619173792292786907845791904955103601652822519121908367187885509270025388641700821735345222087940578381210879116823013776808975766851829020659073' [line 50]

OTServ key part.

OTServ key part.

Information Tags:
Version:  0.1.3
Version:  0.1.2
Since:  0.1.2
Since:  0.1.3

[ Top ]
OTSERV_P = '14299623962416399520070177382898895550795403345466153217470516082934737582776038882967213386204600674145392845853859217990626450972452084065728686565928113' [line 36]

OTServ key part.

OTServ key part.

Information Tags:
Version:  0.1.3
Version:  0.1.2
Since:  0.1.2
Since:  0.1.3

[ Top ]
OTSERV_Q = '7630979195970404721891201847792002125535401292779123937207447574596692788513647179235335529307251350570728407373705564708871762033017096809910315212884101' [line 43]

OTServ key part.

OTServ key part.

Information Tags:
Version:  0.1.3
Version:  0.1.2
Since:  0.1.2
Since:  0.1.3

[ Top ]
P = self::OTSERV_P [line 55]

API Tags:
Deprecated:  0.1.3 Use OTS_RSA::OTSERV_P.

Information Tags:
Version:  0.1.2
Since:  0.1.2

[ Top ]
Q = self::OTSERV_Q [line 59]

API Tags:
Deprecated:  0.1.3 Use OTS_RSA::OTSERV_Q.

Information Tags:
Version:  0.1.2
Since:  0.1.2

[ Top ]