As a teacher, you want to upload your questions in PDF format to e-learning platform so that student can only read the questions at the scheduled time and not before. However, you don't want to overload the platform when the students rush to download the PDF copies from the platform.
You can encrypt the PDF with a "randomly" generated password and send it to
your students beforehand. At the scheduled exam time, the student can retrieve
the password from One Hour Password
web site by themselves without your help.
The One Hour Password
website is designed with these considerations in mind:
- Password retrieval is relatively cheap operation without any database connections, hence to avoid congestion when many students request at the same time.
- The system is open for investigation, but secure without knowledge of the key; i.e. the Kerckhoff's principle.
You can use Heroku service for your own One Hour Password
website. At the
time of this README writing, https://pascal.herokuapp.com can be used to play
around as a student.
- Fork this project, if necessary
- Register for Heroku account, if you do not have one (https://www.heroku.com)
- Create a new app, with names and configurations of your choice. Free tier should be enough.
- As for "Deployment method", choose GitHub and connect to GitHub repository of the
One Hour Password
. Choose manual or automatic deployment as per your preference. - In "Config Vars", add a new config variable as below:
- KEY must be
password_secret_key
- VALUE be a string random characters with minimum of 32 characters. This must be kept secret.
- KEY must be
- Pray to God and access your heroku app URL (e.g. https://pascal.herokuapp.com). Ensure a random password is shown, and "key length" shows the length of your key set in previous steps (it must be greater than 0).
For example, you have an exam at 17 August 1945, 10:00 to 12:00 (let's pretend we're living in the past, shall we?):
- Go to
[your-herokuapp-url]/generate-get.php
(example). For best result, usehttps://
nothttp://
) - Fill in the same key as you have set before, leave other options by it's default, then click "Get password".
- You will get the password for current hour. Compare the password generated with the main URL (example). The password must be the same. Otherwise, the key you typed could be different (note: the system does not automatically compare the key, for security reason).
- Click "repeat the process" to go back to the previous page.
- Select "1945" as year, "8 - August" as Month, "17" as Day, and "10:00 to 10:59" as Hour. (note: the year part is be limited to ± 1 year from today)
- You can see that the key is autosaved for you.
- Click "Get password" again. You will get the passsword that will be visible to students on 17 August 1945, 10:00 to 10:59.
- Use this password to encrypt the PDF. Tip: Make a copy for encrypted PDF (for example:
finalexam_encryped.pdf
) and keep the original version yourself. - Give the encrypted PDF and your main URL (example) to your students in advance before the exam.
- Get the encrypted PDF and wait for exam scheduled date/time.
- At the exam date/time, visit the main URL and retrieve the password before the time expires.
- It works on other formats too, as long as they can be easily encrypted and decrypted (ZIP and PDF are two good examples).
- The generated password is only valid at given hour. If your exam starts at 10:30 for example, then bummer, this is a limitation. You must hence enable maintenance mode for your Heroku App before 10:00, and disable it manually at 10:30; and your students only have ± 30 minutes to retrieve the password.
- If you use the free-tier of heroku, it will sleep after 30 minutes of inactivity. Therefore, you may want to trigger the main URL 15 minutes before exam date/time to wake it up, so that the first student retrieving the password need not to wait.
- Regarding security:
- Do not give the encrypted PDF too soon (like, a month before). Clever student with good computing resource may guess the password with brute force technique.
- I just used gut feeling not exact calculation, but the complexity of cracking the password relies on minimum of these factors:
- Generated password itself: first 4 characters are predefined, while the rest 9 characters are valid base64 characters, i.e. 649 = 1.80 * 1016 possibilities.
- Your secret key: assuming you use also random base64 characters, with minimum of 32 characters, i.e. 6432 = 6.27 * 1057 possibilities.
- Size of your file: in most cases it should be big enough. If at least 10 bytes of your file are completely random byte, i.e. 25610 = 1.20 * 1024 possibilities.
- Strength of hash function: SHA-256 is used, it should be enough.
- Let's say your computer can do 1 billion guess per second, it will take 10 million seconds (115 days) to crack the password.
- The original author earned Master degree in Infocomm Security, if that can help you feel safer using this.