简体   繁体   中英

how to convert ed25519 keys in pgsql database and retrieve them back

I want to store the Public and Private keys in pgsql database and then when required want to retrieve them back.

I tried converting it ,storing and retrieving it from database but this results in error:
TypeError: Odd-length string

python testenc.py "TEST" 
"5b69ecf0fb808693e6fdf6514fd8f1eca20b96e407ec78681269b24463d2cc0" 
"3d4b091ff086660c8adfd3318d43563a2befb85619bb4422161a4e9ae0837131"

Input Message is : TEST

Traceback (most recent call last):

File "testenc.py", line 31, in <module>
    skbob = pickle.loads(binascii.unhexlify(sys.argv[2]))

TypeError: Odd-length string

This can be done as follows:

1) use library pickle for this. 2) Use a socket communication and after receiving data on socket use pickle.load(received string) to maintain the key intact.

3) While sending data on socket "use pickle.dump(string)" so that data/Key remains intact.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM