PSPDFDatabaseEncryptionProvider

@protocol PSPDFDatabaseEncryptionProvider <NSObject>

Support for database encryption. If you intend to use database encryption features, you must provide an implementation of PSPDFDatabaseEncryptionProvider by setting -[PSPDFKit setDatabaseEncryptionProvider:].

  • The encryption provider must perform the necessary steps to encrypt the given db with the given keyData. Most implementations will call sqlite3_key(db, keyData.bytes, keyData.length). Return YES if no errors occurred, and NO otherwise.

    Declaration

    Objective-C

    - (BOOL)encryptDatabase:(nonnull void *)db withKey:(nonnull NSData *)keyData;

    Swift

    func encryptDatabase(_ db: UnsafeMutableRawPointer, withKey keyData: Data) -> Bool
  • The encryption provider must perform the necessary steps to re-encrypt the given db with the given keyData. Most implementations will call sqlite3_rekey(db, keyData.bytes, keyData.length). Return YES if no errors occurred, and NO otherwise.

    Declaration

    Objective-C

    - (BOOL)reEncryptDatabase:(nonnull void *)db withKey:(nonnull NSData *)keyData;

    Swift

    func reEncryptDatabase(_ db: UnsafeMutableRawPointer, withKey keyData: Data) -> Bool