-
Notifications
You must be signed in to change notification settings - Fork 75
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
Panic when attempting to extract public key from a secret key with no signed user ID. #259
Comments
I produced another example with
I created a new key, ran |
this shouldn’t panic, but is certainly not a valid key |
|
I think the reason for this problem is that, historically, the metadata for the primary key lives on the binding signature of the "primary User ID". The attempt to extract an unsigned Concretely: the This kind of operation is very hairy, because OpenPGP certificates/public keys are complex, and it's not very rigorously defined what the semantics of a given set of key, signature and identity packets are supposed to be. I'm not sure how to proceed with this problem, and wonder what the practical application is - in what context(s) is |
we should just fail when reading this key, or return an error, I don’t think this is a format rpgp needs to support, just because the rfc is too vague |
I got convinced that we will need to add proper support for this… |
I have exported a private key from deltachat REPL.
Then I have split the key into packets with
sq packet dump private-key-default.asc
and got these files:As I tried to reproduce another bug reported on the forum https://support.delta.chat/t/cannot-import-private-key-from-text-file/2846 I removed
Signature
packets, both 2 (UserID signature) and 4 (key signature) by joining the key back without these packets:sq packet join private-key-default.asc-0--SecretKey private-key-default.asc-1--UserID private-key-default.asc-3--SecretSubkey > key-no-sig.asc
.Here is the resulting
key-no-sig.asc
file:Attempting to import it into Delta Chat results in a panic.
Minimal test reproducing the panic in rPGP:
.public_key()
panics:Panic happens here:
rpgp/src/composed/signed_key/shared.rs
Lines 116 to 118 in 63f55a7
All unsigned user IDs are removed here:
rpgp/src/composed/signed_key/shared.rs
Lines 32 to 38 in 63f55a7
The text was updated successfully, but these errors were encountered: