Update: UltraVNC 1.4.3.6 and UltraVNC SC 1.4.3.6: https://forum.uvnc.com/viewtopic.php?t=37885
Important: Please update to latest version before to create a reply, a topic or an issue: https://forum.uvnc.com/viewtopic.php?t=37864

Join us on social networks and share our announcements:
- Website: https://uvnc.com/
- GitHub: https://github.com/ultravnc
- Mastodon: https://mastodon.social/@ultravnc
- Facebook: https://www.facebook.com/ultravnc1
- X/Twitter: https://x.com/ultravnc1
- Reddit community: https://www.reddit.com/r/ultravnc
- OpenHub: https://openhub.net/p/ultravnc

UltraVNC password encryption algorithm

Post Reply
dad
8
8
Posts: 10
Joined: 2008-04-16 08:18

UltraVNC password encryption algorithm

Post by dad »

Hello,

I want to deploy UltraVNC 1.0.5.6 automatically and I need to compute the password stored in ultravnc.ini.

I made a little perl script to do it for 1.0.2, when it was stored in the registry.

Do you have any documentation for this ? I don't find it in the sources.

Regards.
redge
1000
1000
Posts: 6797
Joined: 2004-07-03 17:05
Location: Switzerland - Geneva

Re: UltraVNC password encryption algotithme

Post by redge »

just need to copy ultravnc.ini with the password set properly with winvnc on computer test/reference,
UltraVNC 1.0.9.6.1 (built 20110518)
OS Win: xp home + vista business + 7 home
only experienced user, not developer
dad
8
8
Posts: 10
Joined: 2008-04-16 08:18

Re: UltraVNC password encryption algotithme

Post by dad »

redge wrote:just need to copy ultravnc.ini with the password set properly with winvnc on computer test/reference,
The problem is that I need to deploy ultravnc on many sites, each site has WPKG to deploy application, and the password depends of the site.

Previously I was generating the password and put it in a reg file.
I wan to do the same with the ultravnc.ini:
- put a default configuration on each site server with a blank password
- run a script to update the password filed according to the site
- deploy it with WPKG.

Regards.
dad
8
8
Posts: 10
Joined: 2008-04-16 08:18

Re: UltraVNC password encryption algotithme

Post by dad »

dad wrote: The problem is that I need to deploy ultravnc on many sites, each site has WPKG to deploy application, and the password depends of the site.
Regards.
I finaly found it, it's the same ;-)

Sorry for the noise.
dad
8
8
Posts: 10
Joined: 2008-04-16 08:18

Re: UltraVNC password encryption algotithme

Post by dad »

dad wrote:
dad wrote: The problem is that I need to deploy ultravnc on many sites, each site has WPKG to deploy application, and the password depends of the site.
Regards.
I finaly found it, it's the same ;-)

Sorry for the noise.
For future reference:

Code: Select all

#!/usr/bin/perl -w

use strict;
use warnings;
use Getopt::Long;

Getopt::Long::Configure('gnu_getopt');
use Pod::Usage;

use Crypt::DES;

my ($password, $help, $man);

GetOptions('help|?' => \$help, 'man' => \$man, 'password=s' => \$password) or pod2usage(2);
pod2usage(1) if $help;
pod2usage(-exitstatus => 0, -verbose =>2) if $man;

pod2usage (1) if !$password;

my $realkey = pack ('H16', "E84AD660C4721AE0");

my $cipher = Crypt::DES->new($realkey);

# truncate the password to 8 chars
$password = substr ($password, 0, 8) if length $password > 8;

my $cryptpass = $cipher->encrypt($password);

# Foreach byte, unpack it, join the result list and print it in
# uppercase
print uc join ('', map {unpack('H2', $_)} split (//, $cryptpass));

__END__

=head1 vncpass.pl

Generate a VNC password suitable for ultravnc.ini.

=head1 SYNOPSIS

vncpass.pl [options]

Options:
	--help		this help
	--password	password to encrypt

=head1 OPTIONS

=over 8

=item B<--help>

Print the online help

=item B<--password>

The password to encrypt.

=back

=head1 DESCRIPTION

B<vncpass.pl> generate a password suitable for ultravnc.ini.

=cut
amckeen
Posts: 1
Joined: 2005-05-24 19:43

Re: UltraVNC password encryption algotithme

Post by amckeen »

Does anyone have an example of VNC password encryption in Delphi? This is the closest I've been able to get using Google searches, but it doesn't produce the correct encrypted key:

Code: Select all

uses
 DECCipher, DECFmt;

var
  FSharedSecret: RawByteString;
begin
  FSharedSecret   := #23#82#107#6#35#78#88#7;
  with TCipher_1DES.Create do
  try
    Mode := cmCBCx;

    Init(FSharedSecret);
    lblEncrypted.Caption := EncodeBinary( edtClearText.Text, TFormat_HEX );
  finally
    Free;
  end;
Thank you!
UltraVNC v1.0.0 RC 20.3
MS RC4 Plugin-v1.1.7.0
Windows XP Pro SP2
gene_wood
Posts: 1
Joined: 2011-06-21 00:01

Re: UltraVNC password encryption algotithme

Post by gene_wood »

You'll want to append 2 characters to the end of the password hash generated by this perl tool. UltraVNC is expecting a hash 2 bytes longer though it doesn't use the final two bytes. You could just append a "00" onto the end of the generated hash.
dad wrote:
dad wrote:
dad wrote: Sorry for the noise.
For future reference:

Code: Select all

#!/usr/bin/perl -w

use strict;
use warnings;
use Getopt::Long;

Getopt::Long::Configure('gnu_getopt');
use Pod::Usage;

use Crypt::DES;

my ($password, $help, $man);

GetOptions('help|?' => \$help, 'man' => \$man, 'password=s' => \$password) or pod2usage(2);
pod2usage(1) if $help;
pod2usage(-exitstatus => 0, -verbose =>2) if $man;

pod2usage (1) if !$password;

my $realkey = pack ('H16', "E84AD660C4721AE0");

my $cipher = Crypt::DES->new($realkey);

# truncate the password to 8 chars
$password = substr ($password, 0, 8) if length $password > 8;

my $cryptpass = $cipher->encrypt($password);

# Foreach byte, unpack it, join the result list and print it in
# uppercase
print uc join ('', map {unpack('H2', $_)} split (//, $cryptpass));

__END__

=head1 vncpass.pl

Generate a VNC password suitable for ultravnc.ini.

=head1 SYNOPSIS

vncpass.pl [options]

Options:
	--help		this help
	--password	password to encrypt

=head1 OPTIONS

=over 8

=item B<--help>

Print the online help

=item B<--password>

The password to encrypt.

=back

=head1 DESCRIPTION

B<vncpass.pl> generate a password suitable for ultravnc.ini.

=cut
rendezz
Posts: 1
Joined: 2011-10-17 12:11

Re: UltraVNC password encryption algorithm

Post by rendezz »

Hey guys

Just updated the code for perl, its

Code: Select all

#!/usr/bin/perl -w

use strict;
use warnings;
use Getopt::Long;

Getopt::Long::Configure('gnu_getopt');
use Pod::Usage;

use Crypt::DES;

my ($password, $help, $man);

GetOptions('help|?' => \$help, 'man' => \$man, 'password=s' => \$password) or pod2usage(2);
pod2usage(1) if $help;
pod2usage(-exitstatus => 0, -verbose =>2) if $man;

pod2usage (1) if !$password;

my $realkey = pack ('H16', "E84AD660C4721AE0");

my $cipher = Crypt::DES->new($realkey);

# pad then truncate the password to 8 chars
$password = $password . "\x00\x00\x00\x00\x00\x00\x00\x00\x00";
$password = substr ($password, 0, 8) if length $password > 8;

my $cryptpass = $cipher->encrypt($password);

# Foreach byte, unpack it, join the result list and print it in
# uppercase
print uc join ('', map {unpack('H2', $_)} split (//, $cryptpass));

__END__

=head1 vncpass.pl

Generate a VNC password suitable for ultravnc.ini.

=head1 SYNOPSIS

vncpass.pl [options]

Options:
   --help      this help
   --password   password to encrypt

=head1 OPTIONS

=over 8

=item B<--help>

Print the online help

=item B<--password>

The password to encrypt.

=back

=head1 DESCRIPTION

B<vncpass.pl> generate a password suitable for ultravnc.ini.

=cut
druss
Posts: 3
Joined: 2012-08-03 09:06

Re: UltraVNC password encryption algorithm

Post by druss »

Hello,

I have C# implementation, may be for someone it will be useful:

Code: Select all

public static string EncryptPassword(string plainPassword)
{
 DES des = CreateDES();
 ICryptoTransform cryptoTransfrom = des.CreateEncryptor();
 
 plainPassword = plainPassword + "\0\0\0\0\0\0\0\0";
 plainPassword = plainPassword.Length > 8 ? plainPassword.Substring(0, 8) : plainPassword;
 byte[] data = Encoding.ASCII.GetBytes(plainPassword);
 byte[] encryptedBytes = cryptoTransfrom.TransformFinalBlock(data, 0, data.Length);
 
 return ByteArrayToHex(encryptedBytes) + "00";
}
 
public static string DecryptPassword(string encryptedPassword)
{
 DES des = CreateDES();
 ICryptoTransform cryptoTransfrom = des.CreateDecryptor();
 byte[] data = HexToByteArray(encryptedPassword.Substring(0, encryptedPassword.Length - 2));
 byte[] decryptedBytes = cryptoTransfrom.TransformFinalBlock(data, 0, data.Length);
 
 return Encoding.ASCII.GetString(decryptedBytes);
 }
 
private static DES CreateDES()
{
 byte[] key = { 0xE8, 0x4A, 0xD6, 0x60, 0xC4, 0x72, 0x1A, 0xE0 };
 DES des = DES.Create();
 des.Key = key;
 des.IV = key;
 des.Mode = CipherMode.ECB;
 des.Padding = PaddingMode.Zeros;
 return des;
} 
For more details view this article
Post Reply