How can I encrypt the swap file under Windows 7?

Solution 1:

Starting with Windows Vista and WIndows Server 2008 this feature is now available. In an administrator command prompt (Start > All Programs > Accessories > right click Command Prompt and Run As Administrator) the following command:

fsutil behavior set encryptpagingfile 1

Will enable windows pagefile encryption. A reboot is required for this to take effect. According to InfoWorld, this is very secure, using one-time keys just like Mac OS X "Secure Virtual Memory":

In Windows 7 (and Vista), you can enable pagefile encryption. But even better: There is no key management. Windows creates and deletes the encryption keys as needed and there isn't a chance the user can "lose" the key or require a recovery event. It's crypto security at its best.

To simply check if pagefile encryption is enabled, use the command:

fsutil behavior query encryptpagingfile

To disable it, the command is:

fsutil behavior set encryptpagingfile 0

followed by a reboot. Note that this method of pagefile encryption requires that the volume on which the windows page file resides be NTFS formated.