1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*  GMime
3  *  Copyright (C) 2000-2020 Jeffrey Stedfast
4  *
5  *  This library is free software; you can redistribute it and/or
6  *  modify it under the terms of the GNU Lesser General Public License
7  *  as published by the Free Software Foundation; either version 2.1
8  *  of the License, or (at your option) any later version.
9  *
10  *  This library is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  *  Lesser General Public License for more details.
14  *
15  *  You should have received a copy of the GNU Lesser General Public
16  *  License along with this library; if not, write to the Free
17  *  Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
18  *  02110-1301, USA.
19  */
20 
21 
22 #ifndef __GMIME_APPLICATION_PKCS7_MIME_H__
23 #define __GMIME_APPLICATION_PKCS7_MIME_H__
24 
25 #include <glib.h>
26 
27 #include <gmime/gmime-part.h>
28 #include <gmime/gmime-pkcs7-context.h>
29 
30 G_BEGIN_DECLS
31 
32 #define GMIME_TYPE_APPLICATION_PKCS7_MIME            (g_mime_application_pkcs7_mime_get_type ())
33 #define GMIME_APPLICATION_PKCS7_MIME(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMIME_TYPE_APPLICATION_PKCS7_MIME, GMimeApplicationPkcs7Mime))
34 #define GMIME_APPLICATION_PKCS7_MIME_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GMIME_TYPE_APPLICATION_PKCS7_MIME, GMimeApplicationPkcs7MimeClass))
35 #define GMIME_IS_APPLICATION_PKCS7_MIME(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GMIME_TYPE_APPLICATION_PKCS7_MIME))
36 #define GMIME_IS_APPLICATION_PKCS7_MIME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GMIME_TYPE_APPLICATION_PKCS7_MIME))
37 #define GMIME_APPLICATION_PKCS7_MIME_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GMIME_TYPE_APPLICATION_PKCS7_MIME, GMimeApplicationPkcs7MimeClass))
38 
39 typedef struct _GMimeApplicationPkcs7Mime GMimeApplicationPkcs7Mime;
40 typedef struct _GMimeApplicationPkcs7MimeClass GMimeApplicationPkcs7MimeClass;
41 
42 /**
43  * GMimeSecureMimeType:
44  * @GMIME_SECURE_MIME_TYPE_COMPRESSED_DATA: The S/MIME content contains compressed data.
45  * @GMIME_SECURE_MIME_TYPE_ENVELOPED_DATA: The S/MIME content contains enveloped data.
46  * @GMIME_SECURE_MIME_TYPE_SIGNED_DATA: The S/MIME content contains signed data.
47  * @GMIME_SECURE_MIME_TYPE_CERTS_ONLY: The S/MIME content contains only certificates.
48  * @GMIME_SECURE_MIME_TYPE_UNKNOWN: The S/MIME content is unknown.
49  *
50  * The S/MIME data type.
51  **/
52 typedef enum _GMimeSecureMimeType {
53 	GMIME_SECURE_MIME_TYPE_COMPRESSED_DATA,
54 	GMIME_SECURE_MIME_TYPE_ENVELOPED_DATA,
55 	GMIME_SECURE_MIME_TYPE_SIGNED_DATA,
56 	GMIME_SECURE_MIME_TYPE_CERTS_ONLY,
57 	GMIME_SECURE_MIME_TYPE_UNKNOWN,
58 } GMimeSecureMimeType;
59 
60 /**
61  * GMimeApplicationPkcs7Mime:
62  * @parent_object: parent #GMimePart object
63  * @smime_type: The smime-type Content-Type parameter.
64  *
65  * An application/pkcs7-mime MIME part.
66  **/
67 struct _GMimeApplicationPkcs7Mime {
68 	GMimePart parent_object;
69 
70 	GMimeSecureMimeType smime_type;
71 };
72 
73 struct _GMimeApplicationPkcs7MimeClass {
74 	GMimePartClass parent_class;
75 
76 };
77 
78 
79 GType g_mime_application_pkcs7_mime_get_type (void);
80 
81 GMimeApplicationPkcs7Mime *g_mime_application_pkcs7_mime_new (GMimeSecureMimeType type);
82 
83 GMimeSecureMimeType g_mime_application_pkcs7_mime_get_smime_type (GMimeApplicationPkcs7Mime *pkcs7_mime);
84 
85 /*GMimeApplicationPkcs7Mime *g_mime_application_pkcs7_mime_compress (GMimeObject *entity, GError **err);*/
86 /*GMimeObject *g_mime_application_pkcs7_mime_decompress (GMimeApplicationPkcs7Mime *pkcs7_mime);*/
87 
88 GMimeApplicationPkcs7Mime *g_mime_application_pkcs7_mime_encrypt (GMimeObject *entity, GMimeEncryptFlags flags,
89 								  GPtrArray *recipients, GError **err);
90 
91 GMimeObject *g_mime_application_pkcs7_mime_decrypt (GMimeApplicationPkcs7Mime *pkcs7_mime,
92 						    GMimeDecryptFlags flags, const char *session_key,
93 						    GMimeDecryptResult **result, GError **err);
94 
95 GMimeApplicationPkcs7Mime *g_mime_application_pkcs7_mime_sign (GMimeObject *entity, const char *userid, GError **err);
96 
97 GMimeSignatureList *g_mime_application_pkcs7_mime_verify (GMimeApplicationPkcs7Mime *pkcs7_mime, GMimeVerifyFlags flags,
98 							  GMimeObject **entity, GError **err);
99 
100 G_END_DECLS
101 
102 #endif /* __GMIME_APPLICATION_PKCS7_MIME_H__ */
103