从 javascript 或 vbscript 调用 CryptProtectData 函数
我正在创建一个站点,用户可以在其中保存不同的凭据,并且在登录到虚拟机时,他们可以简单地选择使用特定凭据登录。因此,我必须生成一个包含所选用户名/密码的 rdp 文件。这没问题,但问题是 rdp 文件中的密码需要使用 crypt32.dll 中的 CryptProtectData 函数进行加密。这可以毫不费力地完成,但问题是该文件只能在创建该文件的计算机上解密。
因此,即使我即时创建 rdp 文件并将其发送给客户端,他们也无法打开它,因为它不是在他们的计算机上创建的。因此,我必须以某种方式从客户端加密密码并生成 rdp 文件。但我不知道如何从客户端调用 COM 对象的函数。
请帮忙。
I am creating a site where users can save different credentials and while logging to a VM, they can simply choose to log in using a particular credential. Therefore, I have to generate a rdp file containing the username/password selected. That is fine, but the problem is the password in a rdp file needs to be encrypted using CryptProtectData function found in crypt32.dll. This can be done without a sweat but the problem is the file can be decrypted only on that computer on which it was created.
Therefore, even if I create a rdp file on the fly and send it to the clients, they are not able to open it as it was not created on their machine. So, I have to somehow encrypt the password from the client side and generate the rdp file. But I can't get to know how do I call functions of COM objects from the client side.
Please help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决方案是不要这样做。相反,生成不带密码的 RDP 文件,并训练用户选中该框以将凭据保存在其计算机上。
设置
prompt forcredentials:i:0
,用户第一次会被提示输入用户名和密码。他们将有机会选中一个复选框来保存凭据,并且在后续情况下不会再次被询问。请注意,您无法从浏览器中调用 CryptProtectData。如果您无法在用户的计算机上安装软件,或者让用户执行此操作,那么您根本无法执行此操作。
曾经有这样做的功能,但在 XPSP2 和 2003SP1 中被删除。
The solution is to not do this. Instead, generate the RDP file with no password, and train the users to check the box to save the credentials on their machine.
Set
prompt for credentials:i:0
, and the user will be prompted for username and password on the first occasion. They will have the opportunity to check a box to save the credentials, and will not be asked again on subsequent occasions.Note that you can't call CryptProtectData from within a browser. If you cannot install software on the user's machine, or have the user do it, you cannot do this at all.
There used to be a capability to do this but it was removed in XPSP2 and 2003SP1.