EncryptFileA

Security and Signatures

Description

結尾的 A 表示 ANSI(char)DLL 進入點;ActiveX/COM 介面只提供 Unicode 形式。行為與 EncryptFile 完全相同,字串參數依目前 SetAnsiMode 的字碼頁解讀

加密磁碟上的檔案並將結果存成新檔。整份文件不必載入記憶體,因此可用來加密超大文件

語法

Delphi

Function DLEncryptFileA(InstanceID: Integer; InputFileName, OutputFileName, Owner, User: PAnsiChar; Strength, Permissions: Integer): Integer;

DLL

int DLEncryptFileA(int InstanceID, const char * InputFileName, const char * OutputFileName, const char * Owner, const char * User, int Strength, int Permissions);

參數

InputFileName要加密的檔案名稱。
OutputFileName要建立的目的地檔名。
Owner加密檔案使用的所有者密碼,有時稱為 "master" 密碼或 "permissions" 密碼,變更文件時需要它。 加密檔案使用的使用者密碼,有時稱為 "open" 密碼,讓使用者能開啟文件,但不能以未允許的方式使用文件。
User
Strength要使用的加密強度:0 = 40 位元 RC4 加密 1 = 128 位元 RC4 加密 2 = 128 位元 AES 加密(需要 Acrobat 7 以上) 3 = 256 位元 AES 加密(需要 Acrobat 9 以上) 4 = 256 位元 AES 加密(需要 Acrobat X 以上)
Permissions以 EncodePermissions 函式建立的值

傳回值

0無法加密檔案。請查看 LastErrorCode 的結果
1文件加密成功