pynacl

How do I do encryption/decryption without generating keypairs again?

╄→гoц情女王★ 提交于 2020-01-04 05:14:22
问题 I have been working on a project myself and using this website's codes as a guide. Is there any way, I can put the generation of keys into 1 file and encryption/decryption into another. How do I define bob_box without having to generate another pair of keys? GEN.PY: import libnacl.public def genkeys(): bob = libnacl.public.SecretKey() alice = libnacl.public.SecretKey() bob_box = libnacl.public.Box(bob.sk, alice.pk) alice_box = libnacl.public.Box(alice.sk, bob.pk) genkeys() ENDEcrypt: import