Dealing with Large Encrypted Files
PSPDFKit already implements the
PSPDFAESCryptoDataProvider. It uses
PSPDFDataProviding and provides all the delegates to dynamically decrypt just the required part of the PDF on the fly. You just provide the unencrypted file size and the callbacks for direct access.
The naive approach to this would be using
PSPDFDataContainerProvider, but this is limited to the amount of available memory, and generally not a good idea once your documents are above 20 MB.
Careful: You should disable the disk cache by setting its
0 otherwise it will pretty much invalidate the benefit of encrypting the PDF.