LibreOffice Module xmlsecurity (master) 1
certificateviewer.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#pragma once
21
22#include <utility>
23#include <vcl/weld.hxx>
24
25namespace com::sun::star {
26 namespace security { class XCertificate; }
27 namespace xml::crypto { class XSecurityEnvironment; }
28}
29
34
36{
37private:
41
43
44 css::uno::Reference< css::xml::crypto::XSecurityEnvironment > mxSecurityEnvironment;
45 css::uno::Reference< css::security::XCertificate > mxCert;
46
48
49 std::unique_ptr<weld::Notebook> mxTabCtrl;
50
51 std::unique_ptr<CertificateViewerGeneralTP> mxGeneralPage;
52 std::unique_ptr<CertificateViewerDetailsTP> mxDetailsPage;
53 std::unique_ptr<CertificateViewerCertPathTP> mxPathId;
54
55 DECL_LINK(ActivatePageHdl, const OUString&, void);
56
57public:
58 CertificateViewer(weld::Window* pParent, const css::uno::Reference< css::xml::crypto::XSecurityEnvironment >& rxSecurityEnvironment, const css::uno::Reference< css::security::XCertificate >& rXCert, bool bCheckForPrivateKey, CertificateChooser* pParentChooser);
60};
61
63{
64protected:
65 std::unique_ptr<weld::Builder> mxBuilder;
66 std::unique_ptr<weld::Container> mxContainer;
68
69public:
70 CertificateViewerTP(weld::Container* pParent, const OUString& rUIXMLDescription,
71 const OUString& rID, CertificateViewer* pDlg);
72};
73
75{
76private:
77 std::unique_ptr<weld::Image> m_xCertImg;
78 std::unique_ptr<weld::Label> m_xHintNotTrustedFT;
79 std::unique_ptr<weld::Label> m_xIssuedToLabelFT;
80 std::unique_ptr<weld::Label> m_xIssuedToFT;
81 std::unique_ptr<weld::Label> m_xIssuedByLabelFT;
82 std::unique_ptr<weld::Label> m_xIssuedByFT;
83 std::unique_ptr<weld::Label> m_xValidFromDateFT;
84 std::unique_ptr<weld::Label> m_xValidToDateFT;
85 std::unique_ptr<weld::Image> m_xKeyImg;
86 std::unique_ptr<weld::Label> m_xHintCorrespPrivKeyFT;
87
88public:
90};
91
93{
94 OUString const maTxt;
95 bool const mbFixedWidthFont;
96
97 Details_UserDatat(OUString aTxt, bool bFixedWidthFont)
98 : maTxt(std::move(aTxt))
99 , mbFixedWidthFont(bFixedWidthFont)
100 {
101 }
102};
103
105{
106private:
107 std::vector<std::unique_ptr<Details_UserDatat>> m_aUserData;
108
109 std::unique_ptr<weld::TreeView> m_xElementsLB;
110 std::unique_ptr<weld::TextView> m_xValueDetails;
111
112 DECL_LINK(ElementSelectHdl, weld::TreeView&, void);
113 void InsertElement(const OUString& rField, const OUString& rValue,
114 const OUString& rDetails, bool bFixedWidthFont = false);
115public:
117};
118
120{
121 css::uno::Reference< css::security::XCertificate > mxCert;
122 bool const mbValid;
123
124 CertPath_UserData(css::uno::Reference<css::security::XCertificate> xCert, bool bValid)
125 : mxCert(std::move(xCert))
126 , mbValid(bValid)
127 {
128 }
129};
130
132{
133private:
136
137 std::vector<std::unique_ptr<CertPath_UserData>> maUserData;
138 std::shared_ptr<CertificateViewer> mxCertificateViewer;
139
140 std::unique_ptr<weld::TreeView> mxCertPathLB;
141 std::unique_ptr<weld::TreeIter> mxScratchIter;
142 std::unique_ptr<weld::Button> mxViewCertPB;
143 std::unique_ptr<weld::TextView> mxCertStatusML;
144 std::unique_ptr<weld::Label> mxCertOK;
145 std::unique_ptr<weld::Label> mxCertNotValidated;
146
147 DECL_LINK(ViewCertHdl, weld::Button&, void);
148 DECL_LINK(CertSelectHdl, weld::TreeView&, void);
149 void InsertCert(const weld::TreeIter* pParent, const OUString& _rName,
150 const css::uno::Reference< css::security::XCertificate >& rxCert,
151 bool bValid);
152
153public:
156 void ActivatePage();
157};
158
159/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::vector< std::unique_ptr< CertPath_UserData > > maUserData
CertificateViewerCertPathTP(weld::Container *pParent, CertificateViewer *pDlg)
DECL_LINK(ViewCertHdl, weld::Button &, void)
std::unique_ptr< weld::TextView > mxCertStatusML
std::shared_ptr< CertificateViewer > mxCertificateViewer
std::unique_ptr< weld::TreeIter > mxScratchIter
std::unique_ptr< weld::TreeView > mxCertPathLB
void InsertCert(const weld::TreeIter *pParent, const OUString &_rName, const css::uno::Reference< css::security::XCertificate > &rxCert, bool bValid)
DECL_LINK(CertSelectHdl, weld::TreeView &, void)
std::unique_ptr< weld::Label > mxCertOK
std::unique_ptr< weld::Label > mxCertNotValidated
std::unique_ptr< weld::Button > mxViewCertPB
std::vector< std::unique_ptr< Details_UserDatat > > m_aUserData
std::unique_ptr< weld::TreeView > m_xElementsLB
DECL_LINK(ElementSelectHdl, weld::TreeView &, void)
void InsertElement(const OUString &rField, const OUString &rValue, const OUString &rDetails, bool bFixedWidthFont=false)
std::unique_ptr< weld::TextView > m_xValueDetails
CertificateViewerDetailsTP(weld::Container *pParent, CertificateViewer *pDlg)
std::unique_ptr< weld::Image > m_xCertImg
std::unique_ptr< weld::Label > m_xIssuedByFT
std::unique_ptr< weld::Label > m_xHintCorrespPrivKeyFT
std::unique_ptr< weld::Label > m_xValidToDateFT
std::unique_ptr< weld::Label > m_xIssuedByLabelFT
std::unique_ptr< weld::Label > m_xHintNotTrustedFT
CertificateViewerGeneralTP(weld::Container *pParent, CertificateViewer *pDlg)
std::unique_ptr< weld::Label > m_xIssuedToLabelFT
std::unique_ptr< weld::Image > m_xKeyImg
std::unique_ptr< weld::Label > m_xValidFromDateFT
std::unique_ptr< weld::Label > m_xIssuedToFT
CertificateViewerTP(weld::Container *pParent, const OUString &rUIXMLDescription, const OUString &rID, CertificateViewer *pDlg)
CertificateViewer * mpDlg
std::unique_ptr< weld::Builder > mxBuilder
std::unique_ptr< weld::Container > mxContainer
std::unique_ptr< CertificateViewerDetailsTP > mxDetailsPage
std::unique_ptr< weld::Notebook > mxTabCtrl
CertificateViewer(weld::Window *pParent, const css::uno::Reference< css::xml::crypto::XSecurityEnvironment > &rxSecurityEnvironment, const css::uno::Reference< css::security::XCertificate > &rXCert, bool bCheckForPrivateKey, CertificateChooser *pParentChooser)
DECL_LINK(ActivatePageHdl, const OUString &, void)
std::unique_ptr< CertificateViewerCertPathTP > mxPathId
std::unique_ptr< CertificateViewerGeneralTP > mxGeneralPage
css::uno::Reference< css::security::XCertificate > mxCert
CertificateChooser * GetParentChooser()
css::uno::Reference< css::xml::crypto::XSecurityEnvironment > mxSecurityEnvironment
CertificateChooser * mpParentChooser
bool const mbCheckForPrivateKey
CertPath_UserData(css::uno::Reference< css::security::XCertificate > xCert, bool bValid)
css::uno::Reference< css::security::XCertificate > mxCert
Details_UserDatat(OUString aTxt, bool bFixedWidthFont)
OUString const maTxt