简体   繁体   中英

calling CryptProtectData function from javascript or vbscript

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM