* Forwarding messages with attachments of content-type multipart,
[alpine.git] / pith / smkeys.h
blob818f46ac518ba264ead91099c58bff78be4c0eec
1 /*
2 * $Id: smkeys.h 1074 2008-06-04 00:08:43Z hubert@u.washington.edu $
4 * ========================================================================
5 * Copyrighr 2013-2014 Eduardo Chappa
6 * Copyright 2008 University of Washington
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * ========================================================================
17 #ifdef SMIME
18 #ifndef PITH_SMKEYS_INCLUDED
19 #define PITH_SMKEYS_INCLUDED
22 #include "../pith/state.h"
23 #include "../pith/send.h"
25 #include <openssl/objects.h>
26 #include <openssl/evp.h>
27 #include <openssl/x509.h>
28 #include <openssl/pkcs7.h>
29 #include <openssl/pem.h>
30 #include <openssl/err.h>
31 #include <openssl/bio.h>
34 #define EMAILADDRLEADER "emailAddress="
35 #define CACERTSTORELEADER "cacert="
38 typedef struct personal_cert {
39 X509 *cert;
40 EVP_PKEY *key;
41 char *name;
42 char *keytext;
43 struct personal_cert *next;
44 } PERSONAL_CERT;
47 /* exported protoypes */
48 int add_certs_in_dir(X509_LOOKUP *lookup, char *path, char *ext, CertList **cdata);
49 X509_STORE *get_ca_store(void);
50 PERSONAL_CERT *get_personal_certs(char *d);
51 X509 *get_cert_for(char *email, WhichCerts ctype);
52 void save_cert_for(char *email, X509 *cert, WhichCerts ctype);
53 char **get_x509_subject_email(X509 *x);
54 EVP_PKEY *load_key(PERSONAL_CERT *pc, char *pass);
55 CertList *mem_to_certlist(char *contents);
56 void add_to_end_of_certlist(CertList **cl, char *name, X509 *cert);
57 void free_certlist(CertList **cl);
58 PERSONAL_CERT *mem_to_personal_certs(char *contents);
59 void free_personal_certs(PERSONAL_CERT **pc);
60 void get_fingerprint(X509 *cert, const EVP_MD *type, char *buf, size_t maxLen);
61 void mark_cert_deleted(WhichCerts ctype, char *email, unsigned state);
62 unsigned get_cert_deleted(WhichCerts ctype, char *email);
63 int smime_expunge_cert(WhichCerts ctype);
65 #endif /* PITH_SMKEYS_INCLUDED */
66 #endif /* SMIME */