1 /* vi: set sw=4 ts=4:
2  *
3  * Copyright (C) 2001 - 2020 Christian Hohnstaedt.
4  *
5  * All rights reserved.
6  */
7 
8 #ifndef __PKI_PKCS7_H
9 #define __PKI_PKCS7_H
10 
11 #include <QString>
12 #include "pki_multi.h"
13 
14 #include <openssl/pkcs7.h>
15 
16 class pki_x509;
17 
18 class pki_pkcs7: public pki_multi
19 {
20 		Q_OBJECT
21 
22 	friend class pki_x509;
23 
24 	protected:
25 		PKCS7 *p7;
26 		void signBio(pki_x509 *crt, BIO *bio);
27 		void encryptBio(pki_x509 *crt, BIO *bio);
28 		void append_certs(PKCS7 *myp7, const QString &name);
29 
30 	public:
31 		pki_pkcs7(const QString &name = QString());
32 		virtual ~pki_pkcs7();
33 
34 		void signFile(pki_x509 *crt, const QString &filename);
35 		void signCert(pki_x509 *crt, pki_x509 *contCert);
36 		void encryptFile(pki_x509 *crt, const QString &filename);
37 		void writeP7(XFile &file, bool PEM);
38 		void fromPEM_BIO(BIO *bio, const QString &name);
39 		void fload(const QString &name);
40 };
41 #endif
42