Working on a "Password Saver" and will be using the module "cryptography" to encrypt the passwords. I need to save the key you generate from cryptography in the database as well, but I am not sure how you actually do this.
Done some google searches myself and it seems to be called a "byte string"? Not really sure what it is though.
This is what I have currently:
from cryptography.fernet import Fernet
import mysql.connector
db = mysql.connector.connect(
host='localhost',
user='root',
password='',
database='password_saver'
)
cursor = db.cursor()
key = Fernet.generate_key()
cursor.execute(f"INSERT INTO `encryption`(`encryption_key`) VALUES ({key})")
With that code I am getting this error:
mysql.connector.errors.ProgrammingError: 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'b'cryptographys key is here')' at line 1
Not sure if there is a specific data type I need to use for SQL or if it is something I need to do in python?