add static decrypt and encrypt methods
This commit is contained in:
@@ -68,11 +68,23 @@ namespace Pilz.Cryptography
|
||||
return DecryptStringFromBytes_Aes(Convert.FromBase64String(encryptedValue), GetKey(), GetIV());
|
||||
}
|
||||
|
||||
public static string Decrypt(string encryptedValue, string key, string iv)
|
||||
{
|
||||
var crypter = new AESStringCrypter(key, iv);
|
||||
return crypter.Decrypt(encryptedValue);
|
||||
}
|
||||
|
||||
public string Encrypt(string plainValue)
|
||||
{
|
||||
return Convert.ToBase64String(EncryptStringToBytes_Aes(plainValue, GetKey(), GetIV()));
|
||||
}
|
||||
|
||||
public static string Encrypt(string plainValue, string key, string iv)
|
||||
{
|
||||
var crypter = new AESStringCrypter(key, iv);
|
||||
return crypter.Encrypt(plainValue);
|
||||
}
|
||||
|
||||
private byte[] GetKey(bool createIfFail = false)
|
||||
{
|
||||
byte[] keyToUse;
|
||||
|
||||
Reference in New Issue
Block a user