I saved the password in the database in encrypted form and this is done but when I am logging from that password(without encryption) it's not logging but when I use the encrypted password then it's logging but I want to login from decrypted password.
What I have tried:
from cryptography.fernet import Fernet
import tkinter as tk
from tkinter import messagebox
import pyodbc
Password=ttk.Entry(frame,textvariable=string,text="",show='*')
def std_register(path):
conn = pyodbc.connect('Driver={SQL Server};''Server=SHUMAILA\SHUM;''Database=FYP;''Trusted_Connection=yes;')
cursor=conn.cursor()
std_password=Password.get()
encrypt_password=std_password.encode()
key = Fernet.generate_key()
f = Fernet(key)
encrypted_password = f.encrypt(encrypt_password)
cursor.execute('insert into student_registeration_record(std_password)values(?)',encrypted_password
messagebox.showinfo('Registered','Successfully registered')
cursor.commit()
signup=tk.Button(root,text="Browse here",command=std_register)
signup.place()
from cryptography.fernet import Fernet
import tkinter as tk
from tkinter import messagebox
import pyodbc
Password_txt=ttk.Entry(frame,textvariable=string,text="",show='*')
def login(event=None):
password=Password_txt.get()
cursor.execute('select std_password from student_registeration_record where std_password)=?',password
if cursor.fetchone() is not None:
messagebox.showinfo("Message","Successfully login")
else:
messagebox.showinfo("Message","Invalid username or password")
cursor.close()
conn.close()
signin=tk.Button(root,text="Browse here",command=login)
signin.place()
both methods are done on different files