Net Encryption Library
DecryptFile(EncryptionProvider,String,String,String) Method
Example 






KellermanSoftware.NetEncryptionLibrary Namespace > Encryption Class > DecryptFile Method : DecryptFile(EncryptionProvider,String,String,String) Method
The encryption algorithm to use
The encryption password
The encrypted file
The output decrypted file
Decrypt a text or binary file using the selected Decryption provider. The file will be base64 encoded.
Syntax
'Declaration
 
Public Overloads Function DecryptFile( _
   ByVal encryptionType As EncryptionProvider, _
   ByVal key As System.String, _
   ByVal inputFilePath As System.String, _
   ByVal outputFilePath As System.String _
) As System.Boolean
'Usage
 
Dim instance As Encryption
Dim encryptionType As EncryptionProvider
Dim key As System.String
Dim inputFilePath As System.String
Dim outputFilePath As System.String
Dim value As System.Boolean
 
value = instance.DecryptFile(encryptionType, key, inputFilePath, outputFilePath)
public System.bool DecryptFile( 
   EncryptionProvider encryptionType,
   System.string key,
   System.string inputFilePath,
   System.string outputFilePath
)
public function DecryptFile( 
    encryptionType: EncryptionProvider;
    key: System.String;
    inputFilePath: System.String;
    outputFilePath: System.String
): System.Boolean; 
public function DecryptFile( 
   encryptionType : EncryptionProvider,
   key : System.String,
   inputFilePath : System.String,
   outputFilePath : System.String
) : System.boolean;
public: System.bool DecryptFile( 
   EncryptionProvider encryptionType,
   System.string* key,
   System.string* inputFilePath,
   System.string* outputFilePath
) 
public:
System.bool DecryptFile( 
   EncryptionProvider encryptionType,
   System.String^ key,
   System.String^ inputFilePath,
   System.String^ outputFilePath
) 

Parameters

encryptionType
The encryption algorithm to use
key
The encryption password
inputFilePath
The encrypted file
outputFilePath
The output decrypted file
Example
Encryption encryption = new Encryption(); //Trial Mode
//Encryption encryption = new Encryption("place user name here", "place license key here"); //License Mode
 
File.WriteAllText("input.txt", "This is a test");
 
encryption.EncryptFile(EncryptionProvider.Rijndael, "My Password", "input.txt", "encrypted.txt");
 
bool decryptedSucessfully = encryption.DecryptFile(EncryptionProvider.Rijndael, "My Password", "encrypted.txt", "decrypted.txt");
 
Console.WriteLine("Decrypted successfully: {0}", decryptedSucessfully);
Dim encryption As New Encryption() 'Trial Mode
'Dim encryption As New Encryption("place user name here", "place license key here") 'License Mode
 
File.WriteAllText("input.txt", "This is a test")
 
encryption.EncryptFile(EncryptionProvider.Rijndael, "My Password", "input.txt", "encrypted.txt")
 
Dim decryptedSucessfully As Boolean = encryption.DecryptFile(EncryptionProvider.Rijndael, "My Password", "encrypted.txt", "decrypted.txt")
 
Console.WriteLine("Decrypted successfully: {0}", decryptedSucessfully)
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
Overload List