c# - mask password string -
i'm creating c# windows forms app logs me in servers single click using mstsc. have admin name , password in code in plain text , wondered there way mask/hide password? store code in dropbox , prefer wasn't readable.
private void runasadmin(string server) { process rdcprocess = new process(); rdcprocess.startinfo.filename = environment.expandenvironmentvariables(@"%systemroot%\system32\cmdkey.exe"); rdcprocess.startinfo.arguments = "/generic:termsrv/192.168.0.217 /user:" + "administrator" + " /pass:" + "mypassword"; rdcprocess.start();
use function encrypt
, decrypt
password.
public function convertpassword(byval spassword string) dim stempchar string dim icount integer icount = 1 len(spassword) if asc(mid$(spassword, icount, 1)) < 128 stempchar = ctype(asc(mid$(spassword, icount, 1)) + 128, string) elseif asc(mid$(spassword, icount, 1)) > 128 stempchar = ctype(asc(mid$(spassword, icount, 1)) - 128, string) end if mid$(spassword, icount, 1) = chr(ctype(stempchar, integer)) next icount return spassword end function
Comments
Post a Comment