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_X509SUPER_H
9 #define __PKI_X509SUPER_H
10 
11 #include <openssl/x509.h>
12 #include <openssl/pem.h>
13 #include "pki_key.h"
14 #include "x509name.h"
15 #include "x509v3ext.h"
16 
17 #define VIEW_x509super_keyid 6
18 
19 class pki_x509name : public pki_base
20 {
21     protected:
22 	void PEM_file_comment(XFile &file) const;
23 
24     public:
25 	pki_x509name(const QString &name = QString());
26 	pki_x509name(const pki_x509name *n);
27 	virtual x509name getSubject() const = 0;
28 	void autoIntName(const QString &file);
29 	QVariant column_data(const dbheader *hd) const;
30 	bool visible() const;
31 	void collect_properties(QMap<QString, QString> &prp) const;
32 };
33 
34 class pki_x509super : public pki_x509name
35 {
36 		Q_OBJECT
37 	protected:
38 		QVariant keySqlId;
39 		virtual int sigAlg() const = 0;
40 		void collect_properties(QMap<QString, QString> &prp) const;
41 	public:
42 		pki_x509super(const QString &name = QString());
43 		pki_x509super(const pki_x509super *x);
44 		virtual ~pki_x509super();
45 		unsigned pubHash() const;
46 		virtual pki_key *getPubKey() const = 0;
47 		virtual extList getV3ext() const = 0;
48 		virtual QString getSigAlg() const;
49 		virtual const EVP_MD *getDigest();
getKeySqlId()50 		QVariant getKeySqlId()
51 		{
52 			return keySqlId;
53 		}
54 		pki_key *getRefKey() const;
55 		bool compareRefKey(pki_key* ref) const;
56 		void setRefKey(pki_key *ref);
57 		void delRefKey(pki_key *ref);
58 		QVariant column_data(const dbheader *hd) const;
59 		void opensslConf(QString fname);
60 		bool visible() const;
61 		bool hasPrivKey() const;
62 		QVariant getIcon(const dbheader *hd) const;
63 		QSqlError lookupKey();
64 		QSqlError insertSqlData();
65 		QSqlError deleteSqlData();
66 		void restoreSql(const QSqlRecord &rec);
67 };
68 
69 #endif
70