Skip to content

A suggestion for a new crypto callback system #147

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

dagle
Copy link
Contributor

@dagle dagle commented Mar 22, 2023

This pr is more of discussion and trying to fix some of the issues in gmime regarding crypto towards 4.0

This suggestion tries to fix the following problems with the current
implementation.

  1. It's not introspectable. A user can't change what engine to use with crypto.
  2. You can't get why the key was created. As mention in GMime 4.0 Plan #74
    this can be a problem. Maybe the flags should be bitflags.
  3. Callback data. Some crypto engines can require additional data or you
    just want to save some state.

dagle added 2 commits March 22, 2023 12:01
This suggestion tries to fix the following problems with the current
implemtation.
1. It's not introspectable.
2. You can't get why the key was created. As mention in
jstedfast#74 (comment) ,
this can be a problem. Maybe the flags should be bitflags
3. Callback data. Some crypto engines can require additional data or you
just want to save some state.
@dagle
Copy link
Contributor Author

dagle commented Mar 22, 2023

The idea spawned with me wanting to try different cryptoengines, I implemented a gmime-sq
which kinda is (or was, glib-rs broke it last week) swap in replacement for gpg. It's a bit naive and doesn't use the latest features of sq but it works and it can use every function of cryptocontext. Personally I would like to choose the crypto engine easily without needing to wrap a lot of C.

The reason for trigger is not only do you might need to know why a cryptocontext should be created. I want this for being able to use it with my autocrypt-storage: sequioa-autocrypt (glib/gmime bindings coming soon), rather than using a gpg keyring to store my peers and keys. This way an implementation of decryption of an autoencrypted email could be engine agnostic.

@jstedfast
Copy link
Owner

I'm open to having the crypto APIs be redesigned to allow for other drop-in crypto implementations.

@jstedfast
Copy link
Owner

I don't understand why the password callback was made global - I think it should probably remain per-context.

@dagle
Copy link
Contributor Author

dagle commented May 10, 2023

Moved it back the password function. It's now introspectable. Dunno how to rerun checks, seems to be something wrong with github atm.

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 this pull request may close these issues.

2 participants