Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
|
Encrypt a File using 128-bit Rijndael
This is a much better C# File-to-File Encryption example Chilkat.Crypt2 c2 = new Chilkat.Crypt2(); c2.UnlockComponent("unlockCode"); // Set the encryption parameters. c2.CryptAlgorithm = "rijndael"; c2.SecretKey = c2.GenerateSecretKey("myPassword"); c2.KeyLength = 256; // The ReadFile and WriteFile methods are convenience methods // for reading/writing the contents of an entire file into a byte array. byte [] gifData = c2.ReadFile("dude.gif"); byte [] encryptedData = c2.EncryptBytes(gifData); c2.WriteFile("encrypted.dat",encryptedData); // Create a separate object for decryption Chilkat.Crypt2 c2a = new Chilkat.Crypt2(); // The parameters must match... c2a.CryptAlgorithm = "rijndael"; c2a.SecretKey = c2.GenerateSecretKey("myPassword"); c2a.KeyLength = 256; byte [] encryptedData2 = c2a.ReadFile("encrypted.dat"); byte [] gifData2 = c2a.DecryptBytes(encryptedData2); c2a.WriteFile("dude2.gif",gifData2);
|
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2008 Chilkat Software, Inc. All Rights Reserved.