SolFSStorage.SetFileEncryption method


Pascal    Plain C    C++ (DLL/Lib)    C++ (VCL)    C++ (.NET)    C#    VB.NET    Java 

SolFSStorage     See also    


Encrypts or decrypts file.


    procedure SetFileEncryption(const FileName: TSolFSString; Encryption: TSolFSEncryption; OldPassword, NewPassword: String);

[Plain C]
    long _stdcall StorageSetFileEncryption(unsigned long Storage, const wchar_t* FileName, unsigned long Encryption, wchar_t* OldPassword, unsigned long OldPasswordLen, wchar_t* NewPassword, unsigned long NewPasswordLen);

[C++ (DLL/Lib)]
    void SetFileEncryption(const unsigned short * FileName, SolFSEncryption Encryption, unsigned short * OldPassword, unsigned short * NewPassword);

[C++ (VCL)]
    void __fastcall SetFileEncryption(const TSolFSString FileName, TSolFSEncryption Encryption, TSolFSString OldPassword, TSolFSString NewPassword);

[C++ (.NET)]
    void SetFileEncryption( String *fileName, SolFSEncryption encryption, String *oldPassword, String *newPassword )

    void SetFileEncryption( String fileName, SolFSEncryption encryption, String oldPassword, String newPassword )

    Sub SetFileEncryption(ByVal fileName As String, ByVal encryption As SolFSEncryption, ByVal oldPassword As String, ByVal newPassword As String)

    void setFileEncryption( String fileName, SolFSEncryption encryption, String oldPassword, String newPassword)


  • FileName - the full file name in the storage
  • Encryption - new encryption mode.
  • OldPassword - current encryption password if the file is encrypted or the empty string otherwise.
  • NewPassword - the password to be used with new encryption mode (if any).
  • [Plain C] Storage - handle to the storage returned by Create or Open function.
  • [Plain C] OldPasswordLen - length of the old password in bytes (not counting the ending NULL).
  • [Plain C] NewPasswordLen - length of the new password in bytes (not counting the ending NULL).

Values of SolFSEncryption

[Plain C]  Return values

0 if the function succeeded or one of Error codes if the function failed.


Use SetFileEncryption to encrypt or decrypt the file.

If you use custom encryption, you must provide handlers for OnDataEncrypt, OnDataDecrypt, OnHashValidate and OnHashCalculate events.

See also