EncryptFile

Sicurezza e firme

Descrizione

Crittografa un file su disco e salva in un nuovo file. Non carica tutto il documento in memoria e può gestire documenti enormi.

Sintassi

Delphi

Function TPDFlib.EncryptFile(Const InputFileName, OutputFileName, Owner, User: WideString; Strength, Permissions: Integer): Integer;

ActiveX

Function PDFlib::EncryptFile(InputFileName As String, OutputFileName As String, Owner As String, User As String, Strength As Long, Permissions As Long) As Long

DLL

int DLEncryptFile(int InstanceID, const wchar_t * InputFileName, const wchar_t * OutputFileName, const wchar_t * Owner, const wchar_t * User, int Strength, int Permissions);

Parametri

InputFileNameIl nome del file da cifrare
OutputFileNameIl nome del file di destinazione da creare
OwnerPassword del proprietario da usare per il file crittografato. Talvolta è chiamata password "master" o password delle "permissions". Questa password è necessaria per modificare il documento. Password utente da usare per il file crittografato. Talvolta è chiamata password di "open"; consente all'utente di aprire il documento, ma non di utilizzarlo in modi non autorizzati
User
StrengthIntensità: 0 = RC4 40 bit 1 = RC4 128 bit 2 = AES 128 bit (Acrobat 7+) 3 = AES 256 bit (Acrobat 9+) 4 = AES 256 bit (Acrobat X+) 5 = AES-GCM 256 bit autenticata (PDF 2.0 con ISO TS 32003)
PermissionsUn valore creato con la funzione EncodePermissions

Valori restituiti

0Non è stato possibile cifrare il file Controllare il risultato di LastErrorCode
1Il documento è stato cifrato correttamente

Note

Chiamare prima SetPDFMACEnabled per aggiungere un token autonomo di integrità PDF MAC quando è selezionato il livello 4 o 5