PdfEncryptedPayload Class

The encrypted payload of an unencrypted wrapper document (ISO 32000-2, 7.6.7): an encrypted PDF document embedded in a document that is not encrypted, so that a reader without the cryptographic filter of the payload can show the pages of the wrapper (usually a page that explains how to open the payload).

public sealed class PdfEncryptedPayload

Remarks

The file specification of the payload has the relationship PdfAssociatedFileRelationship.EncryptedPayload and an encrypted payload dictionary (/EP, Table 28) naming the cryptographic filter; the /Collection of the catalog names the payload (/D) and hides the list of the files (/View /H).

Properties

NameDescription
CryptographicFilterGets the name of the cryptographic filter the payload is encrypted with (/Subtype), so that a reader can tell whether it can open it.
DictionaryGets the encrypted payload dictionary (/EP of the file specification).
FileGets the embedded file that holds the payload.
VersionGets the version of the cryptographic filter (/Version), or null.

CryptographicFilter

PdfEncryptedPayload.cs

Gets the name of the cryptographic filter the payload is encrypted with (/Subtype), so that a reader can tell whether it can open it.

public string CryptographicFilter { get; }

Property value

string

Gets the encrypted payload dictionary (/EP of the file specification).

public PdfDictionary Dictionary { get; }

Property value

PdfDictionary

Gets the embedded file that holds the payload.

public PdfEmbeddedFile File { get; }

Property value

PdfEmbeddedFile

Gets the version of the cryptographic filter (/Version), or null.

public string? Version { get; }

Property value

string?

Methods

NameDescription
GetData()Gets the bytes of the payload document.
OpenDocument(PdfReadOptions?)Reads the payload document.

Gets the bytes of the payload document.

public byte[] GetData()

Returns

byte[] The bytes, decoded with the limits of the wrapper document.

Exceptions

InvalidPdfContentException
The file specification has no embedded file stream, or the stream cannot be decoded.
PdfResourceLimitException
The decoded payload exceeds PdfReadOptions.MaxDecodedStreamLength of the wrapper document.

OpenDocument(PdfReadOptions?)

PdfEncryptedPayload.cs

Reads the payload document.

public PdfDocument OpenDocument(PdfReadOptions? options = null)

Parameters

options PdfReadOptions?
The options of the payload, with its password; null for PdfReadOptions.Default.

Returns

PdfDocument The payload document.

Exceptions

InvalidPdfContentException
The payload is not a PDF document.
UnsupportedPdfFeatureException
The payload is encrypted with a security handler the library does not support: only the standard security handler is.
PdfPasswordException
The password of the options does not open the payload.