开发者

Storing Windows username + password in VB.Net

开发者 https://www.devze.com 2023-02-02 16:59 出处:网络
I\'m writing a backup program for personal (for the moment at least) use. For some directories (network directories / protected directories开发者_C百科) credentials are needed to access them.

I'm writing a backup program for personal (for the moment at least) use.

For some directories (network directories / protected directories开发者_C百科) credentials are needed to access them.

I can setup different jobs in the program to run at specific times.

These jobs are stored in an XML file.

I want to also store the usernames and passwords which the jobs will need.

What and where would be the best way to store these?

Changing permissions on the directories is not an option.

Thanks in advance!


You should never store the logon password for a user in Windows in order to be able to access a local directory. Instead, your backup program should run as a user that has the SeBackupPrivilege enabled (i.e. run the backup from a service that runs as the local system). This means that you won't need to change the permissions.

You may also need to make sure that you are doing a Volume Shadow Copy first that you are copying from - don't copy directly from the disk since that may cause your backup to be inconsistent.

Also, you need to take special care for encrypted files and will need to use ReadEncryptedFileRaw for this.


You could execute the backup program as a scheduled task, running as a specific user.

As for storing passwords you can store them using IsolatedStorage and using a two way encryption to make it harder for someone to decipher the file if they manage to find it.

Check out this SO question for implementing two-way encryption.

0

精彩评论

暂无评论...
验证码 换一张
取 消