CryptographyEncryptT Method (String, String) |
Encrypt the specified string value
with the specified password,
using a SymmetricAlgorithm.
Namespace:
AskiaPortalCmn.Security
Assembly:
AskiaPortalCmn (in AskiaPortalCmn.dll) Version: 1.7.0-build068
Syntax public static string Encrypt<T>(
string value,
string password
)
where T : new(), SymmetricAlgorithm
Public Shared Function Encrypt(Of T As {New, SymmetricAlgorithm}) (
value As String,
password As String
) As String
public:
generic<typename T>
where T : gcnew(), SymmetricAlgorithm
static String^ Encrypt(
String^ value,
String^ password
)
Parameters
- value
- Type: SystemString
String to encrypt. - password
- Type: SystemString
Password used to encrypt/decrypt the string.
Type Parameters
- T
- SymmetricAlgorithm class to use, such as:
- AesManaged
- RijndaelManaged
- DESCryptoServiceProvider
- RC2CryptoServiceProvider
- TripleDESCryptoServiceProvider
Return Value
Type:
StringEncrypted string.
Examples
Example of usage.
Based on http://stackoverflow.com/a/14286740/2134982
string encrypted = Cryptography.Encrypt<RijndaelManaged>(dataToEncrypt, password);
string decrypted = Cryptography.Decrypt<RijndaelManaged>(encrypted, password);
See Also