Net Encryption Library
EncryptString Method
Example 






KellermanSoftware.NetEncryptionLibrary Namespace > Encryption Class : EncryptString Method
The encryption algorithm to use
The encryption password
The string to encrypt
Encrypt and return a base64 encoded string
Syntax
'Declaration
 
Public Function EncryptString( _
   ByVal encryptionType As EncryptionProvider, _
   ByVal key As System.String, _
   ByVal input As System.String _
) As System.String
'Usage
 
Dim instance As Encryption
Dim encryptionType As EncryptionProvider
Dim key As System.String
Dim input As System.String
Dim value As System.String
 
value = instance.EncryptString(encryptionType, key, input)
public System.string EncryptString( 
   EncryptionProvider encryptionType,
   System.string key,
   System.string input
)
public function EncryptString( 
    encryptionType: EncryptionProvider;
    key: System.String;
    input: System.String
): System.String; 
public function EncryptString( 
   encryptionType : EncryptionProvider,
   key : System.String,
   input : System.String
) : System.String;
public: System.string* EncryptString( 
   EncryptionProvider encryptionType,
   System.string* key,
   System.string* input
) 
public:
System.String^ EncryptString( 
   EncryptionProvider encryptionType,
   System.String^ key,
   System.String^ input
) 

Parameters

encryptionType
The encryption algorithm to use
key
The encryption password
input
The string to encrypt
Example
Encryption encryption = new Encryption(); //Trial Mode
//Encryption encryption = new Encryption("place user name here", "place license key here"); //License Mode
 
const string password = "MyPassword";
const string unencryptedString = "This is the input";
Console.WriteLine("The unencrypted string: {0}", unencryptedString);
 
string encryptedString = encryption.EncryptString(EncryptionProvider.Rijndael, password, unencryptedString);
Console.WriteLine("The encrypted string: {0}", encryptedString);
 
string decryptedString = encryption.DecryptString(EncryptionProvider.Rijndael, password, encryptedString);
Console.WriteLine("The deencrypted string: {0}", decryptedString);
Dim encryption As New Encryption() 'Trial Mode
'Dim encryption As New Encryption("place user name here", "place license key here") 'License Mode
 
Const password As String = "MyPassword"
Const unencryptedString As String = "This is the input"
Console.WriteLine("The unencrypted string: {0}", unencryptedString)
 
Dim encryptedString As String = encryption.EncryptString(EncryptionProvider.Rijndael, password, unencryptedString)
Console.WriteLine("The encrypted string: {0}", encryptedString)
 
Dim decryptedString As String = encryption.DecryptString(EncryptionProvider.Rijndael, password, encryptedString)
Console.WriteLine("The deencrypted string: {0}", decryptedString)
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

Encryption Class
Encryption Members