PSPDFKit already implements the
PSPDFAESCryptoDataProvider. It uses
PSPDFDataProvider internally and provides all the delegates do 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
NSData, 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 also set the
PSPDFDiskCacheNothing, otherwise the disk cache will pretty much invalidate any encryption you're having.