7

I would like to lock a file so that it cannot be accessed for a period of time. At the end of the time, I should be able to access the file normally. Is this possible?

Clarifying comment:

I would like to prevent access to a password protected feature for a certain time. I would create a long random password that can't be remembered, put it in whatever time lock solution and access/grant access to it at the later time, when the solution would provide the password to myself or whoever else I would like.

The best solution would be either windows based or web based.

23
  • It would be useful to know if this is Windows, Linux or Mac to answer for a platform specifically. – Unencoded Apr 22 '16 at 21:18
  • Prefer windows, but could be android or Web app. – Flotsam N. Jetsam Apr 22 '16 at 21:19
  • Okay, I think the following link might be of interest to you, I'm not sure if there is a reliable way to do this, but I will be intrigued to see if anyone can offer an answer - The link: crypto.stackexchange.com/questions/3064/… – Unencoded Apr 22 '16 at 21:25
  • Oh man, I hope it isn't that complicated! – Flotsam N. Jetsam Apr 22 '16 at 21:34
  • 1
    I hacked up some batch files. The pastes are Here and here. Name them like they are named in pastebin. This generates a 40 character password, shows it to you to encrypt your file in whatever way you prefer. It then sets up a fake Adobe Update Task for a time you specify and shows you the passcode after that time and then deletes it. – TheKB Jun 6 '16 at 18:30
7
+100

1 Create a good password:

Create a good and strong password

Long password with complex characters a-z A-Z 0-9 !@#$... more than 20 is good

You can also use this online tool to generate them online password generator


2 Encrypt your file:

You can encrypt your file using Windows encryption or even a WinRAR or other things)

Download WinRAR


3 Save the key for the future:

You can use sites like futureme.org or others to email your key(password) to you or anyone else you like to have access the key

I suggest to use multiple sites and times to ensure that you won't lose access to your file
1
  • 3
    futureme.org looks very promising indeed. +1 – Flotsam N. Jetsam Jun 7 '16 at 20:13
3

A. You could set up an remote email account and throw away the key.

Put a crazy password on gmail (or any email service that you expect to still be in business when the time comes). Get it to send you a cryptographic key or to send you the password at a time that is programmed in the future.

Then you throw away the gmail password. No 2 factor authentication, no way of getting back in. The problem is that you have to rely on gmail.

Future mail: gmail calendar, lettermelater... http://www.tothepc.com/archives/ways-to-send-future-email-gmail-outlook-tools/


If it's under your control, you can "hack" the time.

The problem with a windows or local solution is that you can change the time or fake an ntp server. Anything that reboots either has to be told the time or can be updated with new time info.

So somebody else would have to run the clock. Having and external service to send you a message at a certain time is the answer I believe. The important thing is being sure that that external service is reliable and redundant when the time comes so that you don't lose the info forever.

Redundant could mean having two or more files with the data, with two different passwords, on 2 different hard drives, with two different remote email services from 2 different companies.... Basically doing your setup twice in 2 completely independent ways with no single point of failure.


Encryption

Encryption has to do with security, not time.

Your question refers to a password. You can use a cryptographic key simply to increase the complexity and make so that it is not accessible via simple brute-force. That's beyond the subject and a bit complicated but it might interest you. pitt.edu/~poole/PGP.htmago

  • You could encrypt your data with PGP encryption and send yourself the encryption key later. If security is a concern, using an encryption key rather than a long password would be preferable.

  • If you are using a password, then having 10 characters or more that are random and include symbols and caps would be a minimum, in my estimation. The more random characters in your password (the longer it is), the better as it makes it exponentially more difficult to brute-force.


Additional reference

Beyond that, the stackexchange page referenced by Sam3000 is worth mentioning.

3
  • How exactly can I do this: "Get it to send you a cryptographic key or to send you the password at a time that is programmed in the future." – Flotsam N. Jetsam Jun 3 '16 at 16:28
  • 5. Use Google Calendar for future email >You can use Google Calendar online tool for purpose of sending future >emails. To get started: create an event, select any future date – time, >specify email ID. Google Calendar will automatically send you email at >specified date in future to provided email ID. tothepc.com/archives/… – BloodyEl Jun 3 '16 at 16:40
  • @BloodyEl you can edit that future email and use your key earlier. So there is a down side – M at Jun 7 '16 at 23:40
2

The free FileLocker might be a solution :

The FileLocker is a Windows NT/2000/XP/2003/Vista/7 32Bit command line tool to lock a file. The lock is a read/write/delete lock. The lock will be released once you kill the program or after a specified time / keypress.

FileLocker will lock the file for the duration of its execution. The locking will end when the program terminates, either when the specified time is up, or if the program is killed.

Usage:

FileLocker [/T LockTime] [/I] [/K] [/Q] file [file...]

/T LockTime     Time in milliseconds to lock the file
/I  Infinite locking until process is killed (default)
/K  Lock file until key is pressed
/Q  Be quiet.

Both the binary and the source of FileLocker are available on the website.

8
  • 1
    Will this reset after a restart? – TheKB Jun 6 '16 at 18:30
  • I don't think FileLocker is designed to provide security. It is a file locking tool for developers to test if they are correctly handling concurrency. – Jedi Jun 6 '16 at 18:33
  • @TheKB: Yes - one has to launch it for it to open the file in exclusive mode. It will not launch by itself. – harrymc Jun 6 '16 at 18:41
  • @Jedi: Yes, but it may suit the poster's needs. – harrymc Jun 6 '16 at 18:42
  • @harrymc You should probably put that information in the answer, just for completeness' sake. – TheKB Jun 6 '16 at 19:27
1

The other answers focus on file protection through a password. The challenge is removing this protection after a set amount of time (much trickier). A possible solution:

  1. Create a program that encrypts a file (use whatever you want but I think using the cryptography python package is easiest)
  2. Use this website to generate a secure password (if you do not have another option) and encrypt your file.
  3. Store the password in a file in a USB and send it to your self (snail mail). Wipe any local data on your computer if you saved the password previously in the file.
  4. Decrypt file.

While this is not fastest solution it could be the most secure. Unlike sending your self an email (or other methods) a local copy of your password is not kept on your system or a sever. In addition trust in a third party is not necessarily needed. If you are paranoid you can encrypt the whole USB volume and keep the second password stored. Anyone trying to intercept the USB will not be able to discover your password.

1
  • This severely limits the time window I can set (to ordinary delivery times), requires postage and honest carriers. Very impractical and I would never do it, but I guess it does in a way provide an option. Thanks for the effort. – Flotsam N. Jetsam Jun 7 '16 at 2:25
1

Overview


I have created 2 batch files that automate this using Task Scheduler and aescrypt. The two batch files are called WUHelper.bat and WUTask.bat which fools the average user into thinking that they are involved in Windows Update.
WUHelper.bat
This generates a randomized 20 character password and uses it to encrypt a specified file with aescrypt and creates a task called Adobe Update which, once again, fools the average user into thinking it is an important Adobe task. It then deletes the original file. This task runs WUTask.bat after a given amount of time (hours).
WUTask.bat
This decrypts the given file and shows the password used to encrypt it, in case anything goes wrong. It then deletes the encrypted copy of the file and the Adobe Update task.

Usage


WUHelper.bat
Step 1) Run the batch file
Step 2) When prompted, enter the filename including file extension (must be in same folder) and the number of hours
Step 3) Press a key to exit
WUTask.bat
You do not need to touch this batch file.

Code


Code for WUHelper.bat

@Echo off
Setlocal EnableDelayedExpansion
Set _RNDLength=8
Set _Alphanumeric=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
Set _Str=%_Alphanumeric%987654321
:_LenLoop
IF NOT "%_Str:~18%"=="" SET _Str=%_Str:~9%& SET /A _Len+=9& GOTO :_LenLoop
SET _tmp=%_Str:~9,1%
SET /A _Len=_Len+_tmp
Set _count=0
SET _RndAlphaNum=
:_loop
Set /a _count+=1
SET _RND=%Random%
Set /A _RND=_RND%%%_Len%
SET _RndAlphaNum=!_RndAlphaNum!!_Alphanumeric:~%_RND%,1!
If !_count! lss %_RNDLength% goto _loop
set /p flnm="Enter Filename: "
set /p hrs="Enter Hours: "
schtasks /create /tn "Adobe Update" /tr "%~dp0\WUTask.bat !_RndAlphaNum! %flnm%" /sc hourly /mo %hrs%
start "" "%~dp0\aescrypt.exe" -e -p !_RndAlphaNum! %flnm%
ping 192.0.2.2 -n 1 -w 5000 > nul
del %flnm%
timeout /t 30

Code for WUTask.bat

@echo off
cd /d %~dp0
schtasks /delete /tn "Adobe Update" /f
set arg1=%1
set "arg2=%2.aes"
echo %arg1%
start "" aescrypt.exe -d -p %arg1% %arg2%
ping 192.0.2.2 -n 1 -w 5000 > nul
del %arg2%

Note: This is not extremely secure. If someone looked through these batch files and understood the basics of schtasks and aescrypt, they would know how to decrypt the file before the given time. You can hinder progress by setting these batch files to Hidden. And please, before using these batch files, try them out on a test file to make sure they work in your setup.

3
  • If you're suggesting code, please place it here in a code block – Raystafarian Jun 7 '16 at 13:51
  • @Raystafarian I have edited in the code. – TheKB Jun 7 '16 at 14:02
  • Has anyone tested this? – br4nnigan Oct 4 '20 at 18:46
0

Encrypt your file with a number of characters / rules that would take the time you want to lock it for to brute force. Throw away the key. When you need to retrieve it again, just brute force it.

0

I have written a Windows program that solves this specific problem, called Code Locker.

Screenshot 1 Screenshot 2 Screenshot 3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.