2 Copyright (C) 2017-2024 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
23 PwmdKey::PwmdKey (bool revoked
, bool expired
, bool disabled
, bool invalid
,
24 bool encrypt
, bool sign
, bool certify
, bool secret
,
25 bool auth
, bool qualified
, int protocol
, int trust
)
31 _canEncrypt
= encrypt
;
33 _canCertify
= certify
;
35 _canAuthenticate
= auth
;
36 _qualified
= qualified
;
38 _issuerSerial
= QString ();
39 _issuerName
= QString ();
40 _chainId
= QString ();
46 while (!_subKeys
.isEmpty ())
48 PwmdSubKey
*key
= _subKeys
.takeFirst ();
52 while (!_userIds
.isEmpty ())
54 PwmdUserId
*id
= _userIds
.takeFirst ();
60 PwmdKey::setUserIds (QList
<PwmdUserId
*> list
)
72 PwmdKey::setSubkeys (QList
<PwmdSubKey
*> list
)
90 PwmdKey::setRevoked (bool b
)
102 PwmdKey::setExpired (bool b
)
108 PwmdKey::isDisabled()
114 PwmdKey::setDisabled (bool b
)
126 PwmdKey::setInvalid (bool b
)
132 PwmdKey::canEncrypt()
138 PwmdKey::setCanEncrypt (bool b
)
150 PwmdKey::setCanSign (bool b
)
156 PwmdKey::canCertify()
162 PwmdKey::setCanCertify (bool b
)
174 PwmdKey::setSecret (bool b
)
180 PwmdKey::canAuthenticate()
182 return _canAuthenticate
;
186 PwmdKey::setCanAuthenticate (bool b
)
188 _canAuthenticate
= b
;
192 PwmdKey::isQualified()
198 PwmdKey::setQualified (bool b
)
210 PwmdKey::setProtocol(int n
)
216 PwmdKey::issuerSerial()
218 return _issuerSerial
;
222 PwmdKey::setIssuerSerial (QString s
)
228 PwmdKey::issuerName()
234 PwmdKey::setIssuerName (QString s
)
246 PwmdKey::setChainId(QString s
)
252 PwmdKey::ownerTrust()
258 PwmdKey::setOwnerTrust (int n
)
263 PwmdSubKey::PwmdSubKey () : PwmdKey()
269 _fingerprint
= QString ();
270 _keygrip
= QString ();
273 _cardNumber
= QString ();
274 _eccCurve
= QString ();
277 PwmdSubKey::~PwmdSubKey()
282 PwmdSubKey::isCardKey()
288 PwmdSubKey::setCardKey(bool b
)
294 PwmdSubKey::pubkeyAlgo()
300 PwmdSubKey::setPubkeyAlgo(int n
)
306 PwmdSubKey::setNBits (unsigned n
)
324 PwmdSubKey::setKeyId (QString s
)
330 PwmdSubKey::fingerprint()
336 PwmdSubKey::setFingerprint (QString s
)
342 PwmdSubKey::keygrip()
348 PwmdSubKey::setKeygrip (QString s
)
354 PwmdSubKey::created()
360 PwmdSubKey::setCreated (long n
)
366 PwmdSubKey::expires()
372 PwmdSubKey::setExpires (long n
)
378 PwmdSubKey::cardNumber()
384 PwmdSubKey::setCardNumber (QString s
)
396 PwmdSubKey::setCurve (QString s
)
401 PwmdUserId::PwmdUserId ()
406 _userId
= QString ();
409 _comment
= QString ();
412 PwmdUserId::~PwmdUserId()
417 PwmdUserId::isRevoked()
423 PwmdUserId::setRevoked (bool b
)
429 PwmdUserId::isInvalid()
435 PwmdUserId::setInvalid (bool b
)
441 PwmdUserId::validity()
447 PwmdUserId::setValidity (int n
)
459 PwmdUserId::setUserId(QString s
)
471 PwmdUserId::setName (QString s
)
483 PwmdUserId::setEmail (QString s
)
489 PwmdUserId::comment()
495 PwmdUserId::setComment (QString s
)
500 PwmdKeyItemData::PwmdKeyItemData (PwmdKey
*k
, PwmdSubKey
*s
)
506 PwmdKeyItemData::~PwmdKeyItemData ()
516 PwmdKeyItemData::setKey (PwmdKey
*k
)
522 PwmdKeyItemData::key ()
528 PwmdKeyItemData::setSubKey (PwmdSubKey
*k
)
534 PwmdKeyItemData::subKey ()