C# Class OpenStory.Cryptography.RollingIv

Represents an AES encryption transformer.
Afficher le fichier Open project: shoftee/OpenStory Class Usage Examples

Méthodes publiques

Méthode Description
ConstructHeader ( int length ) : byte[]

Constructs a packet header.

GetPacketLength ( byte header ) : int

Reads a packet header from an array and extracts the packet's length.

GetVersion ( byte header, byte iv ) : ushort

Extracts a version from the header using a specified IV.

RollingIv ( ICryptoAlgorithm algorithm, byte initialIv, ushort versionMask ) : System

Initializes a new instance of the RollingIv class.

Transform ( byte data ) : void

Transforms the specified data in-place.

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.

ValidateHeader ( byte header ) : bool

Determines whether the start of an array is a valid packet header.

Private Methods

Méthode Description
GetVersionInternal ( byte header, byte iv ) : ushort
ValidateHeaderInternal ( byte header, byte iv, ushort versionMask ) : bool

Method Details

ConstructHeader() public méthode

Constructs a packet header.
/// Thrown if is less than 2. ///
public ConstructHeader ( int length ) : byte[]
length int The length of the packet to make a header for.
Résultat byte[]

GetPacketLength() public static méthode

Reads a packet header from an array and extracts the packet's length.
/// Thrown if is . /// /// Thrown if has less than 4 elements. ///
public static GetPacketLength ( byte header ) : int
header byte The array to read from.
Résultat int

GetVersion() public static méthode

Extracts a version from the header using a specified IV.
/// Thrown if /// or are . /// /// Thrown if has less than 4 elements or /// if doesn't have exactly 4 elements. ///
public static GetVersion ( byte header, byte iv ) : ushort
header byte The header byte array.
iv byte The IV to use for the decoding.
Résultat ushort

RollingIv() public méthode

Initializes a new instance of the RollingIv class.
/// Thrown if or is . /// /// Thrown if does not have exactly 4 elements. ///
public RollingIv ( ICryptoAlgorithm algorithm, byte initialIv, ushort versionMask ) : System
algorithm ICryptoAlgorithm The instance for this session.
initialIv byte The initial IV for this instance.
versionMask ushort The version mask used for header creation.
Résultat System

Transform() public méthode

Transforms the specified data in-place.
Thrown if is .
public Transform ( byte data ) : void
data byte The array to transform. This array will be directly modified.
Résultat void

TryGetLength() public méthode

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.
/// Thrown if is . /// /// Thrown if has less than 4 elements. ///
public TryGetLength ( byte header, int &length ) : bool
header byte The header byte array to process.
length int A variable to hold the result.
Résultat bool

ValidateHeader() public méthode

Determines whether the start of an array is a valid packet header.
public ValidateHeader ( byte header ) : bool
header byte The raw packet data to validate.
Résultat bool