Artykuł techniczny

HotPDF: AES-256 encryption and permission policy in Delphi

HotPDF to natywna biblioteka PDF VCL dla aplikacji Delphi i C++Builder, które potrzebują bezpośredniego tworzenia i edycji PDF, formularzy, adnotacji, szyfrowania, podpisów cyfrowych, czcionek Unicode, wyjścia zgodnego ze standardami i raportów preflight bez instalowania zewnętrznego runtime PDF.

Ten artykuł jest przeznaczony dla teams that must generate protected PDF output without relying on a desktop PDF application. Traktuje AES-256 encryption and permission policy jako produkcyjną inżynierię dokumentów, a nie pojedyncze wywołanie komponentu.

Praktyczne ryzyko polega na tym, że a password-protected document is not automatically a governed document if permissions, metadata encryption, attachment handling, and password custody are undefined. Dlatego przepływ wymaga spisanego kontraktu, obserwowalnej diagnostyki i realistycznych plików regresyjnych.

Decyzje architektoniczne

Separate document security from application authentication. owner password custody and rotation policy / user password delivery path and recovery procedure

  • owner password custody and rotation policy
  • user password delivery path and recovery procedure
  • print, copy, accessibility, annotation, and form-fill permissions
  • whether metadata, embedded files, and attachments must also be protected

Przebieg implementacji

Define the encryption profile before writing content. Poniższa kolejność zachowuje czytelność przepływu pracy dla zespołów Delphi i C++Builder.

  1. select an encryption profile from application policy rather than UI text
  2. validate that the requested permissions match the customer agreement
  3. write the document to a controlled temporary location before distribution
  4. open the output with a target viewer and verify the permissions dialog
  5. log password policy identifiers without logging secret values

Dowody walidacji

What a security audit should record. Zachowaj te pola wraz z wynikiem lub rekordem wsparcia.

  • encryption algorithm, permission bitmask, metadata policy, and attachment policy
  • profile version, operator identity, output hash, and distribution channel
  • viewer compatibility result for the supported customer environments
  • redacted failure reason when password generation or protected save fails

Permissions, metadata, and viewer compatibility

AES-256 output should be treated as a named policy. The policy controls owner and user passwords, print and copy permissions, metadata visibility, and compatibility expectations for the viewers that will open the file.

Support package design

Once HotPDF Component is deployed, the most valuable support package is the one that explains the input, profile, output, and exact stage that failed.

  • encryption algorithm, permission bitmask, metadata policy, and attachment policy
  • profile version, operator identity, output hash, and distribution channel
  • viewer compatibility result for the supported customer environments
  • redacted failure reason when password generation or protected save fails
  • terminology snapshot: AES-256, owner password, user password, permissions

Notatki przeglądu inżynierskiego dla AES-256 encryption and permission policy

Użyj tych notatek przeglądu, aby upewnić się, że funkcja wyszła poza demonstrację i da się ją obronić podczas wydania, wsparcia i eskalacji klienta.

  • Decyzja: owner password custody and rotation policy. Punkt nacisku implementacji: validate that the requested permissions match the customer agreement. Dowody akceptacji: viewer compatibility result for the supported customer environments. Wyzwalacz regresji: encrypted attachments need the same retention and access policy as the main file
  • Decyzja: user password delivery path and recovery procedure. Punkt nacisku implementacji: write the document to a controlled temporary location before distribution. Dowody akceptacji: redacted failure reason when password generation or protected save fails. Wyzwalacz regresji: legacy viewers may open a file but ignore or misreport newer permission flags
  • Decyzja: print, copy, accessibility, annotation, and form-fill permissions. Punkt nacisku implementacji: open the output with a target viewer and verify the permissions dialog. Dowody akceptacji: encryption algorithm, permission bitmask, metadata policy, and attachment policy. Wyzwalacz regresji: metadata can leak business information if encryption settings omit it

Przypadki brzegowe

  • legacy viewers may open a file but ignore or misreport newer permission flags
  • metadata can leak business information if encryption settings omit it
  • support logs must never include owner passwords, user passwords, or password hints
  • encrypted attachments need the same retention and access policy as the main file

Delphi / C++Builder notes

HotPDF Component should sit behind a small service boundary that receives files, streams, profiles, and credentials, then returns output paths, warnings, metrics, and validation status. Important terms include AES-256, owner password, user password, permissions, encrypted metadata, protected save.

Przykład kodu Delphi

Poniższy szkic Delphi pokazuje praktyczną granicę usługi dla tego tematu. Kontrole zasad, logowanie i walidację trzymaj poza wąskim blokiem wywołań produktu, aby przepływ pozostał testowalny.

procedure SaveProtectedPdf(const OutputFile: string; const Profile: TPdfSecurityProfile);
var
  Pdf: THotPDF;
begin
  Pdf := THotPDF.Create(nil);
  try
    Pdf.FileName := OutputFile;
    Pdf.BeginDoc;
    WriteDocumentBody(Pdf);
    ApplyEncryptionProfile(Pdf, Profile);
    Pdf.EndDoc;
    VerifyPermissions(OutputFile, Profile.ExpectedPermissions);
  finally
    Pdf.Free;
  end;
end;

Lista produkcyjna

  • Uruchom przepływ pracy na pustym pliku, zwykłym pliku klienta i pliku z najgorszego scenariusza
  • Otwórz wygenerowany plik PDF w docelowej przeglądarce, walidatorze, drukarce lub aplikacji nadrzędnej
  • Zaloguj wersję produktu, wersję profilu, hash wejścia, ścieżkę wyjścia, czas wykonania i liczbę ostrzeżeń
  • Przechowuj hasła, certyfikaty, pliki tymczasowe i dane klienta zgodnie z jednoznacznymi zasadami retencji
  • Dodaj dokument regresyjny, gdy plik klienta ujawni nowy przypadek brzegowy

Dokumentacja produktu

HotPDF Component

Dodatkowe przykłady kodu

Pdf.ActivateProtection := True;
Pdf.CryptKeyLength := aes256;
Pdf.UserPassword := '';                      // anyone can open the file
Pdf.OwnerPassword := 'rotate-me-quarterly';  // guards the permission set
Pdf.ProtectOptions := [prPrint, prPrint12bit, prExtractContent];
Pdf.BeginDoc;
// ... page content ...
Pdf.EndDoc;
var
  Pdf: THotPDF;
  PageCount: Integer;
begin
  Pdf := THotPDF.Create(nil);
  try
    PageCount := Pdf.LoadFromFile('encrypted.pdf', 'open-secret');
    if PageCount > 0 then
    begin
      Pdf.ActivateProtection := False;   // drop encryption on save
      Pdf.SaveLoadedDocument('plain.pdf');
    end;
  finally
    Pdf.Free;
  end;
end;