C# Класс SagaLib.Encryption

Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
StaticKey byte[]

Открытые методы

Метод Описание
Crypt ( string msg, byte key, bool encrypt ) : string

Encrypt/Decrypt a given message with a given key.

Decrypt ( byte data, int offset, byte key ) : byte[]

Decrypt a byte array with a given key.

Encrypt ( byte data, int offset, byte key ) : byte[]

Encrypt a byte array with a given key.

GenerateDecExpKey ( byte key ) : byte[]

Generate the expanded key that will be used during decryption.

GenerateKey ( ) : byte[]

Generate a random 16 bytes AES key.

Приватные методы

Метод Описание
Crypt ( byte data, int offset, byte orgkey, bool encrypt ) : byte[]
SwapBytes ( byte buffer, int len, int c ) : void

Описание методов

Crypt() публичный статический Метод

Encrypt/Decrypt a given message with a given key.
public static Crypt ( string msg, byte key, bool encrypt ) : string
msg string msg to encrypt/decrypt
key byte aes key to use
encrypt bool true: message will be encrypted. false: message will be decrypted.
Результат string

Decrypt() публичный статический Метод

Decrypt a byte array with a given key.
public static Decrypt ( byte data, int offset, byte key ) : byte[]
data byte bytes to decrypt
offset int
key byte aes key to use
Результат byte[]

Encrypt() публичный статический Метод

Encrypt a byte array with a given key.
public static Encrypt ( byte data, int offset, byte key ) : byte[]
data byte bytes to encrypt
offset int
key byte aes key to use
Результат byte[]

GenerateDecExpKey() публичный статический Метод

Generate the expanded key that will be used during decryption.
public static GenerateDecExpKey ( byte key ) : byte[]
key byte AES key to expand.
Результат byte[]

GenerateKey() публичный статический Метод

Generate a random 16 bytes AES key.
public static GenerateKey ( ) : byte[]
Результат byte[]

Описание свойств

StaticKey публичное статическое свойство

The static key is the key used to encrypt the first messages between client and server. In these messages a key exchange will take place which will be used for further communication.
public static byte[] StaticKey
Результат byte[]