vncpasswd in perl
Craig M. Votava
craig "at" lucent.com
Fri Mar 5 18:24:01 2004
Folks-
I want to re-implement vncpasswd in perl (for various reasons), but
I need a bit of help. Any suggestions are appreciated:
Here's a sample perl script that can encode and decode a string:
===========================================================================
#!/bin/perl
use Crypt::CBC;
my $key = pack("C8", 23, 82, 107, 6, 35, 78, 88, 7);
$cipher = Crypt::CBC->new({
'key'=>$key, 'cipher'=>'DES', 'prepend_iv'=>0, 'regenerate_key'=>0
});
$ciphertext = $cipher->encrypt("This data is hush hush");
$plaintext = $cipher->decrypt($ciphertext);
print "Encrypted: $ciphertext\n";
print "Decrypted: $plaintext\n";
===========================================================================
The key value comes from rfb/vncAuth.cxx:
static unsigned char obfuscationKey[] = {23,82,107,6,35,78,88,7};
My question is can I simply write $ciphertext to the $HOME/.vnc/passwd
file and have it work correctly when I run vncviewer?
Thanks
-Craig Votava
Lucent Technologies