1 /* |
|
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Certificate info class for TLS untrusted certificate dialog. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef UNTRUSTEDCERTIFICATEINFOBASE_H |
|
19 #define UNTRUSTEDCERTIFICATEINFOBASE_H |
|
20 |
|
21 #include <QObject> |
|
22 #include <QDateTime> |
|
23 |
|
24 /** |
|
25 * Certificate info class for secure connections (TLS) untrusted certificate dialog. |
|
26 * This is abstract class that is used in UI code to get displayable certificate |
|
27 * details. Concrete (possibly platform specific) classes implement the functionality. |
|
28 */ |
|
29 class UntrustedCertificateInfoBase : public QObject |
|
30 { |
|
31 Q_OBJECT |
|
32 |
|
33 public: // definitions |
|
34 enum CertificateFormat { |
|
35 UnknownCertificate, |
|
36 X509Certificate, |
|
37 WTLSCertificate, |
|
38 X968Certificate |
|
39 }; |
|
40 enum Algorithm { |
|
41 Unknown, |
|
42 RSA, |
|
43 DSA, |
|
44 DH, |
|
45 MD2, |
|
46 MD5, |
|
47 SHA1, |
|
48 SHA224, |
|
49 SHA256, |
|
50 SHA384, |
|
51 SHA512 |
|
52 }; |
|
53 |
|
54 protected: // constructor, available for derived classes only |
|
55 UntrustedCertificateInfoBase(); |
|
56 |
|
57 public: // destructor |
|
58 virtual ~UntrustedCertificateInfoBase(); |
|
59 |
|
60 public: // new functions |
|
61 virtual const QString subjectName() const; |
|
62 virtual const QString issuerName() const; |
|
63 virtual const QByteArray fingerprint() const; |
|
64 virtual const QByteArray serialNumber() const; |
|
65 virtual const QDateTime validFrom() const; |
|
66 virtual const QDateTime validTo() const; |
|
67 virtual const QString format() const; |
|
68 virtual const QString digestAlgorithm() const; |
|
69 virtual const QString asymmetricAlgorithm() const; |
|
70 virtual const QString combinedAlgorithmName() const; |
|
71 virtual const QString formattedFingerprint(const QByteArray &fingerprint) const; |
|
72 virtual const QString formattedSerialNumber(const QByteArray &serialNumber) const; |
|
73 virtual bool isDateValid() const; |
|
74 |
|
75 public: // new abstract functions |
|
76 virtual bool commonNameMatches(const QString &siteName) const = 0; |
|
77 virtual QString certificateDetails(const QString &siteName) const = 0; |
|
78 |
|
79 private: // new functions |
|
80 const QString algorithmName(Algorithm algorithm) const; |
|
81 |
|
82 protected: // data |
|
83 QString mSubjectName; |
|
84 QString mIssuerName; |
|
85 QByteArray mFingerprint; |
|
86 QByteArray mSerialNumber; |
|
87 QDateTime mValidFrom; |
|
88 QDateTime mValidTo; |
|
89 CertificateFormat mFormat; |
|
90 Algorithm mDigestAlgorithm; |
|
91 Algorithm mAsymmetricAlgorithm; |
|
92 }; |
|
93 |
|
94 #endif // UNTRUSTEDCERTIFICATEINFOBASE_H |
|