Is there anyway one can override NSPersistentDocument to encrypt and require a password to open the file? In other words, is it possible to encrypt a document as a whole with a user provided password? I've looked into solutions and it seems the only way is to actually encrypt the CoreData data itself independently, however that would make it impossible to use a NSPredicate to filter a NSFetchRequest since the data would be encrypted. An alternative would be using Realm which has an encryption key, but that only encrypts the Realm data, leaving all other data in the document unencrypted.
Encrypt NSDocument on macOS
70 Views Asked by Andre Yonadam At
2
There are 2 best solutions below
0
MichaelR
On
You can encrypt CoreData objects, and by creating transient (in memory only) cleartext fields on reading, you can use NSPredicate to filter NSFetchRequest on those cleartext fields. See here for a sample of the encrypt/decrypt code: https://github.com/michaelrourke/EncryptedCoreData
Related Questions in COCOA
- In what context can we use an unqualified #selector() expression in Swift?
- How can I trigger macOS system gamepad API based on a value received from iOS app through core bluetooth
- Using sort descriptors in Outline View
- NSTableView to NSOutlineView Drag & Drop not accepting drop
- How to remove horizontal line in bottom of section NSTableView?
- CGSRegionRef: How is an arbitrary region represented as union of rects?
- Listen for Touch Events on MacOS (Trackpad)
- Window "yanks" when moving
- Writing NSFilePromiseProviders to pasteboard blocks app on quit
- Basic ImGui program doesn't render, leaks memory and crashes
- NSTokenField suggestion using context menu in swift
- How to link multiple text views to a single text storage in TextKit 2
- I would like to know why I’m not getting IBOutlets connected in an App’s window
- How to make a custom event loop in Cocoa?
- Why is restoreWindow(withIdentifier:state:) called after applicationDidFinishLaunching(_:)?
Related Questions in ENCRYPTION
- Is TLS enough for client server encryption or if dealing with sensitive data, its better to add ur own encryption also. for example leverage AWS SSM?
- Secure Messaging Implementation in C#
- File splitting and encryption
- Large file processing in the web browser
- Java code of AES/GCM/NoPadding encryption algorithm with authentication tag
- AES-256-CBC encryption returning different result in Python and PHP , HELPPP
- Why are encrypted stored procedures taking a long time to execute in SQL Server 2022?
- Why/How does Apache auto-include "DHE" TLS1.2 ciphers while nginx needs "dhparams" file?
- Encrypt in Single Store and Decrypt in SQL Server
- Is it possible to develop a Transparent Data Encryption(TDE) system on macOS now?
- How can I ensure incremental changes in deciphered messages in Python substitution cipher decoding?
- Getting Error Message as "the input string is not a complete block" while Decryting using AES
- Laravel: How to fix "the MAC is invalid" on local environment
- How to encrypt a string and decrypt it using a password
- Willena's sqlite-jdbc-crypt driver for sqlite3 database encryption
Related Questions in NSDOCUMENT
- Autosaving NSDocument memory leak with NSWindow and NSToolbar - NSDocumentTitlebarPopoverViewController leaks
- macOS document based app - save all documents as one
- Implementing NSDocument in a right way
- Make "Close All" (cmd+option+W) apply only to one type of document windows
- iCloud Drive: NSDocument.revert(toContentsOf:ofType:) called when document is merely opened on another device
- NSDocument XML read Issue
- displayName won't set despite allowing set
- How to find out if print panel was closed successfully when printing from a PDFView
- `NSDocument`'s `data(ofType:)` getting data from (async) `actor`
- Is NSDocument subclass a model object or not?
- NSDocument-Based Application: Selecting Default File Type in NSSavePanel
- Changing NSDocument tab names. (Swift)
- NSDocument file wrapper sync via iCloud doesn't appear to support editing on multiple computers simultaneously
- Get NSDocument from NSObject
- Document based app using one single window
Related Questions in NSPERSISTENTDOCUMENT
- NSPersistentDocument FetchRequest warp property crash on macOS Document App SwiftUI project
- NSDocumentController closeAllDocumentsWithDelegate does not call canCloseDocumentWithDelegate of my NSPersistentDocument subclass
- In 2020, how does one sync a NSPersistentDocument based app across devices (macOS, iOS)
- Encrypt NSDocument on macOS
- NSDocument refuses to update core data changes using NSFetchedResultsController
- iCloud NSDocument save warnings - caused by lastUsedDate file attribute?
- ibaction not trigger in NSPersistentDocument for macOS
- Using NSPersistentDocument to create 'Documents'
- NSPersistentDocument to be marked as not "dirty"/edited after internal initiation
- Subclassing NSArrayController causes objects from ManagedObjectContext doesn't show in NSTableView
- Core Data: Lost the ability to save new documents, but still can edit and save existing documents
- Document based core data app - add and remove additional attributes
- Can concurrence type be changed of NSPersistentDocument's managedObjectContext?
- NSPersistentDocument, Swift, macOS, and storyboards — how to get the managedObjectContext?
- Getting the managedObjectContext in a document-based app for preferences controller
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Have a look at the document for
NSPersistentStoreand its two abstract subclasses,NSAtomicStoreandNSIncrementalStore. If you make a custom subclass of one of these, you can customize the backend that Core Data writes to.