Quantcast
Channel: VMware Communities : Popular Discussions - VIX API
Viewing all articles
Browse latest Browse all 34639

Unable to log into VM using encrypted password

$
0
0

I’m trying to log into the VM using an encrypted password.

The password value is saved in and ini file, but the log in section is failing

to de-encrypt the password. I’m trying to use Unicode to perform the

enycryption. Here is what I have so far:

 

            string ans = ReadConfigValue(Section, Key);

 

            if (ans == null)

 

 

 

 

 

 

{               

{size:10pt}{

{color:blue}return DefaultValue;

 

}

 

 

 

 

            ans = ProtectValue(ans);

            return ans;

        }</span>

privatestring ReadConfigValue(string Section, string Key)

 

 

 

 

            int i = GetPrivateProfileString(Section, Key, "", temp, 512, this.configFilePath);

 

 

 

 

 

 

            if (i == 0)

 

 

 

{ return null; }

 

 

 

 

 

 

            return temp.ToString();

 

 

 

 

}</span>

 

 

 

 

 

 

privatestring ProtectValue(string password)

 

 

 

 

byte[]

{ bytes = {color:#2b91af}Encoding.Unicode.GetBytes(password);

            byte[] protectedPassword = ProtectedData.Protect(bytes, null, DataProtectionScope.CurrentUser);

            return Convert.ToBase64String(protectedPassword);

        }</span>

 

virtualMachine.LoginInGuest(configValues.Username, configValues.Password, configValues.Timeout);


Viewing all articles
Browse latest Browse all 34639

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>