C# Class Yea.Encryption.RSAEncryption

Utility class for doing RSA Encryption
ファイルを表示 Open project: OxPatient/Rule-Engine

Public Methods

Method Description
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

Takes a string and creates a signed hash of it

VerifyHash ( string hash, string signedHash, string key ) : bool

Verifies a signed hash against the unsigned version

Method Details

CreateKey() public static method

Creates a new set of keys
public static CreateKey ( bool privatePublic ) : string
privatePublic bool True if private key should be included, false otherwise
return string

Decrypt() public static method

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)
return string

Encrypt() public static method

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)
return string

SignHash() public static method

Takes a string and creates a signed hash of it
public static SignHash ( string input, string key, string &hash, Encoding encodingUsing = null ) : 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)
return string

VerifyHash() public static method

Verifies a signed hash against the unsigned version
public static VerifyHash ( string hash, string signedHash, string key ) : 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
return bool