Just tired using Win32::CryptData. Seeking your help.
Little background. I am not much qualified in Perl.
Working on a windows machine with perl(cygwin). I have created several .rdp files for automatic logon on few remote machines. Need to enter password in this field - "password 51:b:" - in encrypted state.
Picked up the module and used below code stated in module's documentation.
use strict; use Win32::CryptData qw(:flags); my $DataIn = '<mypassword>'; my $DataDescr = 'This is the description'; my $OptionalEntropy = 'mysecret'; my $Reserved = undef; my %PromptStruct = ( PromptFlags => CRYPTPROTECT_PROMPT_ON_PROTECT | CRYPTPROTECT_PROMP +T_ON_UNPROTECT | CRYPTPROTECT_PROMPT_STRONG, hwndApp => undef, Prompt => 'This is the caption' ); my $Flags = CRYPTPROTECT_AUDIT; my $DataOut; my $ret = Win32::CryptData::CryptProtectData( \$DataIn, \$DataDescr, \$Optio +nalEntropy, \$Reserved, \%PromptStruct, $Flags, \$DataOut ); if ($ret) { print "Encrypted data (hex): " . unpack( "H*", $DataOut ) . "\n"; } else { print "Error: $^E\n"; }
I have tried both medium and high security level. It creates a password but that is not working through rdp files.
Someone gave me a self-made .exe in C-Sharp code, which gives an encrypted password and makes that rdp file work properly.
Please help me in understanding whats the problem in perl code, that I can't get correct encryption.
Also, the password given by perl script is very different and much longer than the one given by C-Sharp exe.
In reply to Problem working with Win32::CryptData by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |