Solved

Encrypt RDP password using CryptProtectData in C#

Posted on 2011-09-20
4
1,335 Views
Last Modified: 2012-12-23
Hiya,

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:


username:s:Administrator
password 51:b:AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAsgA4Zq9Ml062ejDZ3v2V/wAAAAAQAAAATQB5ACAARABhAHQAYQAAABBmAABAAQAAIAAAAM57rLzz5ZBdY8P8T/aT78cUpP+O93qSjMgUNsHJlyaPAAAAAA6AAAAAAgAAIAAAAPTq6R6HlzhFEmax2ibY/4FrkHQSv0XzDh70KIfcwCptEAAAAHVnnilRDPkwp4JlZ3hQ7/FAAAAA25GnEDwK9Q827n4Be7lZiQNTGNEyBKOdFaU9Z0kY8lSWcH/SUiEbn1lB+IO0cgZkJitCgFOQuGbmKY34lOAjTg==

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.

Thanks much,

Dave
0
Comment
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 13

Expert Comment

by:jonnidip
ID: 36590119
You may find this project useful for your needs: terminals (you can get the source too).
There is a commercial product I use at work: RoyalTS.

Regards.
0
 

Author Comment

by:SimplePaymentSolutions
ID: 36591336
Thanks for the look, but neither of those have anything to do with encrypting the RDP password. If either would do that, then either would work... but I need either the solution for the problem explained above, or a client like the ones you linked that will allow a database feed that contains the user/pass to use for the connections. that said, I may take a  look at RoyalTS just to make things simpler for me, but I will still need the solution to this problem as well.
0
 

Accepted Solution

by:
SimplePaymentSolutions earned 0 total points
ID: 38704570
I ended up going with Remote Desktop Manager, Enterprise version for this. The owner/dev of that software added a special feature for me to import from excel file (which I automated the creation of out of our database.)
0
 

Author Closing Comment

by:SimplePaymentSolutions
ID: 38716815
There were no other answers, and I need to close the question in order to post another.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question