PSPDFDatabaseEncryptionProvider

Objective-C

@protocol PSPDFDatabaseEncryptionProvider <NSObject>

Swift

protocol DatabaseEncryptionProvider : NSObjectProtocol

Support for database encryption. If you intend to use database encryption features, you must provide an implementation of PSPDFDatabaseEncryptionProvider by setting -[PSPDFKitGlobal 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 true if no errors occurred, and false 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 true if no errors occurred, and false otherwise.

    Declaration

    Objective-C

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

    Swift

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