#include "mutt.h"
#include "crypt.h"
-#include "crypt-mod.h"
-
-/*
- Generic
-*/
-
-extern struct crypt_module_specs crypt_mod_pgp_classic;
-extern struct crypt_module_specs crypt_mod_smime_classic;
-
-#ifdef CRYPT_BACKEND_GPGME
-extern struct crypt_module_specs crypt_mod_pgp_gpgme;
-extern struct crypt_module_specs crypt_mod_smime_gpgme;
-#endif
+#include "crypt-gpgme.h"
+
+struct crypt_module_specs crypt_mod_SMIME_gpgme = {
+ smime_gpgme_init,
+ smime_gpgme_decrypt_mime,
+ smime_gpgme_application_handler,
+ NULL, /* encrypted_handler */
+ smime_gpgme_findkeys,
+ smime_gpgme_sign_message,
+ smime_gpgme_verify_one,
+ smime_gpgme_send_menu,
+
+ NULL, /* pgp_encrypt_message */
+ NULL, /* pgp_make_key_attachment */
+ NULL, /* pgp_check_traditional */
+ NULL, /* pgp_traditional_encryptsign */
+ NULL, /* pgp_invoke_getkeys */
+ NULL, /* pgp_invoke_import */
+ NULL, /* pgp_extract_keys_from_attachment_list */
+
+ NULL, /* smime_getkeys */
+ smime_gpgme_verify_sender,
+ smime_gpgme_build_smime_entity,
+ NULL, /* smime_invoke_import */
+};
+
+struct crypt_module_specs crypt_mod_PGP_gpgme = {
+ pgp_gpgme_init,
+ pgp_gpgme_decrypt_mime,
+ pgp_gpgme_application_handler,
+ pgp_gpgme_encrypted_handler,
+ pgp_gpgme_findkeys,
+ pgp_gpgme_sign_message,
+ pgp_gpgme_verify_one,
+ pgp_gpgme_send_menu,
+
+ /* PGP specific. */
+ pgp_gpgme_encrypt_message,
+ NULL, /* pgp_make_key_attachment, */
+ pgp_gpgme_check_traditional,
+ NULL, /* pgp_traditional_encryptsign */
+ NULL, /* pgp_invoke_getkeys */
+ pgp_gpgme_invoke_import, /* pgp_invoke_import */
+ pgp_gpgme_from_attachment_list,
+ /* pgp_extract_keys_from_attachment_list */
+
+ NULL, /* smime_getkeys */
+ NULL, /* smime_verify_sender */
+ NULL, /* smime_build_smime_entity */
+ NULL, /* smime_invoke_import */
+};
void crypt_init (void)
{
- if (
-#ifdef CRYPT_BACKEND_GPGME
- (!option (OPTCRYPTUSEGPGME))
-#else
- 1
-#endif
- )
- crypto_module_register (&crypt_mod_pgp_classic);
-
- if (
-#ifdef CRYPT_BACKEND_GPGME
- (!option (OPTCRYPTUSEGPGME))
-#else
- 1
-#endif
- )
- crypto_module_register (&crypt_mod_smime_classic);
-
- if (option (OPTCRYPTUSEGPGME)) {
-#ifdef CRYPT_BACKEND_GPGME
- crypto_module_register (&crypt_mod_pgp_gpgme);
- crypto_module_register (&crypt_mod_smime_gpgme);
-#else
- mutt_message (_("\"crypt_use_gpgme\" set"
- " but not build with GPGME support."));
- if (mutt_any_key_to_continue (NULL) == -1)
- mutt_exit (1);
-#endif
- }
-
-#if defined CRYPT_BACKEND_CLASSIG_PGP || defined CRYPT_BACKEND_CLASSIG_SMIME || defined CRYPT_BACKEND_GPGME
- if (CRYPT_MOD_CALL_CHECK (PGP, init))
- (CRYPT_MOD_CALL (PGP, init)) ();
-
- if (CRYPT_MOD_CALL_CHECK (SMIME, init))
- (CRYPT_MOD_CALL (SMIME, init)) ();
-#endif
+ (CRYPT_MOD_CALL(PGP, init))();
+ (CRYPT_MOD_CALL(SMIME, init))();
}
-
/* Show a message that a backend will be invoked. */
void crypt_invoke_message (int type)
{
mutt_message _("Invoking S/MIME...");
}
}
-\f
-/*
-
- PGP
-
-*/
-
-
-/* Reset a PGP passphrase */
-void crypt_pgp_void_passphrase (void)
-{
- if (CRYPT_MOD_CALL_CHECK (PGP, void_passphrase))
- (CRYPT_MOD_CALL (PGP, void_passphrase)) ();
-}
-
-int crypt_pgp_valid_passphrase (void)
-{
- if (CRYPT_MOD_CALL_CHECK (PGP, valid_passphrase))
- return (CRYPT_MOD_CALL (PGP, valid_passphrase)) ();
-
- return 0;
-}
-
+/* PGP */
/* Decrypt a PGP/MIME message. */
int crypt_pgp_decrypt_mime (FILE * a, FILE ** b, BODY * c, BODY ** d)
*/
-/* Reset an SMIME passphrase */
-void crypt_smime_void_passphrase (void)
-{
- if (CRYPT_MOD_CALL_CHECK (SMIME, void_passphrase))
- (CRYPT_MOD_CALL (SMIME, void_passphrase)) ();
-}
-
-int crypt_smime_valid_passphrase (void)
-{
- if (CRYPT_MOD_CALL_CHECK (SMIME, valid_passphrase))
- return (CRYPT_MOD_CALL (SMIME, valid_passphrase)) ();
-
- return 0;
-}
-
/* Decrypt am S/MIME message. */
int crypt_smime_decrypt_mime (FILE * a, FILE ** b, BODY * c, BODY ** d)
{
return (-1);
}
-/* MIME handler for an PGP/MIME encrypted message. */
-int crypt_smime_encrypted_handler (BODY * a, STATE * s)
-{
- if (CRYPT_MOD_CALL_CHECK (SMIME, encrypted_handler))
- return (CRYPT_MOD_CALL (SMIME, encrypted_handler)) (a, s);
- return (-1);
-}
-
/* fixme: Needs documentation. */
void crypt_smime_getkeys (ENVELOPE * env)
{