android: Fix XML form filter.
[qpwmc.git] / pwmdKey.h
blob53b6a27432ab3b6150e26a7032fe357f7413eaad
1 /*
2 Copyright (C) 2017-2023 Ben Kibbey <bjk@luxsci.net>
4 This file is part of qpwmc.
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with this library; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19 USA
21 #ifndef PWMDKEYID
22 #define PWMDKEYID
24 #include <QList>
25 #include <QString>
26 #include <QTreeWidgetItem>
28 class PwmdUserId;
29 class PwmdSubKey;
30 class PwmdKey
32 public:
33 PwmdKey (bool = false, bool = false, bool = false, bool = false,
34 bool = false, bool = false, bool = false, bool = false,
35 bool = false, bool = false, int = 0, int = 0);
36 ~PwmdKey();
38 void setUserIds (QList <PwmdUserId *>);
39 QList <PwmdUserId *> userIds();
40 void setSubkeys (QList <PwmdSubKey *>);
41 QList <PwmdSubKey *> subKeys();
42 bool isRevoked();
43 void setRevoked(bool = true);
44 bool isExpired();
45 void setExpired(bool = true);
46 bool isDisabled();
47 void setDisabled(bool = true);
48 bool isInvalid();
49 void setInvalid(bool = true);
50 bool canEncrypt();
51 void setCanEncrypt(bool = true);
52 bool canSign();
53 void setCanSign(bool = true);
54 bool canCertify();
55 void setCanCertify(bool = true);
56 bool isSecret();
57 void setSecret(bool = true);
58 bool canAuthenticate();
59 void setCanAuthenticate(bool = true);
60 bool isQualified();
61 void setQualified(bool = true);
62 int protocol ();
63 void setProtocol (int);
64 QString issuerSerial ();
65 void setIssuerSerial (QString);
66 QString issuerName ();
67 void setIssuerName (QString);
68 QString chainId ();
69 void setChainId (QString);
70 int ownerTrust();
71 void setOwnerTrust (int);
73 private:
74 bool _revoked;
75 bool _expired;
76 bool _disabled;
77 bool _invalid;
78 bool _canEncrypt;
79 bool _canSign;
80 bool _canCertify;
81 bool _secret;
82 bool _canAuthenticate;
83 bool _qualified;
84 int _protocol;
85 QString _issuerSerial;
86 QString _issuerName;
87 QString _chainId;
88 int _ownerTrust;
89 QList <PwmdUserId *> _userIds;
90 QList <PwmdSubKey *> _subKeys;
93 class PwmdSubKey : public PwmdKey
95 public:
96 PwmdSubKey ();
97 ~PwmdSubKey ();
99 bool isCardKey();
100 void setCardKey(bool = true);
101 int pubkeyAlgo();
102 void setPubkeyAlgo(int);
103 unsigned nBits ();
104 void setNBits (unsigned);
105 QString keyId();
106 void setKeyId(QString);
107 QString fingerprint();
108 void setFingerprint(QString);
109 QString keygrip();
110 void setKeygrip(QString);
111 long created();
112 void setCreated(long);
113 long expires();
114 void setExpires (long);
115 QString cardNumber();
116 void setCardNumber (QString);
117 QString curve();
118 void setCurve(QString);
120 private:
121 bool _isCardKey;
122 int _pubkeyAlgo;
123 unsigned _nbits;
124 QString _keyId;
125 QString _fingerprint;
126 QString _keygrip;
127 long _timestamp;
128 long _expires;
129 QString _cardNumber;
130 QString _eccCurve;
133 class PwmdUserId
135 public:
136 PwmdUserId ();
137 ~PwmdUserId ();
139 bool isRevoked();
140 void setRevoked (bool = true);
141 bool isInvalid();
142 void setInvalid (bool = true);
143 int validity();
144 void setValidity(int);
145 QString userId();
146 void setUserId(QString);
147 QString name();
148 void setName (QString);
149 QString email();
150 void setEmail (QString);
151 QString comment();
152 void setComment (QString);
154 private:
155 bool _revoked;
156 bool _invalid;
157 int _validity;
158 QString _userId;
159 QString _name;
160 QString _email;
161 QString _comment;
164 class PwmdKeyItemData
166 public:
167 PwmdKeyItemData (PwmdKey *, PwmdSubKey *);
168 ~PwmdKeyItemData ();
169 PwmdKey *key();
170 PwmdSubKey *subKey();
171 void setKey (PwmdKey *);
172 void setSubKey (PwmdSubKey *);
174 private:
175 PwmdKey *_key;
176 PwmdSubKey *_subKey;
179 Q_DECLARE_METATYPE (PwmdKeyItemData *);
181 #endif