def decrypt_pw(pwkey): #validate password if pwkey isn't null if pwkey <> '': #file encrypted... need password pw = pyDes.getDESpw() #ask for password k = pyDes.des(pw) #create encryption object using key pws = k.decrypt(pwkey,' ') #decrypt if pws <> pw: #comp to saved password print 'Invalid password. Exiting.' sys.exit() else: #decrypt the encrypted fields pwkey = pws return pwkey
def decrypt_pw(pwkey): #validate password if pwkey isn't null if pwkey <> '': #file encrypted... need password pw = pyDes.getDESpw() #ask for password k = pyDes.des(pw) #create encryption object using key pws = k.decrypt(pwkey, ' ') #decrypt if pws <> pw: #comp to saved password print 'Invalid password. Exiting.' sys.exit() else: #decrypt the encrypted fields pwkey = pws return pwkey
list_accounts() print "0. None" separator_line() acctnum = get_int('Delete account #: [0] ') if acctnum <= len(AcctArray) and acctnum <> 0: acctnum = acctnum-1 #delete the account print "Deleting account", AcctArray[acctnum][0], ":", AcctArray[acctnum][1] doit = raw_input('Confirm delete (Y/N) ').upper() if doit == 'Y': AcctArray.pop(acctnum) elif menu_option == 4: #change security settings while True: pwkey1 = pyDes.getDESpw('Enter NEW Master password') pwkey2 = pyDes.getDESpw('ReEnter password') if pwkey2 == pwkey1: pwkey = pwkey1 break else: print '\nPasswords do not match. Try again...\n' elif menu_option == 5: #remove security if pwkey <> '': doit = raw_input('Remove file encryption and password protection (Y/N) ').upper() if doit == 'Y': pwkey=''