AnsweredAssumed Answered

Encrypted String

Question asked by shamr0ck01 on Jul 3, 2012
Latest reply on Dec 31, 2012 by pfoppe
Is there way to pass encrypted string parameters as text?

I am using a python script that takes a username and password and I would like the password to be masked in the dialogue box but  if I do this that string is not usable later in my script when I use it as a parameter in a log in.

See smtpPwd Below

Tested the code and it works fine when Parameter 7 is not set as an encrypted string  but just as regular string.

sendto = gp.GetParameterAsText(0).split(";") fromaddr = gp.GetParameterAsText(1) subject = gp.GetParameterAsText(2) text = gp.GetParameterAsText(3) zipfile = gp.GetParameterAsText(4).replace("\\",os.sep) maxsize = int(gp.GetParameterAsText(5)) * 1000000 smtpUser = gp.GetParameterAsText(6) smtpPwd = gp.GetParameterAsText(7)  msg = MIMEMultipart('alternative') msg['From'] = fromaddr msg['To'] = COMMASPACE.join(sendto) msg['Date'] = formatdate(localtime=True) msg['Subject'] = subject  html = """<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"> <body style="font-size:12px;font-family:Verdana"><p>Please download the attachment and then import into ArcMap to view.</p></body></html>""" #attach the zip file HTML_BODY = MIMEText(html, 'html') msg.attach( HTML_BODY) part = MIMEBase('application', "zip")   # Change if different file type sent. part.set_payload( open(zipfile,"rb").read() ) email.encoders.encode_base64(part) part.add_header('Content-Disposition', 'attachment; filename="%s"' % os.path.basename(zipfile)) msg.attach(part)  #Sending Mail server = SMTP('blah') server.set_debuglevel(1) server.login(smtpUser,smtpPwd) server.sendmail(fromaddr, sendto, msg.as_string()) server.quit()

Outcomes