* General helper functions.
*/
+static void convert_to_7bit (BODY * a)
+{
+ while (a) {
+ if (a->type == TYPEMULTIPART) {
+ if (a->encoding != ENC7BIT) {
+ a->encoding = ENC7BIT;
+ convert_to_7bit (a->parts);
+ } else {
+ convert_to_7bit (a->parts);
+ }
+ }
+ else if (a->type == TYPEMESSAGE &&
+ m_strcasecmp(a->subtype, "delivery-status")) {
+ if (a->encoding != ENC7BIT)
+ mutt_message_to_7bit (a, NULL);
+ }
+ else if (a->encoding == ENC8BIT)
+ a->encoding = ENCQUOTEDPRINTABLE;
+ else if (a->encoding == ENCBINARY)
+ a->encoding = ENCBASE64;
+ else if (a->content && a->encoding != ENCBASE64 &&
+ (a->content->from || a->content->space))
+ a->encoding = ENCQUOTEDPRINTABLE;
+ a = a->next;
+ }
+}
+
+
/* return true when S points to a didgit or letter. */
static int digit_or_letter (const unsigned char *s)
{
return a;
}
-
-BODY *crypt_pgp_sign_message (BODY * a)
-{
- return sign_message (a, 0);
-}
-
-BODY *crypt_smime_sign_message (BODY * a)
-{
- return sign_message (a, 1);
-}
-
/*
* Implementation of `encrypt_message'.
*/
/* Encrypt the mail body A to all keys given as space separated keyids
or fingerprints in KEYLIST and return the encrypted body. */
-BODY *crypt_pgp_encrypt_message (BODY * a, char *keylist, int sign)
+static BODY *crypt_pgp_encrypt_message (BODY * a, char *keylist, int sign)
{
char *outfile = NULL;
BODY *t;
/* Encrypt the mail body A to all keys given as space separated
fingerprints in KEYLIST and return the S/MIME encrypted body. */
-BODY *crypt_smime_build_smime_entity (BODY * a, char *keylist)
+static BODY *crypt_smime_build_smime_entity (BODY * a, char *keylist)
{
char *outfile = NULL;
BODY *t;
/* Do the actual verification step. With IS_SMIME set to true we
assume S/MIME (surprise!) */
-int crypt_verify_one(BODY *sigbdy, STATE *s, FILE *fp, int is_smime)
+static int crypt_verify_one(BODY *sigbdy, STATE *s, FILE *fp, int is_smime)
{
int badsig = -1;
int anywarn = 0;
return ret;
}
-void crypt_invoke_import(FILE *stream, int smime)
+static void crypt_invoke_import(FILE *stream, int smime)
{
gpgme_ctx_t ctx = create_gpgme_context(smime);
gpgme_data_t data;
if (msg->security & SIGN) {
if (msg->security & APPLICATION_SMIME) {
- if (!(tmp_pbody = crypt_smime_sign_message (msg->content)))
+ if (!(tmp_pbody = sign_message(msg->content, 1)))
return -1;
pbody = tmp_smime_pbody = tmp_pbody;
}
if ((msg->security & APPLICATION_PGP)
&& (!(flags & ENCRYPT) || option (OPTPGPRETAINABLESIG))) {
- if (!(tmp_pbody = crypt_pgp_sign_message (msg->content)))
+ if (!(tmp_pbody = sign_message(msg->content, 0)))
return -1;
flags &= ~SIGN;
}
}
-
-
-void convert_to_7bit (BODY * a)
-{
- while (a) {
- if (a->type == TYPEMULTIPART) {
- if (a->encoding != ENC7BIT) {
- a->encoding = ENC7BIT;
- convert_to_7bit (a->parts);
- } else {
- convert_to_7bit (a->parts);
- }
- }
- else if (a->type == TYPEMESSAGE &&
- m_strcasecmp(a->subtype, "delivery-status")) {
- if (a->encoding != ENC7BIT)
- mutt_message_to_7bit (a, NULL);
- }
- else if (a->encoding == ENC8BIT)
- a->encoding = ENCQUOTEDPRINTABLE;
- else if (a->encoding == ENCBINARY)
- a->encoding = ENCBASE64;
- else if (a->content && a->encoding != ENCBASE64 &&
- (a->content->from || a->content->space))
- a->encoding = ENCQUOTEDPRINTABLE;
- a = a->next;
- }
-}
-
-
static void extract_keys_aux(FILE *fpout, HEADER *h)
{
mutt_parse_mime_message (Context, h);
#define KEYFLAG_ABILITIES (KEYFLAG_CANSIGN|KEYFLAG_CANENCRYPT|KEYFLAG_PREFER_ENCRYPTION|KEYFLAG_PREFER_SIGNING)
-/*-- new API --*/
-
-void crypt_invoke_import(FILE *stream, int smime);
int crypt_send_menu(HEADER *msg, int *redraw, int smime);
-int crypt_verify_one(BODY *, STATE *s, FILE *fp, int smime);
-
-
-/*-- crypt.c --*/
-
int mutt_protect (HEADER *, char *);
int mutt_signed_handler (BODY *, STATE *);
int mutt_parse_crypt_hdr (char *, int);
-void convert_to_7bit (BODY *);
/* Check out the type of encryption used and set the cached status
values if there are any. */
/* Generate a PGP public key attachment. */
BODY *crypt_pgp_make_key_attachment (char *tempf);
-/* Create a new body with a PGP signed message from A. */
-BODY *crypt_pgp_sign_message (BODY * a);
-
-/* Warning: A is no longer freed in this routine, you need to free it
- later. This is necessary for $fcc_attach. */
-BODY *crypt_pgp_encrypt_message (BODY * a, char *keylist, int sign);
-
/* fixme: needs documentation */
void crypt_pgp_extract_keys_from_attachment_list (FILE * fp, int tag,
BODY * top);
/* Check that the sender matches. */
int crypt_smime_verify_sender (HEADER * h);
-/* fixme: Needs documentation. */
-BODY *crypt_smime_sign_message (BODY * a);
-
-/* fixme: needs documentation. */
-BODY *crypt_smime_build_smime_entity (BODY * a, char *certlist);
-
#endif /*MUTT_CRYPT_H */