Encryption

  • This class allows a transparent decryption of AES256 encrypted files using the RNCryptor file format https://github.com/RNCryptor/RNCryptor-Spec/blob/master/RNCryptor-Spec-v3.md

    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 AESCryptoDataProvider : NSObject, FileDataProviding
  • The data sink that works with PSPDFAESCryptoDataProvider

    See more

    Declaration

    Objective-C

    
    @interface PSPDFAESCryptoDataSink : NSObject <PSPDFDataSink>

    Swift

    class AESCryptoDataSink : NSObject, DataSink
  • Declaration

    Objective-C

    
    @interface PSPDFAESCryptoInputStream : PSPDFCryptoInputStream

    Swift

    class AESCryptoInputStream : CryptoInputStream
  • Declaration

    Objective-C

    
    @interface PSPDFAESCryptoOutputStream : PSPDFCryptoOutputStream

    Swift

    class AESCryptoOutputStream : CryptoOutputStream
  • 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 CryptoInputStream : 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 CryptoOutputStream : OutputStream
  • Simple class that encrypts/decrypts files in a format compatible to PSPDFAESCryptoDataProvider.

    See more

    Declaration

    Objective-C

    
    @interface PSPDFCryptor : NSObject

    Swift

    class Cryptor : NSObject