C# Класс Utilities.Cryptography.RSAEncryption

Utility class for doing RSA Encryption
Показать файл Открыть проект

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

Метод Описание
CreateKey ( bool privatePublic ) : string

Creates a new set of keys

Decrypt ( string input, string key, Encoding encodingUsing = null ) : string

Decrypts a string using RSA

Encrypt ( string input, string key, Encoding encodingUsing = null ) : string

Encrypts a string using RSA

SignHash ( string input, string key, string &hash, Encoding encodingUsing = null, string hashIdentifer = "SHA1" ) : string

Takes a string and creates a signed hash of it

VerifyHash ( string hash, string signedHash, string key, string hashIdentifer = "SHA1" ) : bool

Verifies a signed hash against the unsigned version

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

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

Creates a new set of keys
public static CreateKey ( bool privatePublic ) : string
privatePublic bool True if private key should be included, false otherwise
Результат string

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

Decrypts a string using RSA
public static Decrypt ( string input, string key, Encoding encodingUsing = null ) : string
input string Input string (should be small as anything over 128 bytes can not be decrypted)
key string Key to use for decryption
encodingUsing System.Text.Encoding Encoding that the result should use (defaults to UTF8)
Результат string

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

Encrypts a string using RSA
public static Encrypt ( string input, string key, Encoding encodingUsing = null ) : string
input string Input string (should be small as anything over 128 bytes can not be decrypted)
key string Key to use for encryption
encodingUsing System.Text.Encoding Encoding that the input string uses (defaults to UTF8)
Результат string

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

Takes a string and creates a signed hash of it
public static SignHash ( string input, string key, string &hash, Encoding encodingUsing = null, string hashIdentifer = "SHA1" ) : string
input string Input string
key string Key to encrypt/sign with
hash string This will be filled with the unsigned hash
encodingUsing System.Text.Encoding Encoding that the input is using (defaults to UTF8)
hashIdentifer string The id of the hash algorithm used (default SHA1)
Результат string

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

Verifies a signed hash against the unsigned version
public static VerifyHash ( string hash, string signedHash, string key, string hashIdentifer = "SHA1" ) : bool
hash string The unsigned hash (should be 64bit string)
signedHash string The signed hash (should be 64bit string)
key string The key to use in decryption
hashIdentifer string The id of the hash algorithm used (default SHA1)
Результат bool