CryptographyHelperEncryptT(T, String, Byte, Byte, Encoding) Method

Encrypts a string using the specified symmetric algorithm returning a base64 string.

Definition

Namespace: CoreMX.NET.Helpers
Assembly: CoreMX.NET (in CoreMX.NET.dll) Version: 1.0.0+7eb54d7f3459576d25646e9f286fb1fe49eac8a5
C#
public static string Encrypt<T>(
	this T encryptor,
	string plain,
	byte[] key,
	byte[] iv,
	Encoding? encoding = null
)
where T : SymmetricAlgorithm

Parameters

encryptor  T
The Instance of the Algorithm
plain  String
The Plain Text to encrypt
key  Byte
The Key to encrypt
iv  Byte
The IV to encrypt
encoding  Encoding  (Optional)
Encoding (Default UTF8)

Type Parameters

T
The Type of the SymmetricAlgorithm

Return Value

String

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type T. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

See Also