C# Examples

ChilkatHOMEAndroid™ASPVisual BasicVB.NETC#iOS (IPhone)Objective-CC++CUnicode C++Unicode CMFCDelphi DLLDelphi ActiveXFoxProJavaPerlPHP ExtensionPHP ActiveXPythonPowerShellRubySQL ServerVBScript

C# Examples

Bounced Mail
Bz2
Character Encoding
CSV
DKIM / DomainKey
Digital Certificates
Digital Signatures
Email
Email Object
FTP
HTML Conversion
HTTP
IMAP
Encryption
MHT / HTML Email
MIME
POP3
RSA
S/MIME
SMTP
Socket
Spider
SSH
SSH Tunnel
SSH Key
SFTP
Tar Archive
Upload
XML
XMP
Zip Compression


More Examples...
Amazon S3
NTLM
FileAccess
RSS
Atom
String
Byte Array
Self-Extractor
Service
PPMD
Deflate
DH Key Exchange
DSA
Bzip2
LZW

 

 

 

 

 

 

Encrypt ANSI / Unicode Strings

Download: Chilkat .NET Assemblies

This example demonstrates two ways to encrypt strings. The first encrypts a a Unicode string (2 bytes per character) while the second encrypts ANSI string (1 byte per character) .

NOTE: This example uses the Chilkat.Crypt class, not Chilkat.Crypt2

		private void button2_Click(object sender, System.EventArgs e)
		{
			// Setup the encryption object for 128-bit AES encryption.
			Chilkat.Crypt crypt = new Chilkat.Crypt();
			crypt.UnlockComponent("UnlockCode");
			crypt.SetAlgorithmRijndael();
			crypt.KeyLength = 128;
			crypt.SetSecretKeyViaPassPhrase("myPassword");
 
			// Encrypt Unicode characters (2 bytes per character)
			System.Text.UnicodeEncoding enc = new System.Text.UnicodeEncoding();
			byte [] dBytes = enc.GetBytes("This is a test");
			byte [] encryptedBytes = crypt.Encrypt(dBytes);
			textBox1.Text = crypt.EncodeBase64(encryptedBytes);   

			// Encrypt an ANSI string (1 byte per character)
			textBox2.Text = crypt.EncodeBase64(crypt.EncryptStr("This is a test"));

		}

 

 

 

© 2000-2013 Chilkat Software, Inc. All Rights Reserved.