-
-
Notifications
You must be signed in to change notification settings - Fork 373
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
Subclassing PGP context #571
Comments
Made a number of OpenPgpContext methods virtual as well as reduced code duplication by making more code use the EnumeratePublic/SecretKey/KeyRings() methods so that fewer code would need to be overridden in a subclass to make things work. Should improve the situation for issue #571
Hmmm, good question. Looking at OpenPgpContext, I'll probably need to make some methods virtual (doing it now) so that you can override the following methods to obtain public/secret keys:
and optionally:
(If your database would make it quicker/faster to do lookups based on an address or fingerprint, you'd want to override the Enumerate methods that take a MailboxAddress - otherwise they are probably not worth overriding). You'll also need to override:
I would also recommend overriding the Import() methods - specifically the ones that import PgpPublicKeyRing, PgpSecretKeyRing and the Bundle variants. The other Import() methods just wrap those 4, so it's not necessary to override them. Does that help? |
Brilliant, thx as always :) BTW, what I wanted to do, is to create a "Direct Democracy" server system, allowing people to "vote" on yes/no types of questions. This would require a security mechanism to avoid fake votes to reach the server and be registered as actually votes, which I figure PGP crypto signatures could easily accomplish. Then I'd have a KYC (Know Your Client) process, that allows people to submit documents proving who they are (images of themselves, identification papers, etc) using the same process. By using emails as my foundation for accepting both KYC documents, and votes, I get to avoid creating clients for iPhone, Android, Windows, etc - But rather allow others to use their existing email systems, assuming they have some email client allowing them to sign their emails with their private PGP keys :) The thing I'd specifically need, is the ability to lookup a public key based upon the fingerprint. By overriding the methods taking a The This way during the reading process, I'd fetch the fingerprint, do a lookup into my database, verify the email's signature, and accept a vote (or discard it if it fails) ... |
That should be the case, yes. |
MimeKit 2.8.0 has just been released with the virtual method changes. |
Brilliant mate :) |
How would I start out when wanting to subclass a PGP context, to provide my own (completely custom) persistence layer. Specifically, the idea is to save both public and private keys in a database. This is something I'll have to do, first of all because it's the server itself that "owns" the private key, and for public keys there might be millions, and I also want to have referential integrity towards other database records ...?
Do you have any pointers as to how to get started with this?
The text was updated successfully, but these errors were encountered: