Encrypt RDP password using CryptProtectData in C#
Posted on 2011-09-20
First off let me say I have looked at a few solutions for this online and none of them work with the latest release of the RDP client, 6.1.7601
Now, I own a VPS company and I routinely have to log in via RDP to my clients servers, which means typing the username and password over and over, so I have started creating RDP files with the remote desktop client instead. Inside these files (text files with a .rdp extension) there are 2 lines that set the authentication info, like this:
The password is, so I understand, encrypted with CryptProtectData, but I cannot get it to work. The encrypted strings I come up with do not match up at all - like they are a different algorithm. That said, the examples I have used to base my code off are very old - it may be that version 6 no longer uses CryptProtectData or that some other variable has changed.
I do NOT need to decrypt... only encrypt. I would like to generate an application that will create a DRP connection for me on the fly from my database, so if the user changes his/her password, I can click a button to create a new RDP file that I can use to connect without typing user/pass.
Hope that makes sense... its been a very long day and am dead tired. If anyone knows how to do this for RDP 6+, please let me know.