Why do I get an "Access Denied" error when trying to save a KeyStore to a file located in Program Files?

In Windows 7, saving or modifying files located in the Windows special folders (such as Program Files, Program Files (x86), etc.) may require your permission due to the User Account Control (UAC) function. The UAC function should ask for your permission any time a program wants to make a major change to your computer, and does not allow modifying or writing the files into the specified directory if the permission is not granted.

In many applications, saving to or modifying files from the special directories leads to an "Access Denied" error, due to the restriction imposed by the UAC. That is why, when trying to save a KeyStore or export a Certificate or Private / Public Key to a file located in one of the Windows special folders you might get an "Access Denied" type error.

To avoid this from happening, you can try setting the UAC function to a lower level or turning it off. A detailed description about the UAC settings and the potential impact of each setting on the security of your computer can be found at http://windows.microsoft.com/is-IS/windows7/What-are-User-Account-Control-settings. To find out how to turn off the UAC function you can find more information at http://windows.microsoft.com/en-US/windows-vista/Turn-User-Account-Control-on-or-off. Also, if you don't want to modify the UAC function settings or to turn it off, you can try to save the files to a different folder where writing to files is not restricted.