C# Class Yea.Encryption.RSAEncryption

Utility class for doing RSA Encryption
Afficher le fichier Open project: OxPatient/Rule-Engine

Méthodes publiques

Méthode 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 méthode

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

Decrypt() public static méthode

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)
Résultat string

Encrypt() public static méthode

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)
Résultat string

SignHash() public static méthode

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)
Résultat string

VerifyHash() public static méthode

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
Résultat bool