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






KellermanSoftware.NetEncryptionLibrary Namespace > Encryption Class > DecryptFile Method : DecryptFile(EncryptionProvider,String,String,String,Boolean) Method
The encryption algorithm to use
The encryption password
The encrypted file
The output decrypted file
If true, the file is base64 encoded
Decrypt a text or binary file using the selected Decryption provider
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, _
   ByVal useBase64 As System.Boolean _
) 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 useBase64 As System.Boolean
Dim value As System.Boolean
 
value = instance.DecryptFile(encryptionType, key, inputFilePath, outputFilePath, useBase64)
public System.bool DecryptFile( 
   EncryptionProvider encryptionType,
   System.string key,
   System.string inputFilePath,
   System.string outputFilePath,
   System.bool useBase64
)
public function DecryptFile( 
    encryptionType: EncryptionProvider;
    key: System.String;
    inputFilePath: System.String;
    outputFilePath: System.String;
    useBase64: System.Boolean
): System.Boolean; 
public function DecryptFile( 
   encryptionType : EncryptionProvider,
   key : System.String,
   inputFilePath : System.String,
   outputFilePath : System.String,
   useBase64 : System.boolean
) : System.boolean;
public: System.bool DecryptFile( 
   EncryptionProvider encryptionType,
   System.string* key,
   System.string* inputFilePath,
   System.string* outputFilePath,
   System.bool useBase64
) 
public:
System.bool DecryptFile( 
   EncryptionProvider encryptionType,
   System.String^ key,
   System.String^ inputFilePath,
   System.String^ outputFilePath,
   System.bool useBase64
) 

Parameters

encryptionType
The encryption algorithm to use
key
The encryption password
inputFilePath
The encrypted file
outputFilePath
The output decrypted file
useBase64
If true, the file is base64 encoded
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", false);
 
bool decryptedSucessfully = encryption.DecryptFile(EncryptionProvider.Rijndael, "My Password", "encrypted.txt", "decrypted.txt", false);
 
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", False)
 
Dim decryptedSucessfully As Boolean = encryption.DecryptFile(EncryptionProvider.Rijndael, "My Password", "encrypted.txt", "decrypted.txt", False)
 
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