存储 Windows 用户名 + VB.Net 中的密码

发布于 2024-10-10 21:24:12 字数 219 浏览 4 评论 0原文

我正在编写一个供个人(至少目前)使用的备份程序。

对于某些目录(网络目录/受保护目录),需要凭据才能访问它们。

我可以在程序中设置不同的作业以在特定时间运行。

这些作业存储在 XML 文件中。

我还想存储工作所需的用户名和密码。

存储这些内容的最佳方式是什么以及在哪里?

更改目录的权限不是一个选项。

提前致谢!

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

For some directories (network directories / protected directories) 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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

人事已非 2024-10-17 21:24:12

您绝对不应该在 Windows 中存储用户的登录密码以便能够访问本地目录。相反,您的备份程序应该以启用了 SeBackupPrivilege 的用户身份运行(即从作为本地系统运行的服务运行备份)。这意味着您不需要更改权限。

您可能还需要确保首先执行从中复制的卷影复制 - 不要直接从磁盘复制,因为这可能会导致备份不一致。

此外,您需要特别注意加密文件,并且需要为此使用 ReadEncryptedFileRaw。

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.

对风讲故事 2024-10-17 21:24:12

您可以将备份程序作为计划任务执行,以特定用户身份运行。

至于存储密码,您可以使用IsolatedStorage 来存储它们,并使用双向加密来使某人更难破译该文件(如果他们设法找到该文件)。

查看此SO问题以实现双向加密。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文