C# Класс SebWindowsClient.CryptographyUtils.AESThenHMAC

Class for encrypting and decrypting with AES and HMAC, compatible with RNCryptor on Mac OS X and iOS.
Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
BlockBitSize int
Iterations int
KeyBitSize int
MinPasswordLength int
SaltBitSize int

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

Метод Описание
NewKey ( ) : byte[]

Helper that generates a random key on each call.

SimpleDecrypt ( byte encryptedMessage, byte cryptKey, byte authKey, int nonSecretPayloadLength ) : byte[]
SimpleDecrypt ( string encryptedMessage, byte cryptKey, byte authKey, int nonSecretPayloadLength ) : string

Simple Authentication (HMAC) then Decryption (AES) for a secrets UTF8 Message.

SimpleDecryptWithPassword ( byte encryptedMessage, string password, int nonSecretPayloadLength ) : byte[]
SimpleDecryptWithPassword ( string encryptedMessage, string password, int nonSecretPayloadLength ) : string

Simple Authentication (HMAC) and then Descryption (AES) of a UTF8 Message using keys derived from a password (PBKDF2).

Significantly less secure than using random binary keys.

SimpleEncrypt ( byte secretMessage, byte cryptKey, byte authKey, byte nonSecretPayload = null ) : byte[]
SimpleEncrypt ( string secretMessage, byte cryptKey, byte authKey, byte nonSecretPayload = null ) : string

Simple Encryption (AES) then Authentication (HMAC) for a UTF8 Message.

Adds overhead of (Optional-Payload + BlockSize(16) + Message-Padded-To-Blocksize + HMac-Tag(32)) * 1.33 Base64

SimpleEncryptWithPassword ( byte secretMessage, string password, byte nonSecretPayload = null ) : byte[]
SimpleEncryptWithPassword ( string secretMessage, string password, byte nonSecretPayload = null ) : string

Simple Encryption (AES) then Authentication (HMAC) of a UTF8 message using Keys derived from a Password (PBKDF2).

Significantly less secure than using random binary keys. Adds additional non secret payload for key generation parameters.

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

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

Helper that generates a random key on each call.
public static NewKey ( ) : byte[]
Результат byte[]

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

public static SimpleDecrypt ( byte encryptedMessage, byte cryptKey, byte authKey, int nonSecretPayloadLength ) : byte[]
encryptedMessage byte
cryptKey byte
authKey byte
nonSecretPayloadLength int
Результат byte[]

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

Simple Authentication (HMAC) then Decryption (AES) for a secrets UTF8 Message.
Encrypted Message Required!;encryptedMessage
public static SimpleDecrypt ( string encryptedMessage, byte cryptKey, byte authKey, int nonSecretPayloadLength ) : string
encryptedMessage string The encrypted message.
cryptKey byte The crypt key.
authKey byte The auth key.
nonSecretPayloadLength int Length of the non secret payload.
Результат string

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

public static SimpleDecryptWithPassword ( byte encryptedMessage, string password, int nonSecretPayloadLength ) : byte[]
encryptedMessage byte
password string
nonSecretPayloadLength int
Результат byte[]

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

Simple Authentication (HMAC) and then Descryption (AES) of a UTF8 Message using keys derived from a password (PBKDF2).
Significantly less secure than using random binary keys.
Encrypted Message Required!;encryptedMessage
public static SimpleDecryptWithPassword ( string encryptedMessage, string password, int nonSecretPayloadLength ) : string
encryptedMessage string The encrypted message.
password string The password.
nonSecretPayloadLength int Length of the non secret payload.
Результат string

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

public static SimpleEncrypt ( byte secretMessage, byte cryptKey, byte authKey, byte nonSecretPayload = null ) : byte[]
secretMessage byte
cryptKey byte
authKey byte
nonSecretPayload byte
Результат byte[]

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

Simple Encryption (AES) then Authentication (HMAC) for a UTF8 Message.
Adds overhead of (Optional-Payload + BlockSize(16) + Message-Padded-To-Blocksize + HMac-Tag(32)) * 1.33 Base64
Secret Message Required!;secretMessage
public static SimpleEncrypt ( string secretMessage, byte cryptKey, byte authKey, byte nonSecretPayload = null ) : string
secretMessage string The secret message.
cryptKey byte The crypt key.
authKey byte The auth key.
nonSecretPayload byte (Optional) Non-Secret Payload.
Результат string

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

public static SimpleEncryptWithPassword ( byte secretMessage, string password, byte nonSecretPayload = null ) : byte[]
secretMessage byte
password string
nonSecretPayload byte
Результат byte[]

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

Simple Encryption (AES) then Authentication (HMAC) of a UTF8 message using Keys derived from a Password (PBKDF2).
Significantly less secure than using random binary keys. Adds additional non secret payload for key generation parameters.
password
public static SimpleEncryptWithPassword ( string secretMessage, string password, byte nonSecretPayload = null ) : string
secretMessage string The secret message.
password string The password.
nonSecretPayload byte The non secret payload.
Результат string

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

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

public static int BlockBitSize
Результат int

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

public static int Iterations
Результат int

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

public static int KeyBitSize
Результат int

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

public static int MinPasswordLength
Результат int

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

public static int SaltBitSize
Результат int