I already read a lot about this topic but I don't really understand how I should implement this. I want to encrypt a (text) file of a user A. The user has set up a password for his/her account and the text file is being encrypted with this password. Now the user shares his encrypted file with another user B. This user, of course, has another password set for his/her account. However, he/she and just he/she, should be able to decrypt the text without knowing user A's password.
I guess I have to use a private/public key algorithm. I already looked at PyCrypto
but I don't really understand how to create a public/private key from user A's password.
I'd prefer a real python solution that does not include a pgp executable or dll.
Some pseudo code:
key, encrypted = generate_public_key_and_encrypt(userA.password, "Hello World!")
userA.share_data(userB, key)
decrypted = decrypt(userB.password, key, encrypted)