C# 클래스 OpenStory.Cryptography.EndpointCrypto

Represents a base class for cryptographic packet transformation.
파일 보기 프로젝트 열기: shoftee/OpenStory 1 사용 예제들

공개 메소드들

메소드 설명
Client ( RollingIvFactory factory, byte clientIv, byte serverIv ) : EndpointCrypto

Creates a new instance of the EndpointCrypto class used for client-side cryptography.

Encryption uses the local IV, decryption uses the remote IV. Server's local IV has flipped version, Client's local IV has regular version.

Decrypt ( byte packet ) : void

Decrypts the given packet in-place.

The array will be modified directly.

EncryptAndPack ( byte packetData ) : byte[]

Encrypts a packet, constructs a header for it and packs them into a new array.

The array given as the packetData parameter is transformed in-place.

Server ( RollingIvFactory factory, byte clientIv, byte serverIv ) : EndpointCrypto

Creates a new instance of the EndpointCrypto class used for server-side cryptography.

Encryption uses the local IV, decryption uses the remote IV. Server's local IV has flipped version, Client's local IV has regular version.

TryGetLength ( byte header, int &length ) : bool

Attempts to extract the length of a packet from its header.

When overriding this method in a derived class, do not call the base implementation.

TryUnpackAndDecrypt ( byte rawData, byte &decryptedData ) : bool

Attempts to unpack the packet data from the given array and decrypt it.

This method will return if and only if the header was invalid.

비공개 메소드들

메소드 설명
ConstructHeader ( int length ) : byte[]

Constructs a packet header and encodes the given length in it.

When overriding this method in a derived class, do not call the base implementation.

EndpointCrypto ( RollingIv encryptor, RollingIv decryptor ) : System

Initializes a new instance of the EndpointCrypto class.

메소드 상세

Client() 공개 정적인 메소드

Creates a new instance of the EndpointCrypto class used for client-side cryptography.
Encryption uses the local IV, decryption uses the remote IV. Server's local IV has flipped version, Client's local IV has regular version.
public static Client ( RollingIvFactory factory, byte clientIv, byte serverIv ) : EndpointCrypto
factory RollingIvFactory The instance to use.
clientIv byte The IV for the client.
serverIv byte The IV for the server.
리턴 EndpointCrypto

Decrypt() 공개 메소드

Decrypts the given packet in-place.
The array will be modified directly.
public Decrypt ( byte packet ) : void
packet byte The data to decrypt.
리턴 void

EncryptAndPack() 공개 메소드

Encrypts a packet, constructs a header for it and packs them into a new array.
The array given as the packetData parameter is transformed in-place.
/// Thrown if is . ///
public EncryptAndPack ( byte packetData ) : byte[]
packetData byte The packet data to encrypt and pack.
리턴 byte[]

Server() 공개 정적인 메소드

Creates a new instance of the EndpointCrypto class used for server-side cryptography.
Encryption uses the local IV, decryption uses the remote IV. Server's local IV has flipped version, Client's local IV has regular version.
public static Server ( RollingIvFactory factory, byte clientIv, byte serverIv ) : EndpointCrypto
factory RollingIvFactory The instance to use.
clientIv byte The IV for the client.
serverIv byte The IV for the server.
리턴 EndpointCrypto

TryGetLength() 공개 메소드

Attempts to extract the length of a packet from its header.
When overriding this method in a derived class, do not call the base implementation.
public TryGetLength ( byte header, int &length ) : bool
header byte The header byte array to process.
length int A variable to hold the result.
리턴 bool

TryUnpackAndDecrypt() 공개 메소드

Attempts to unpack the packet data from the given array and decrypt it.
This method will return if and only if the header was invalid.
Thrown if is .
public TryUnpackAndDecrypt ( byte rawData, byte &decryptedData ) : bool
rawData byte The raw packet data.
decryptedData byte A reference to hold the decrypted data.
리턴 bool