The ability to password protect individual projects


Wed Mar 07, 2018 1:51 pm Post

KB wrote:Yes, Katherine and popcornflix have hit the nail on the head. We do get frequent requests to password-protect Scrivener projects, but it's not like password-protecting a single file such as a Word document, which can be encrypted. As Katherine and popcornflix point out, a Scrivener project is not a single file but a folder full of many files. That entire directory would need encrypting, and it would need decrypting on read. That is far from simple. Would each file be decrypted as it was needed? Or would an entire (possibly huge) project directory be encrypted and have to be decrypted as a whole on project open?

This may be worth some more research, as I think this could be easier than you surmise. Pages has the same multi-file package structure as Scrivener and provides transparent encryption by simply packaging as an encrypted ZIP archive.

Files in an encrypted ZIP archive can be listed without the need to decrypt every file, so there is no barrier to Scrivener's existing functionality. Scrivener can ask for the password to an encrypted project upon open, then decrypt individual documents on the fly as they are accessed, fitting with its existing memory management model.

A quick search on Apple's developer site reveals an example app for browsing ZIP archives without unarchiving:

Basically if Scrivener reads its folder structure as a ZIP archive you get encryption for free, and smaller disk footprint. This may also solve your issues with iCloud sync.

User avatar
Site Admin
Posts: 20507
Joined: Tue Jun 13, 2006 11:23 pm
Platform: Mac
Location: Truro, Cornwall

Wed Mar 07, 2018 3:00 pm Post

A zipped package would not work for Scrivener at all. Programs that use zip file - such as Pages and Word - are able to do so because they read the entire file into memory and load and write the entire file out to disk on save. Scrivener does not do this, but instead reads each file as it needs it and writes each file inside the package without affecting any other files. This reduces the change of corruption and allows for large projects.

The code you link to is very old and uses deprecated APIs; even so, it could only show the contents of a zip file, not manipulate them on the fly. There are no frameworks or technology on the Mac that allows you to work with files inside a zip file directly. The only way would be to extract a file to a temporary location and write it back into the zip file occasionally, which is not optimal and would break many things in Scrivener. It would also increase the risk of corrupted projects, because a bad write to the zip file could result in a corrupt zip file and thus a lost project, something that could never happen with the current folder structure approach.

Using a zip package is something we have thoroughly explored (the above is just a snapshot of a couple of the problems involved - it goes much deeper) but I'm afraid it is just not a viable option for Scrivener.

All the best,
"You can't waltz in here, use my toaster, and start spouting universal truths without qualification."


Wed Mar 07, 2018 3:37 pm Post

Well darn. I appreciate the clarification though!

Posts: 1
Joined: Sun Dec 16, 2018 5:49 am
Platform: Mac + Windows

Sun Dec 16, 2018 6:05 am Post

How about password protect the whole application? Like, use a Master password for the Scrivener application instead of password protect individual projects. I would also like the password protect feature. It is a little difficult when someone shares their laptop with someone else. For ex. a friend or even family member.

User avatar
Posts: 202
Joined: Sun Feb 10, 2013 7:59 am
Platform: Mac, Win + iOS
Location: Sunshine Coast Australia

Sun Dec 16, 2018 9:01 am Post

I haven’t tried it specifically with Scrivener, but with the Mac APFS file system (High Sierra and later) it’s easy to generate an additional volume on a disk (disk utility). Beauty is it can be individually password protected and unlocked either at boot, or by mounting. It Co-exists with the normal Mac volume and size adjusts as needed. No need to mess around adding partitions. I use this feature to lock specific work related confidential info on the encrypted volume. The apps are all in the usual place, just the data folders reside on that volume. Due to the confidentiality and corporate rules on handling data on non company owned equipment I mount the volume to work on those files, then unmount on close.

Not aware of same functionality built in to Win, though do recall using a 3rd party program to dynamically manage partitions. Way back in the Win dark ages.

Don’t quote me, but in 40+ years in computers I don’t recall a password protect for launching an app

Posts: 963
Joined: Wed Aug 01, 2007 9:44 am
Platform: Mac + iOS
Location: Cambridge, UK.

Sun Dec 16, 2018 11:22 am Post

With a Mac that is being shared I would have thought that the easiest thing would be for each user to have their own account on the computer -- one administrator and one or more guest accounts (each person has their own password for using their account). I've never done it for sharing, but I've set up guest accounts to test things. Don't remember all the details, but it was pretty easy.
You should judge people not by how close they get to the top, but by how far they have come from the bottom. Some people have a mountain to climb just to get to the place where others start out. (Me, 2010)