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

Encryption status from rnp_op_verify_* #1107

Closed
kaie opened this issue Apr 26, 2020 · 3 comments · Fixed by #1174
Closed

Encryption status from rnp_op_verify_* #1107

kaie opened this issue Apr 26, 2020 · 3 comments · Fixed by #1174

Comments

@kaie
Copy link
Contributor

kaie commented Apr 26, 2020

When processing an encrypted message, prior to decrypting, it's unknown if a message is both encrypted and signed.

If the message uses the combined signature and encryption encoding, calling rnp_decrypt will not process the signature. Consequently I'm using the rnp_op_verify_* functions, which will optionally decrypt, and also allow retrieval of the signature information.

However, it seems there isn't a way to obtain status information about the decryption.

Did RNP have to decrypt the message?
Right now, I only can deduce that from the outer context, e.g. the message was received in a MIME message that said it's encrypted. But potentially that conclusion could be incorrect (message claims to be encrypted, but isn't).

Is there a reliable way to determine, if processing the data given to rnp_op_verify_* involved decryption?

Also it would be convenient to obtain status information about the decryption, e.g. which key ID was used to perform the decryption?

Unless there's other ways to obtain this information (without having to do an additional round of full processing with rnp_decrypt), would it be reasonable to add an API like the following?

rnp_result_t rnp_op_verify_get_decrypt_info(rnp_op_verify_t op, bool *was_decrypted, char **keyid);

Also, if it's initially unknown if there's a signature inside a message, the rnp_op_verify_* call might do decryption, only, without performing any signature verification. However, it seems possible to reliably detect this scenario, if rnp_op_verify_get_signature_count returns a zero count.

@kaie
Copy link
Contributor Author

kaie commented Apr 26, 2020

Also, it would be nice to have a mechanism to query the full list of key IDs a message was encrypted to, even if we're unable to decrypt the message (because we don't have the secret key).

@ni4
Copy link
Contributor

ni4 commented Apr 26, 2020

@kaie Yeah, I was also thinking about adding some convenient way to obtain this data.

Right now the possible solution would be:

  1. During decryption password is requested (if the secret key is encrypted and locked). So you may make use of data, passed via rnp_ffi_set_pass_provider()'s callback.
  2. To check whether message is actually encrypted, and get list of keyid's, you may use the rnp_dump_packets_to_json() function. However, this would not display inner signatures. But, if you would decrypt first, then you'll be able to get signatures information as well.

@kaie
Copy link
Contributor Author

kaie commented May 11, 2020

1. During decryption password is requested (if the secret key is encrypted and locked). So you may make use of data, passed `rnp_ffi_set_pass_provider()`'s callback.

Thank you, that's a very helpful hint.

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