Avatar ·

Python electronic signature

📁 Advanced Python Topics, question

Hello everyone. Help me figure out this issue. Consider this case: my program has users and I send files, the user's program reads this data. I want to verify the data against tampering. For this, I send a hash (in a file) of the transmitted file to compare. Now how to protect this hash file? 1. Asymmetric encryption - for this I need to keep the private key in the program to decrypt. Then they can decompile the program and find out the private key, then the public key and tamper with the data. 2. Electronic signature that encrypts with private and decrypts with public, this option seems suitable, but how to apply it is not clear, so that in Python I can verify the hash. I managed to sign the file, but for this I used in Windows (makecert.exe and signtool.exe) but how to do this in

Avatar ·

Asynchronously no way, but you can in executor.

import asynciodef read_file(file_name):    retu open(file_name).read()async def main():    loop = asyncio.get_event_loop()    data = await loop.run_in_executor(None, read_file, 'data.txt')    print(data)loop = asyncio.get_event_loop()loop.run_until_complete(main())

Log in to leave an answer

Blogs