存储的用户名和密码
我正在编写一个应用程序,需要在 Windows 上存储多个 (XMPP) 帐户的登录数据。 目前,应用程序使用 CredRead
和 CredWrite
将它们存储在 Windows 的“存储的用户名和密码”中。问题是:XMPP 帐户的登录名无法更改(它是帐户的 JID),但 Windows 只在给定的目标名称下存储用户名/密码对。我使用类似“xmpp:[email protected]”作为目标名称并且在登录期间根本不使用用户名。用户甚至无法在应用程序内设置用户名(它将设置为“ [电子邮件受保护]”自动代替)。
现在我想防止用户(使用控制面板或 rundll32.exe keymgr.dll、KRShowKeyMgr)或其他应用程序将用户名更改为不同的名称,因为目前这是可能的并且以某种方式令人困惑的是,因为无论如何实际值都被忽略了。如果我打开“存储的用户名和密码”对话框(使用 rundll32.exe keymgr.dll、KRShowKeyMgr
),我的应用程序创建的条目将列为“xmpp:[email protected] (LegacyGeneric)" 可以使用“编辑...”进行编辑按钮。 该列表还包含一个 Windows Live 条目(列为“[电子邮件受保护] (WindowsLive)"),其用户名无法更改(尝试这样做会弹出一个消息框,显示:“Windows 无法保存登录信息。请确保信息正确且所有必填字段均已填写。”。
此处(最后)我的问题是:我的应用程序也可以得到这种行为吗?如何将凭据类型更改为与“LegcyGeneric”不同的类型?或者是否有更好的方法来仅存储给定登录名的密码(也许使用Windows数据保护),同时仍然使用一些“标准”Windows方式来存储它们
?
I'm writing an application which needs to store login data for multiple (XMPP) accounts on Windows.
Currently the application stores them in Windows' "Stored User Names and Passwords" using CredRead
and CredWrite
. And here is the problem: The login name for an XMPP account cannot be changed (it's the account's JID), but Windows only stores user name/password pairs under a given target name. I use something like "xmpp:[email protected]" for the target name and don't use the user name at all during login. The user can't even set the user name from within the application (it will be set to "[email protected]" automatically instead).
Now I would like to prevent the user name to be changed to something different by the user (using control panel or rundll32.exe keymgr.dll, KRShowKeyMgr
) or an other application as this is currently possible and somehow confusing because the actual value is ignored anyway. If I open up the "Stored User Names and Passwords" dialog (using rundll32.exe keymgr.dll, KRShowKeyMgr
), the entries which are created by my application are listed as "xmpp:[email protected] (LegacyGeneric)" and can be edited using the "Edit..." button.
The list contains also an entry for Windows Live (listed as "[email protected] (WindowsLive)"), whose user name cannot be changed (trying so will bring up a message box saying: "Windows cannot save the logon information. Make sure the information is correct and that all required fields are completed.".
And here is (finally) my question: Can I get this behavior for my application as well? How can I change the credential type to something different than "LegcyGeneric"? Or is there a better way to store only the password for a given login name (maybe using Windows Data Protection), while still using some "standard" Windows way of storing them?
Any hints and answers are appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论