KSSLCertificate
#include <ksslcertificate.h>
Public Types | |
enum | KSSLPurpose { None = 0, SSLServer = 1, SSLClient = 2, SMIMESign = 3, SMIMEEncrypt = 4, Any = 5 } |
enum | KSSLValidation { Unknown, Ok, NoCARoot, InvalidPurpose, PathLengthExceeded, InvalidCA, Expired, SelfSigned, ErrorReadingRoot, NoSSL, Revoked, Untrusted, SignatureFailed, Rejected, PrivateKeyFailed, InvalidHost, Irrelevant, SelfSignedChain, GetIssuerCertFailed, DecodeIssuerPublicKeyFailed, GetIssuerCertLocallyFailed, CertificateNotYetValid, CertificateHasExpired, CRLNotYetValid, CRLHasExpired, CertificateFieldNotBeforeErroneous, CertificateFieldNotAfterErroneous, CRLFieldLastUpdateErroneous, CRLFieldNextUpdateErroneous, CertificateRevoked, CertificateUntrusted, VerifyLeafSignatureFailed, CertificateSignatureFailed, CRLSignatureFailed, DecryptCertificateSignatureFailed, DecryptCRLSignatureFailed, CertificateRejected, SelfSignedInChain, ApplicationVerificationFailed, AuthAndSubjectKeyIDAndNameMismatched, AuthAndSubjectKeyIDMismatched, OutOfMemory, GetCRLFailed, CertificateChainTooLong, KeyMayNotSignCertificate, IssuerSubjectMismatched } |
typedef QList< KSSLValidation > | KSSLValidationList |
Static Public Member Functions | |
static KSSLCertificate * | fromString (const QByteArray &cert) |
static KSSLCertificate * | fromX509 (X509 *x5) |
static QString | getMD5DigestFromKDEKey (const QString &k) |
static QString | verifyText (KSSLValidation x) |
Protected Member Functions | |
X509 * | getCert () |
KSSLValidation | processError (int ec) |
void | setCert (X509 *c) |
void | setChain (void *c) |
Detailed Description
KDE X.509 Certificate.
This class represents an X.509 (SSL) certificate. Note: this object is VERY HEAVY TO COPY. Please try to use reference or pointer whenever possible
- See also
- KSSL
KDE X.509 Certificate
- Deprecated:
- since 5.0, use QSslCertificate
Definition at line 73 of file ksslcertificate.h.
Member Enumeration Documentation
◆ KSSLValidation
Result of the validate() call.
A CA certificate can be validated as Irrelevant when it was not used to sign any other relevant certificate.
Definition at line 117 of file ksslcertificate.h.
Constructor & Destructor Documentation
◆ ~KSSLCertificate()
KSSLCertificate::~KSSLCertificate | ( | ) |
Destroy this X.509 certificate.
Definition at line 113 of file ksslcertificate.cpp.
◆ KSSLCertificate()
KSSLCertificate::KSSLCertificate | ( | const KSSLCertificate & | x | ) |
Copy constructor.
Beware, this is very expensive.
- Parameters
-
x the object to copy from
Definition at line 100 of file ksslcertificate.cpp.
Member Function Documentation
◆ chain()
KSSLCertChain & KSSLCertificate::chain | ( | ) |
Get a reference to the certificate chain.
- Returns
- reference to the chain
Definition at line 123 of file ksslcertificate.cpp.
◆ fromString()
|
static |
Create an X.509 certificate from a base64 encoded string.
- Parameters
-
cert the certificate in base64 form
- Returns
- the X.509 certificate, or NULL
Definition at line 140 of file ksslcertificate.cpp.
◆ fromX509()
|
static |
Create an X.509 certificate from the internal representation.
This one duplicates the X509 object for itself.
- Parameters
-
x5 the OpenSSL representation of the certificate
- Returns
- the X.509 certificate, or NULL
Definition at line 128 of file ksslcertificate.cpp.
◆ getEmails()
void KSSLCertificate::getEmails | ( | QStringList & | to | ) | const |
FIXME: document.
Definition at line 224 of file ksslcertificate.cpp.
◆ getIssuer()
QString KSSLCertificate::getIssuer | ( | ) | const |
Get the issuer of the certificate (X.509 map).
- Returns
- the issuer
Definition at line 437 of file ksslcertificate.cpp.
◆ getKDEKey()
QString KSSLCertificate::getKDEKey | ( | ) | const |
KDEKey is a concatenation "Subject (MD5)", mostly needed for SMIME.
The result of getKDEKey might change and should not be used for persistant storage.
Definition at line 243 of file ksslcertificate.cpp.
◆ getKeyType()
QString KSSLCertificate::getKeyType | ( | ) | const |
Get the key type (RSA, DSA, etc).
- Returns
- the key type as a string
Definition at line 308 of file ksslcertificate.cpp.
◆ getMD5Digest()
QString KSSLCertificate::getMD5Digest | ( | ) | const |
Get the MD5 digest of the certificate.
- Returns
- the MD5 digest in a hexidecimal string
Definition at line 286 of file ksslcertificate.cpp.
◆ getMD5DigestFromKDEKey()
Aegypten semantics force us to search by MD5Digest only.
Definition at line 248 of file ksslcertificate.cpp.
◆ getMD5DigestText()
QString KSSLCertificate::getMD5DigestText | ( | ) | const |
Get the MD5 digest of the certificate.
Result is padded with : to separate bytes - it's a text version!
- Returns
- the MD5 digest in a hexidecimal string
Definition at line 261 of file ksslcertificate.cpp.
◆ getNotAfter()
QString KSSLCertificate::getNotAfter | ( | ) | const |
Get the date that the certificate is valid until.
- Returns
- the date as a string, localised
Definition at line 1002 of file ksslcertificate.cpp.
◆ getNotBefore()
QString KSSLCertificate::getNotBefore | ( | ) | const |
Get the date that the certificate becomes valid on.
- Returns
- the date as a string, localised
Definition at line 993 of file ksslcertificate.cpp.
◆ getPublicKeyText()
QString KSSLCertificate::getPublicKeyText | ( | ) | const |
Get the public key.
- Returns
- the public key as a hexidecimal string
Definition at line 333 of file ksslcertificate.cpp.
◆ getQDTNotAfter()
QDateTime KSSLCertificate::getQDTNotAfter | ( | ) | const |
Get the date that the certificate is valid until.
- Returns
- the date
Definition at line 1020 of file ksslcertificate.cpp.
◆ getQDTNotBefore()
QDateTime KSSLCertificate::getQDTNotBefore | ( | ) | const |
Get the date that the certificate becomes valid on.
- Returns
- the date
Definition at line 1011 of file ksslcertificate.cpp.
◆ getSerialNumber()
QString KSSLCertificate::getSerialNumber | ( | ) | const |
Get the serial number of the certificate.
- Returns
- the serial number as a string
Definition at line 176 of file ksslcertificate.cpp.
◆ getSignatureText()
QString KSSLCertificate::getSignatureText | ( | ) | const |
Get the signature.
- Returns
- the signature in text format
Definition at line 190 of file ksslcertificate.cpp.
◆ getSubject()
QString KSSLCertificate::getSubject | ( | ) | const |
Get the subject of the certificate (X.509 map).
- Returns
- the subject
Definition at line 161 of file ksslcertificate.cpp.
◆ isSigner()
bool KSSLCertificate::isSigner | ( | ) |
Check if this is a signer certificate.
- Returns
- true if this is a signer certificate
Definition at line 1293 of file ksslcertificate.cpp.
◆ isValid() [1/2]
bool KSSLCertificate::isValid | ( | ) |
Check if this is a valid certificate.
Will use cached data.
- Returns
- true if it is valid
Definition at line 608 of file ksslcertificate.cpp.
◆ isValid() [2/2]
bool KSSLCertificate::isValid | ( | KSSLCertificate::KSSLPurpose | p | ) |
Check if this is a valid certificate.
Will use cached data.
- Parameters
-
p the purpose to validate for
- Returns
- true if it is valid
Definition at line 603 of file ksslcertificate.cpp.
◆ replicate()
KSSLCertificate * KSSLCertificate::replicate | ( | ) |
Explicitly make a copy of this certificate.
- Returns
- a copy of the certificate
Definition at line 1041 of file ksslcertificate.cpp.
◆ revalidate() [1/2]
KSSLCertificate::KSSLValidation KSSLCertificate::revalidate | ( | ) |
Check if this is a valid certificate.
Will NOT use cached data.
- Returns
- the result of the validation
Definition at line 795 of file ksslcertificate.cpp.
◆ revalidate() [2/2]
KSSLCertificate::KSSLValidation KSSLCertificate::revalidate | ( | KSSLCertificate::KSSLPurpose | p | ) |
Check if this is a valid certificate.
Will NOT use cached data.
- Parameters
-
p the purpose to validate for
- Returns
- the result of the validation
Definition at line 800 of file ksslcertificate.cpp.
◆ setCert()
bool KSSLCertificate::setCert | ( | const QString & | cert | ) |
Re-set the certificate from a base64 string.
- Parameters
-
cert the certificate to set to
- Returns
- true on success
Definition at line 1273 of file ksslcertificate.cpp.
◆ subjAltNames()
QStringList KSSLCertificate::subjAltNames | ( | ) | const |
The alternate subject name.
- Returns
- string list with subjectAltName
Definition at line 1298 of file ksslcertificate.cpp.
◆ toDer()
QByteArray KSSLCertificate::toDer | ( | ) |
Convert the certificate to DER (ASN.1) format.
- Returns
- the binary data of the DER encoding
Definition at line 1161 of file ksslcertificate.cpp.
◆ toNetscape()
QByteArray KSSLCertificate::toNetscape | ( | ) |
Convert the certificate to Netscape format.
- Returns
- the binary data of the Netscape encoding
Definition at line 1221 of file ksslcertificate.cpp.
◆ toPem()
QByteArray KSSLCertificate::toPem | ( | ) |
Convert the certificate to PEM (base64) format.
- Returns
- the binary data of the PEM encoding
Definition at line 1182 of file ksslcertificate.cpp.
◆ toString()
QString KSSLCertificate::toString | ( | ) |
Convert this certificate to a string.
- Returns
- the certificate in base64 format
Definition at line 1055 of file ksslcertificate.cpp.
◆ toText()
QString KSSLCertificate::toText | ( | ) |
Convert the certificate to OpenSSL plain text format.
- Returns
- the OpenSSL text encoding
Definition at line 1248 of file ksslcertificate.cpp.
◆ validate() [1/2]
KSSLCertificate::KSSLValidation KSSLCertificate::validate | ( | ) |
Check if this is a valid certificate.
Will use cached data.
- Returns
- the result of the validation
Definition at line 633 of file ksslcertificate.cpp.
◆ validate() [2/2]
KSSLCertificate::KSSLValidation KSSLCertificate::validate | ( | KSSLCertificate::KSSLPurpose | purpose | ) |
Check if this is a valid certificate.
Will use cached data.
- Parameters
-
p the purpose to validate for
- Returns
- the result of the validation
Definition at line 638 of file ksslcertificate.cpp.
◆ validateVerbose() [1/2]
KSSLCertificate::KSSLValidationList KSSLCertificate::validateVerbose | ( | KSSLCertificate::KSSLPurpose | purpose | ) |
Check if this is a valid certificate.
Will use cached data.
- Parameters
-
p the purpose to validate for
- Returns
- all problems encountered during validation
Definition at line 653 of file ksslcertificate.cpp.
◆ validateVerbose() [2/2]
KSSLCertificate::KSSLValidationList KSSLCertificate::validateVerbose | ( | KSSLCertificate::KSSLPurpose | purpose, |
KSSLCertificate * | ca | ||
) |
Check if the certificate ca is a proper CA for this certificate.
- Parameters
-
p the purpose to validate for ca the certificate to check
- Returns
- all problems encountered during validation
Definition at line 658 of file ksslcertificate.cpp.
◆ verifyText()
|
static |
Obtain the localized message that corresponds to a validation result.
- Parameters
-
x the code to look up
- Returns
- the message text corresponding to the validation code
Definition at line 1060 of file ksslcertificate.cpp.
◆ x509V3Extensions()
KSSLX509V3 & KSSLCertificate::x509V3Extensions | ( | ) |
Access the X.509v3 parameters.
- Returns
- reference to the extension object
- See also
- KSSLX509V3
Definition at line 1288 of file ksslcertificate.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon May 8 2023 03:56:01 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.