def SetProxyPassword(self, password): ''' Encrypts a password using the "secret" key ''' if password: encryptedPassword = Crypto.encrypt(password, self.GetPreference(self.PROXY_AUTH_KEY)).encode("hex") self.SetPreference(Preferences.PROXY_PASSWORD, encryptedPassword) else: self.SetPreference(Preferences.PROXY_PASSWORD, "")
def SetProxyPassword(self, password): ''' Encrypts a password using the "secret" key ''' if password: encryptedPassword = Crypto.encrypt( password, self.GetPreference(self.PROXY_AUTH_KEY)).encode("hex") self.SetPreference(Preferences.PROXY_PASSWORD, encryptedPassword) else: self.SetPreference(Preferences.PROXY_PASSWORD, "")
def GetProxyPassword(self): ''' Retrieves and decrypts the password ** Returns ** The password in cleartext ''' encryptedPassword = self.GetPreference(self.PROXY_PASSWORD) if encryptedPassword: password = Crypto.decrypt(encryptedPassword.decode("hex"), self.GetPreference(self.PROXY_AUTH_KEY) ) return password else: return ""
def GetProxyPassword(self): ''' Retrieves and decrypts the password ** Returns ** The password in cleartext ''' encryptedPassword = self.GetPreference(self.PROXY_PASSWORD) if encryptedPassword: password = Crypto.decrypt(encryptedPassword.decode("hex"), self.GetPreference(self.PROXY_AUTH_KEY)) return password else: return ""