Encryption

  • This class allows a transparent decryption of AES256 encrypted files using the RNCryptor file format https://github.com/rnapier/RNCryptor/wiki/Data-Format Legacy PSPDFKit old file format is also supported. Use the provided encryption tool to prepare your documents.

    Ensure your passphrase/salt are also protected within the binary, or at least obfuscated. Encryption marginally slows down rendering, since everything is decrypted on the fly.

    If saving annotations to a file managed by a PSPDFAESCryptoDataProvider, the whole file will be re-written.

    Note

    The initializers will return nil if the strong encryption feature is not enabled, or if you pass an invalid parameter configuration.
    See more

    Declaration

    Objective-C

    
    @interface PSPDFAESCryptoDataProvider : NSObject <PSPDFFileDataProviding>

    Swift

    class PSPDFAESCryptoDataProvider : NSObject, PSPDFFileDataProviding
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface PSPDFCryptoInputStream : NSInputStream
    
    /// Returns nil if the encryption feature is not enabled.
    - (nullable instancetype)initWithInputStream:(NSInputStream *)stream decryptionBlock:(nullable NSInteger (^)(PSPDFCryptoInputStream *superStream, uint8_t *buffer, NSInteger len))decryptionBlock;
    
    /// Set the decryption handler. If no decryption block is called, this input stream will simply pass the data through.
    /// Return the length of the decrypted buffer. This block is assuming you are decrypting inline.
    ///
    /// @note Set this property before the input stream is being used.
    @property (nonatomic, copy) NSInteger (^decryptionBlock)(PSPDFCryptoInputStream *stream, uint8_t *buffer, NSInteger len);
    
    @end

    Swift

    class PSPDFCryptoInputStream : InputStream
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface PSPDFCryptoOutputStream : NSOutputStream
    
    /// Returns nil if the encryption feature is not enabled.
    - (nullable instancetype)initWithOutputStream:(NSOutputStream *)stream encryptionBlock:(NSData * (^)(PSPDFCryptoOutputStream *stream, const uint8_t *buffer, NSUInteger len))encryptionBlock;
    
    /// Set the encryption handler. If no encryption block is called, this output stream will simply pass the data through.
    ///
    /// @note Set this property before the output stream is being used.
    @property (nonatomic, copy) NSData * (^encryptionBlock)(PSPDFCryptoOutputStream *stream, const uint8_t *buffer, NSUInteger len);
    
    @end

    Swift

    class PSPDFCryptoOutputStream : OutputStream