问题描述
我取字符串输入,然后使用以下代码对其进行加密并存储在 MysqL 数据库中(列数据类型为 varbinary())
MAJOR?=0
MInor?=1
VERSION=$(MAJOR).$(MInor)
#vars
IMAGENAME=regex_locator
IMAGEFULLNAME=${IMAGENAME}-${VERSION}
CONTAINERNAME=${IMAGEFULLNAME}-TESTCONT
.PHONY: help build run all
help:
@echo ""
@echo "Makefile commands:"
@echo "build"
@echo "push"
@echo "all"
.DEFAULT_GOAL := all
build:
@docker build -t regex_locator-img .
run:
@docker run -dit --name regex_locator-test_cont regex_locator-img
@docker cp ./py_code/ regex_locator-test_cont:/regex_locator/proj/
@docker exec -it regex_locator-test_cont /regex_locator/proj/py_code/run_tests.py
all: build run
然后我尝试获取如下数据
encrypted_pass=f.encrypt(psswd.encode())
input_into_table=[(usrnme,wbst,encrypted_pass)]
mycursor.executemany("insert into passvault(username,website,password) values(%s,%s,%s)",input_into_table)
mycursor.execute("select username,password from passvault where Website='"+pass_to_fetch+"'")
result=mycursor.fetchone()
decrypted_pass=for_fernet.decrypt(result[1]).decode()
当我打印 TypeError: token must be bytes
时,它给出 type(result[1])
如前所述,数据存储在 varbinary() 类型的字段中。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)