I have some Java source code on my laptop that would cause me a great deal of suffering if I were to lose possession of the laptop and the source code were to fall into someone else's hands.

Is there a way to encrypt the source code on my hard drive but still be able to edit it in Eclipse?

The other problem is I have been uploading the source code to my online version control repository - if someone were to figure out that password, they would have access to the unencrypted source. For that reason, by encrypting the source code locally before I upload new commits, I will stem the possibility of it being stolen either on my laptop or on the version control repository server.

What's the best way to achieve this type of security for source code without making it too difficult to continue editing that source code?

  • Seagate has a family of self-encrypting drives, also for laptops. seagate.com/www/en-us/products/self-encrypting-drives. AFAIK the computer's BIOS has to know how to handle these drives so it's not a universal solution. For the online repository, consider using certificates, much more secure than passwords.
    – fvu
    Aug 28, 2011 at 15:49
  • Keep source on encrypted drive (truecrypt.org), Use strong password with remote source repository and/or use certificates with pass-phrase, do not save password/pass-phrase on laptop Nov 23, 2011 at 15:57

2 Answers 2


This isn't particularly related to code, to be honest - I'll vote to move it to Programmers, although SuperUser may be equally appropriate. All of your concerns would apply equally to non-source-code files with some CMS taking the place of source control.

  • Use encryption within your local operating system (e.g. BitLocker) so that no-one can read the contents of your laptop disk without being logged in as you. Obviously make sure your laptop requires your password to be entered when it returns from sleep etc.

  • Use an encrypted channel (e.g. HTTPS) between your laptop and your source control server. That will depend on your source control system.

  • Make sure the server running your source control system is using appropriate OS-level encryption too


For that reason, by encrypting the source code locally before I upload new commits

You probably don't want that. Source control works by diffs, so encrypting it will result in the whole document changing every revision. Of course it will still work, you'll be able to revert to any revision, etc. and is better than no source control at all, but it defeats much of the purpose of it and will take much more storage space. If you are that concerned about security, do what I do, run your own source control servers, even keep them private behind a VPN.

I also use PGPDrive software, it's been around a while, http://en.wikipedia.org/wiki/PGPDisk, but the advantage is you can move it around, keep copies on removable media, and even use it across platforms. The disk is basically a big file that is mounted dynamically and is formatted with a filesystem. It requires a password or key, and is another level of security. Even if someone was to crack into your user account, or you left your PC unattended, the encrypted virtual disk is still unaccessible unless currently mounted.

You must log in to answer this question.