Link to home
Start Free TrialLog in
Avatar of batracy
batracy

asked on

Need help with encryption/decryption of DES TightVNC passwords with C#

We have a situation where we need to change VNC 1.3.9 server passwords on many remote systems as well as create VNC connection files dynamically.  Remotely modifying the registry and creating the VNC files on the fly is not a problem.

The problem is that I need to be able to encrypt and decrypt plain text to VNC's DES encrypted format in C#.  I've found a few sites online that say the encryption key for this version is "23 82 107 6 35 78 88 7" but I've had no luck getting any functional code going to do what I need to do.  I'm sure there's a nice little short snippet that would do this but I've failed so far.

I know I could get the encrypted version of a password by looking in the registry or by connecting to a machine and saving that connection then looking at the config file but we'd rather not add that step for as many connections as we have to alter.

Thanks in advance
Avatar of JimBrandley
JimBrandley
Flag of United States of America image

I do noit know anything about "TightVNC", but I do know about cryptography using the various crypto providers in C#. If that's the part you need help with, this link should show you how to work with the System.Cryptography.DesCryptoServiceProvider.

http://msdn.microsoft.com/en-us/library/system.security.cryptography.descryptoserviceprovider.aspx

Jim
ASKER CERTIFIED SOLUTION
Avatar of Rich Rumble
Rich Rumble
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of batracy
batracy

ASKER

Thanks richrumble.  From your link I ended up finding a console app ("vncenc.exe" (http://www.darkage.co.uk/howtos/vncenc.htm)) that encrypts the string.  It's not exactly what I was looking for but I think it's going to do the trick if nobody else can give me a code snippet to accomplish this within my program.  Going to give it a couple more days before closing this but if nobody else comes through the points will be yours  :)
I should of read more carefully, you wanted the password encoded to vnc's fixed 3des string, also note that only 8 plain-text chars are encrypted, anything after the 8th character is dropped
http://www.securiteam.com/securitynews/3P5QERFQ0Q.html

You can look into the source code of these various VNC applications and see how they do what they do... http://www.tightvnc.com/download.html and if you do take a snippet of their code make sure you understand the license for that code and such.
-rich
Avatar of batracy

ASKER

i'm going to go ahead and give you the points, richrumble, since nobody else seems to have a better solution.  thanks for pointing me in the right direcion.