Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass phrase in memory. Decrypt an attachment #1255

Closed
DenBond7 opened this issue May 26, 2021 · 4 comments · Fixed by #1285
Closed

Pass phrase in memory. Decrypt an attachment #1255

DenBond7 opened this issue May 26, 2021 · 4 comments · Fixed by #1285
Assignees
Milestone

Comments

@DenBond7
Copy link
Collaborator

DenBond7 commented May 26, 2021

as a part of #372

@DenBond7
Copy link
Collaborator Author

@tomholub I'd like to discuss a realization for the current issue. To fix NEED_PASSPHRASE we can follow 2 ways:

  1. Before the downloading we check if we have a decrypted file( .pgp is existed). Then we can check if there is at least one key with a missed passphrase. Then we will show a dialog where we will ask a user to provide missed passphrases. All user actions will be on the message details screen

image

pros

  • logic is simple for a user. We don't leave this screen

cons

  • We have to ask all missed passphrases because we don't know what exactly key will be used for decryption
  1. After the decryption if an error has occurred we show a hint

collapsed
image

expanded

image

If a user clicks on that notification we will move him to the following screen

image

Then a user will be able to provide a passphrase for some key.

pros

  • we can 100% be sure what exactly key has missed passphrase and ask a user only needed passphrase

cons

  • logic a little difficult for a user. We have to leave the message details screen and navigate over the app.

@DenBond7
Copy link
Collaborator Author

I was wrong. We can easily use the first way. Then we will have the following logic:

  1. Click on the download button
  2. Check if we have block.type == MsgBlock.Type.DECRYPT_ERROR with decryptErrorDetails.type == DecryptErrorDetails.Type.NEED_PASSPHRASE for the current message
  3. If 2. == yes - use the same logic as we use for the FIX button. We can ask for the missed passphrases of the right keys. When a user will provide at least one missed passphrase -> Go to 1.
  4. if 2. == no - try to download and decrypt. All as before.

DenBond7 added a commit that referenced this issue Jun 10, 2021
@DenBond7
Copy link
Collaborator Author

ezgif com-gif-maker (1)

@tomholub
Copy link
Collaborator

tomholub commented Jun 10, 2021 via email

IvanPizhenko pushed a commit that referenced this issue Jun 10, 2021
* Improve handling PgpDecrypt.DecryptionErrorType.NEED_PASSPHRASE.| #1255

* Improved AttachmentNotificationManager.errorHappened().| #1255

* Added handling PgpDecrypt.DecryptionErrorType.NEED_PASSPHRASE during the att decryption(notification).| #1255

* Made KeysStorageImpl.getPgpKeyDetailsList() synchronized to prevent crashes.| #1255

* Added asking a missed passphrase if we trying to download encrypted attachments.| #1255

* Added a test.| #1255
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants