Kaydet (Commit) 9c5d3e5c authored tarafından Samuel Mehrbrodt's avatar Samuel Mehrbrodt

tdf#118581 Correctly display issuer name in signature line

Move the xmlsec helper methods to comphelper so that we can use them in cui

Change-Id: If9b10cfff5f5abd6b16e48f043af7959edbb1142
Reviewed-on: https://gerrit.libreoffice.org/63198
Tested-by: Jenkins
Reviewed-by: 's avatarSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
üst 3d885f20
...@@ -143,6 +143,7 @@ $(eval $(call gb_Library_add_exception_objects,comphelper,\ ...@@ -143,6 +143,7 @@ $(eval $(call gb_Library_add_exception_objects,comphelper,\
comphelper/source/misc/types \ comphelper/source/misc/types \
comphelper/source/misc/weak \ comphelper/source/misc/weak \
comphelper/source/misc/weakeventlistener \ comphelper/source/misc/weakeventlistener \
comphelper/source/misc/xmlsechelper \
comphelper/source/officeinstdir/officeinstallationdirectories \ comphelper/source/officeinstdir/officeinstallationdirectories \
comphelper/source/processfactory/processfactory \ comphelper/source/processfactory/processfactory \
comphelper/source/property/ChainablePropertySet \ comphelper/source/property/ChainablePropertySet \
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
*/ */
#include <resourcemanager.hxx> #include <comphelper/xmlsechelper.hxx>
#include <vcl/svapp.hxx> #include <vcl/svapp.hxx>
#include <vcl/fixed.hxx> #include <vcl/fixed.hxx>
...@@ -30,34 +30,10 @@ ...@@ -30,34 +30,10 @@
using namespace std; using namespace std;
namespace XmlSec namespace comphelper
{
namespace xmlsec
{ {
const LocaleDataWrapper& GetLocaleData()
{
static SvtSysLocale ourSysLocale;
return ourSysLocale.GetLocaleData();
}
DateTime GetDateTime( const css::util::DateTime& _rDT )
{
return DateTime(_rDT);
}
OUString GetDateTimeString( const css::util::DateTime& _rDT )
{
// String with date and time information (#i20172#)
DateTime aDT( GetDateTime( _rDT ) );
const LocaleDataWrapper& rLoDa = GetLocaleData();
return rLoDa.getDate( aDT ) + " " + rLoDa.getTime( aDT );
}
OUString GetDateString( const css::util::DateTime& _rDT )
{
return GetLocaleData().getDate( GetDateTime( _rDT ) );
}
OUString GetCertificateKind( const css::security::CertificateKind &rKind ) OUString GetCertificateKind( const css::security::CertificateKind &rKind )
{ {
switch (rKind) switch (rKind)
...@@ -354,5 +330,6 @@ vector< pair< OUString, OUString> > parseDN(const OUString& rRawString) ...@@ -354,5 +330,6 @@ vector< pair< OUString, OUString> > parseDN(const OUString& rRawString)
return aStr.makeStringAndClear(); return aStr.makeStringAndClear();
} }
} }
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <strings.hrc> #include <strings.hrc>
#include <comphelper/processfactory.hxx> #include <comphelper/processfactory.hxx>
#include <comphelper/xmlsechelper.hxx>
#include <tools/stream.hxx> #include <tools/stream.hxx>
#include <unotools/localedatawrapper.hxx> #include <unotools/localedatawrapper.hxx>
#include <unotools/streamwrap.hxx> #include <unotools/streamwrap.hxx>
...@@ -40,6 +41,7 @@ ...@@ -40,6 +41,7 @@
#include <com/sun/star/text/XTextContent.hpp> #include <com/sun/star/text/XTextContent.hpp>
#include <com/sun/star/text/XTextDocument.hpp> #include <com/sun/star/text/XTextDocument.hpp>
using namespace comphelper;
using namespace css; using namespace css;
using namespace css::uno; using namespace css::uno;
using namespace css::beans; using namespace css::beans;
...@@ -138,7 +140,8 @@ IMPL_LINK_NOARG(SignSignatureLineDialog, chooseCertificate, weld::Button&, void) ...@@ -138,7 +140,8 @@ IMPL_LINK_NOARG(SignSignatureLineDialog, chooseCertificate, weld::Button&, void)
if (xSignCertificate.is()) if (xSignCertificate.is())
{ {
m_xSelectedCertifate = xSignCertificate; m_xSelectedCertifate = xSignCertificate;
m_xBtnChooseCertificate->set_label(xSignCertificate->getIssuerName()); m_xBtnChooseCertificate->set_label(
xmlsec::GetContentPart(xSignCertificate->getIssuerName()));
} }
ValidateFields(); ValidateFields();
} }
...@@ -175,8 +178,9 @@ SignSignatureLineDialog::getSignedGraphic(bool bValid) ...@@ -175,8 +178,9 @@ SignSignatureLineDialog::getSignedGraphic(bool bValid)
aSvgImage = aSvgImage.replaceAll("[SIGNER_TITLE]", getCDataString(m_aSuggestedSignerTitle)); aSvgImage = aSvgImage.replaceAll("[SIGNER_TITLE]", getCDataString(m_aSuggestedSignerTitle));
aSvgImage = aSvgImage.replaceAll("[SIGNATURE]", getCDataString(m_xEditName->get_text())); aSvgImage = aSvgImage.replaceAll("[SIGNATURE]", getCDataString(m_xEditName->get_text()));
OUString aIssuerLine = CuiResId(RID_SVXSTR_SIGNATURELINE_SIGNED_BY) OUString aIssuerLine
.replaceFirst("%1", m_xSelectedCertifate->getIssuerName()); = CuiResId(RID_SVXSTR_SIGNATURELINE_SIGNED_BY)
.replaceFirst("%1", xmlsec::GetContentPart(m_xSelectedCertifate->getIssuerName()));
aSvgImage = aSvgImage.replaceAll("[SIGNED_BY]", getCDataString(aIssuerLine)); aSvgImage = aSvgImage.replaceAll("[SIGNED_BY]", getCDataString(aIssuerLine));
if (bValid) if (bValid)
aSvgImage = aSvgImage.replaceAll("[INVALID_SIGNATURE]", ""); aSvgImage = aSvgImage.replaceAll("[INVALID_SIGNATURE]", "");
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef INCLUDED_COMPHELPER_XMLSECHELPER_HXX
#define INCLUDED_COMPHELPER_XMLSECHELPER_HXX
#include <comphelper/comphelperdllapi.h>
#include <com/sun/star/security/CertificateKind.hpp>
#include <com/sun/star/uno/Sequence.hxx>
#include <vector>
namespace comphelper
{
namespace xmlsec
{
COMPHELPER_DLLPUBLIC OUString GetCertificateKind(const css::security::CertificateKind& rKind);
COMPHELPER_DLLPUBLIC std::vector<std::pair<OUString, OUString>> parseDN(const OUString& rRawString);
COMPHELPER_DLLPUBLIC std::pair<OUString, OUString>
GetDNForCertDetailsView(const OUString& rRawString);
COMPHELPER_DLLPUBLIC OUString GetContentPart(const OUString& _rRawString);
COMPHELPER_DLLPUBLIC OUString GetHexString(const css::uno::Sequence<sal_Int8>& _rSeq,
const char* _pSep, sal_uInt16 _nLineBreak = 0xFFFF);
}
}
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -31,9 +31,14 @@ namespace com { namespace sun { namespace star { namespace util { struct Time; } ...@@ -31,9 +31,14 @@ namespace com { namespace sun { namespace star { namespace util { struct Time; }
class Date; class Date;
class DateTime; class DateTime;
class LocaleDataWrapper;
namespace utl namespace utl
{ {
UNOTOOLS_DLLPUBLIC const LocaleDataWrapper& GetLocaleData();
UNOTOOLS_DLLPUBLIC DateTime GetDateTime(const css::util::DateTime& _rDT);
UNOTOOLS_DLLPUBLIC OUString GetDateTimeString(const css::util::DateTime& _rDT);
UNOTOOLS_DLLPUBLIC OUString GetDateString(const css::util::DateTime& _rDT);
UNOTOOLS_DLLPUBLIC void typeConvert(const Date& _rDate, css::util::Date& _rOut); UNOTOOLS_DLLPUBLIC void typeConvert(const Date& _rDate, css::util::Date& _rOut);
UNOTOOLS_DLLPUBLIC void typeConvert(const css::util::Date& _rDate, Date& _rOut); UNOTOOLS_DLLPUBLIC void typeConvert(const css::util::Date& _rDate, Date& _rOut);
......
...@@ -1651,6 +1651,7 @@ comphelper/source/misc/threadpool.cxx ...@@ -1651,6 +1651,7 @@ comphelper/source/misc/threadpool.cxx
comphelper/source/misc/types.cxx comphelper/source/misc/types.cxx
comphelper/source/misc/weak.cxx comphelper/source/misc/weak.cxx
comphelper/source/misc/weakeventlistener.cxx comphelper/source/misc/weakeventlistener.cxx
comphelper/source/misc/xmlsechelper.cxx
comphelper/source/officeinstdir/officeinstallationdirectories.cxx comphelper/source/officeinstdir/officeinstallationdirectories.cxx
comphelper/source/officeinstdir/officeinstallationdirectories.hxx comphelper/source/officeinstdir/officeinstallationdirectories.hxx
comphelper/source/processfactory/processfactory.cxx comphelper/source/processfactory/processfactory.cxx
...@@ -19444,7 +19445,6 @@ xmlsecurity/inc/pch/precompiled_xsec_gpg.cxx ...@@ -19444,7 +19445,6 @@ xmlsecurity/inc/pch/precompiled_xsec_gpg.cxx
xmlsecurity/inc/pch/precompiled_xsec_gpg.hxx xmlsecurity/inc/pch/precompiled_xsec_gpg.hxx
xmlsecurity/inc/pch/precompiled_xsec_xmlsec.cxx xmlsecurity/inc/pch/precompiled_xsec_xmlsec.cxx
xmlsecurity/inc/pch/precompiled_xsec_xmlsec.hxx xmlsecurity/inc/pch/precompiled_xsec_xmlsec.hxx
xmlsecurity/inc/resourcemanager.hxx
xmlsecurity/inc/xmlsec-wrapper.h xmlsecurity/inc/xmlsec-wrapper.h
xmlsecurity/inc/xmlsec/errorcallback.hxx xmlsecurity/inc/xmlsec/errorcallback.hxx
xmlsecurity/inc/xmlsec/saxhelper.hxx xmlsecurity/inc/xmlsec/saxhelper.hxx
...@@ -19469,7 +19469,6 @@ xmlsecurity/source/dialogs/certificatechooser.cxx ...@@ -19469,7 +19469,6 @@ xmlsecurity/source/dialogs/certificatechooser.cxx
xmlsecurity/source/dialogs/certificateviewer.cxx xmlsecurity/source/dialogs/certificateviewer.cxx
xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
xmlsecurity/source/dialogs/macrosecurity.cxx xmlsecurity/source/dialogs/macrosecurity.cxx
xmlsecurity/source/dialogs/resourcemanager.cxx
xmlsecurity/source/framework/buffernode.cxx xmlsecurity/source/framework/buffernode.cxx
xmlsecurity/source/framework/buffernode.hxx xmlsecurity/source/framework/buffernode.hxx
xmlsecurity/source/framework/elementcollector.cxx xmlsecurity/source/framework/elementcollector.cxx
......
...@@ -18,12 +18,14 @@ ...@@ -18,12 +18,14 @@
*/ */
#include <unotools/datetime.hxx> #include <unotools/datetime.hxx>
#include <unotools/syslocale.hxx>
#include <tools/date.hxx> #include <tools/date.hxx>
#include <tools/time.hxx> #include <tools/time.hxx>
#include <tools/datetime.hxx> #include <tools/datetime.hxx>
#include <rtl/ustrbuf.hxx> #include <rtl/ustrbuf.hxx>
#include <rtl/math.hxx> #include <rtl/math.hxx>
#include <osl/diagnose.h> #include <osl/diagnose.h>
#include <vcl/svapp.hxx>
#include <sstream> #include <sstream>
namespace namespace
...@@ -193,6 +195,27 @@ namespace ...@@ -193,6 +195,27 @@ namespace
namespace utl namespace utl
{ {
const LocaleDataWrapper& GetLocaleData()
{
static SvtSysLocale ourSysLocale;
return ourSysLocale.GetLocaleData();
}
DateTime GetDateTime(const css::util::DateTime& _rDT) { return DateTime(_rDT); }
OUString GetDateTimeString(const css::util::DateTime& _rDT)
{
// String with date and time information (#i20172#)
DateTime aDT(GetDateTime(_rDT));
const LocaleDataWrapper& rLoDa = GetLocaleData();
return rLoDa.getDate(aDT) + " " + rLoDa.getTime(aDT);
}
OUString GetDateString(const css::util::DateTime& _rDT)
{
return GetLocaleData().getDate(GetDateTime(_rDT));
}
void typeConvert(const Date& _rDate, css::util::Date& _rOut) void typeConvert(const Date& _rDate, css::util::Date& _rOut)
{ {
......
...@@ -51,7 +51,6 @@ $(eval $(call gb_Library_add_exception_objects,xmlsecurity,\ ...@@ -51,7 +51,6 @@ $(eval $(call gb_Library_add_exception_objects,xmlsecurity,\
xmlsecurity/source/dialogs/certificateviewer \ xmlsecurity/source/dialogs/certificateviewer \
xmlsecurity/source/dialogs/digitalsignaturesdialog \ xmlsecurity/source/dialogs/digitalsignaturesdialog \
xmlsecurity/source/dialogs/macrosecurity \ xmlsecurity/source/dialogs/macrosecurity \
xmlsecurity/source/dialogs/resourcemanager \
xmlsecurity/source/framework/buffernode \ xmlsecurity/source/framework/buffernode \
xmlsecurity/source/framework/elementcollector \ xmlsecurity/source/framework/elementcollector \
xmlsecurity/source/framework/elementmark \ xmlsecurity/source/framework/elementmark \
......
...@@ -21,38 +21,8 @@ ...@@ -21,38 +21,8 @@
#define INCLUDED_XMLSECURITY_SOURCE_DIALOGS_RESOURCEMANAGER_HXX #define INCLUDED_XMLSECURITY_SOURCE_DIALOGS_RESOURCEMANAGER_HXX
#include <unotools/resmgr.hxx> #include <unotools/resmgr.hxx>
#include <tools/datetime.hxx>
#include <com/sun/star/security/CertificateKind.hpp>
#include <com/sun/star/util/DateTime.hpp>
#include <com/sun/star/uno/Sequence.hxx>
#include <vector> inline OUString XsResId(const char* pId) { return Translate::get(pId, Translate::Create("xsc")); }
class FixedImage;
class Control;
class LocaleDataWrapper;
namespace XmlSec
{
const LocaleDataWrapper& GetLocaleData();
DateTime GetDateTime( const css::util::DateTime& _rDT );
OUString GetDateTimeString( const css::util::DateTime& _rDT );
OUString GetDateString( const css::util::DateTime& _rDT );
OUString GetCertificateKind( const css::security::CertificateKind& rKind );
std::vector< std::pair< OUString, OUString> >
parseDN(const OUString& rRawString);
std::pair< OUString, OUString> GetDNForCertDetailsView(
const OUString & rRawString);
OUString GetContentPart( const OUString& _rRawString );
OUString GetHexString( const css::uno::Sequence< sal_Int8 >& _rSeq, const char* _pSep, sal_uInt16 _nLineBreak = 0xFFFF );
}
inline OUString XsResId(const char* pId)
{
return Translate::get(pId, Translate::Create("xsc"));
}
#endif #endif
......
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
#include <comphelper/documentconstants.hxx> #include <comphelper/documentconstants.hxx>
#include <comphelper/propertyvalue.hxx> #include <comphelper/propertyvalue.hxx>
#include <comphelper/sequence.hxx> #include <comphelper/sequence.hxx>
#include <comphelper/xmlsechelper.hxx>
#include <cppuhelper/supportsservice.hxx> #include <cppuhelper/supportsservice.hxx>
#include <sal/log.hxx> #include <sal/log.hxx>
#include <com/sun/star/lang/IllegalArgumentException.hpp> #include <com/sun/star/lang/IllegalArgumentException.hpp>
......
...@@ -23,14 +23,16 @@ ...@@ -23,14 +23,16 @@
#include <biginteger.hxx> #include <biginteger.hxx>
#include <com/sun/star/xml/crypto/XSecurityEnvironment.hpp> #include <com/sun/star/xml/crypto/XSecurityEnvironment.hpp>
#include <comphelper/sequence.hxx> #include <comphelper/sequence.hxx>
#include <comphelper/xmlsechelper.hxx>
#include <com/sun/star/security/NoPasswordException.hpp> #include <com/sun/star/security/NoPasswordException.hpp>
#include <com/sun/star/security/CertificateCharacters.hpp> #include <com/sun/star/security/CertificateCharacters.hpp>
#include <resourcemanager.hxx>
#include <vcl/treelistentry.hxx> #include <vcl/treelistentry.hxx>
#include <unotools/datetime.hxx>
#include <unotools/useroptions.hxx> #include <unotools/useroptions.hxx>
using namespace comphelper;
using namespace css; using namespace css;
CertificateChooser::CertificateChooser(vcl::Window* _pParent, CertificateChooser::CertificateChooser(vcl::Window* _pParent,
...@@ -229,11 +231,11 @@ void CertificateChooser::ImplInitialize() ...@@ -229,11 +231,11 @@ void CertificateChooser::ImplInitialize()
userData->xSecurityEnvironment = secEnvironment; userData->xSecurityEnvironment = secEnvironment;
mvUserData.push_back(userData); mvUserData.push_back(userData);
OUString sIssuer = XmlSec::GetContentPart( xCerts[ nC ]->getIssuerName() ); OUString sIssuer = xmlsec::GetContentPart( xCerts[ nC ]->getIssuerName() );
SvTreeListEntry* pEntry = m_pCertLB->InsertEntry( XmlSec::GetContentPart( xCerts[ nC ]->getSubjectName() ) SvTreeListEntry* pEntry = m_pCertLB->InsertEntry( xmlsec::GetContentPart( xCerts[ nC ]->getSubjectName() )
+ "\t" + sIssuer + "\t" + sIssuer
+ "\t" + XmlSec::GetCertificateKind( xCerts[ nC ]->getCertificateKind() ) + "\t" + xmlsec::GetCertificateKind( xCerts[ nC ]->getCertificateKind() )
+ "\t" + XmlSec::GetDateString( xCerts[ nC ]->getNotValidAfter() ) + "\t" + utl::GetDateString( xCerts[ nC ]->getNotValidAfter() )
+ "\t" + UsageInClearText( xCerts[ nC ]->getCertificateUsage() ) ); + "\t" + UsageInClearText( xCerts[ nC ]->getCertificateUsage() ) );
pEntry->SetUserData( userData.get() ); pEntry->SetUserData( userData.get() );
......
...@@ -31,11 +31,14 @@ ...@@ -31,11 +31,14 @@
#include <strings.hrc> #include <strings.hrc>
#include <resourcemanager.hxx> #include <resourcemanager.hxx>
#include <comphelper/xmlsechelper.hxx>
#include <svtools/controldims.hxx> #include <svtools/controldims.hxx>
#include <tools/datetime.hxx>
#include <bitmaps.hlst> #include <bitmaps.hlst>
#include <vcl/settings.hxx> #include <vcl/settings.hxx>
using namespace comphelper;
using namespace ::com::sun::star; using namespace ::com::sun::star;
using namespace ::com::sun::star::uno; using namespace ::com::sun::star::uno;
...@@ -128,12 +131,12 @@ CertificateViewerGeneralTP::CertificateViewerGeneralTP( vcl::Window* _pParent, C ...@@ -128,12 +131,12 @@ CertificateViewerGeneralTP::CertificateViewerGeneralTP( vcl::Window* _pParent, C
// insert data // insert data
css::uno::Reference< css::security::XCertificate > xCert = mpDlg->mxCert; css::uno::Reference< css::security::XCertificate > xCert = mpDlg->mxCert;
OUString sSubjectName(XmlSec::GetContentPart(xCert->getSubjectName())); OUString sSubjectName(xmlsec::GetContentPart(xCert->getSubjectName()));
if (!sSubjectName.isEmpty()) if (!sSubjectName.isEmpty())
m_pIssuedToFT->SetText(sSubjectName); m_pIssuedToFT->SetText(sSubjectName);
else else
m_pIssuedToLabelFT->Hide(); m_pIssuedToLabelFT->Hide();
OUString sIssuerName(XmlSec::GetContentPart(xCert->getIssuerName())); OUString sIssuerName(xmlsec::GetContentPart(xCert->getIssuerName()));
if (!sIssuerName.isEmpty()) if (!sIssuerName.isEmpty())
m_pIssuedByFT->SetText(sIssuerName); m_pIssuedByFT->SetText(sIssuerName);
else else
...@@ -263,12 +266,12 @@ CertificateViewerDetailsTP::CertificateViewerDetailsTP( vcl::Window* _pParent, C ...@@ -263,12 +266,12 @@ CertificateViewerDetailsTP::CertificateViewerDetailsTP( vcl::Window* _pParent, C
aLBEntry = "V" + OUString::number( xCert->getVersion() + 1 ); aLBEntry = "V" + OUString::number( xCert->getVersion() + 1 );
InsertElement( XsResId( STR_VERSION ), aLBEntry, aLBEntry ); InsertElement( XsResId( STR_VERSION ), aLBEntry, aLBEntry );
Sequence< sal_Int8 > aSeq = xCert->getSerialNumber(); Sequence< sal_Int8 > aSeq = xCert->getSerialNumber();
aLBEntry = XmlSec::GetHexString( aSeq, pHexSep ); aLBEntry = xmlsec::GetHexString( aSeq, pHexSep );
aDetails = XmlSec::GetHexString( aSeq, pHexSep, nLineBreak ); aDetails = xmlsec::GetHexString( aSeq, pHexSep, nLineBreak );
InsertElement( XsResId( STR_SERIALNUM ), aLBEntry, aDetails, true ); InsertElement( XsResId( STR_SERIALNUM ), aLBEntry, aDetails, true );
std::pair< OUString, OUString> pairIssuer = std::pair< OUString, OUString> pairIssuer =
XmlSec::GetDNForCertDetailsView(xCert->getIssuerName()); xmlsec::GetDNForCertDetailsView(xCert->getIssuerName());
aLBEntry = pairIssuer.first; aLBEntry = pairIssuer.first;
aDetails = pairIssuer.second; aDetails = pairIssuer.second;
InsertElement( XsResId( STR_ISSUER ), aLBEntry, aDetails ); InsertElement( XsResId( STR_ISSUER ), aLBEntry, aDetails );
...@@ -286,7 +289,7 @@ CertificateViewerDetailsTP::CertificateViewerDetailsTP( vcl::Window* _pParent, C ...@@ -286,7 +289,7 @@ CertificateViewerDetailsTP::CertificateViewerDetailsTP( vcl::Window* _pParent, C
InsertElement( XsResId( STR_VALIDTO ), aLBEntry, aLBEntry ); InsertElement( XsResId( STR_VALIDTO ), aLBEntry, aLBEntry );
std::pair< OUString, OUString > pairSubject = std::pair< OUString, OUString > pairSubject =
XmlSec::GetDNForCertDetailsView(xCert->getSubjectName()); xmlsec::GetDNForCertDetailsView(xCert->getSubjectName());
aLBEntry = pairSubject.first; aLBEntry = pairSubject.first;
aDetails = pairSubject.second; aDetails = pairSubject.second;
InsertElement( XsResId( STR_SUBJECT ), aLBEntry, aDetails ); InsertElement( XsResId( STR_SUBJECT ), aLBEntry, aDetails );
...@@ -294,8 +297,8 @@ CertificateViewerDetailsTP::CertificateViewerDetailsTP( vcl::Window* _pParent, C ...@@ -294,8 +297,8 @@ CertificateViewerDetailsTP::CertificateViewerDetailsTP( vcl::Window* _pParent, C
aLBEntry = aDetails = xCert->getSubjectPublicKeyAlgorithm(); aLBEntry = aDetails = xCert->getSubjectPublicKeyAlgorithm();
InsertElement( XsResId( STR_SUBJECT_PUBKEY_ALGO ), aLBEntry, aDetails ); InsertElement( XsResId( STR_SUBJECT_PUBKEY_ALGO ), aLBEntry, aDetails );
aSeq = xCert->getSubjectPublicKeyValue(); aSeq = xCert->getSubjectPublicKeyValue();
aLBEntry = XmlSec::GetHexString( aSeq, pHexSep ); aLBEntry = xmlsec::GetHexString( aSeq, pHexSep );
aDetails = XmlSec::GetHexString( aSeq, pHexSep, nLineBreak ); aDetails = xmlsec::GetHexString( aSeq, pHexSep, nLineBreak );
InsertElement( XsResId( STR_SUBJECT_PUBKEY_VAL ), aLBEntry, aDetails, true ); InsertElement( XsResId( STR_SUBJECT_PUBKEY_VAL ), aLBEntry, aDetails, true );
aLBEntry = aDetails = xCert->getSignatureAlgorithm(); aLBEntry = aDetails = xCert->getSignatureAlgorithm();
...@@ -309,13 +312,13 @@ CertificateViewerDetailsTP::CertificateViewerDetailsTP( vcl::Window* _pParent, C ...@@ -309,13 +312,13 @@ CertificateViewerDetailsTP::CertificateViewerDetailsTP( vcl::Window* _pParent, C
} }
aSeq = xCert->getSHA1Thumbprint(); aSeq = xCert->getSHA1Thumbprint();
aLBEntry = XmlSec::GetHexString( aSeq, pHexSep ); aLBEntry = xmlsec::GetHexString( aSeq, pHexSep );
aDetails = XmlSec::GetHexString( aSeq, pHexSep, nLineBreak ); aDetails = xmlsec::GetHexString( aSeq, pHexSep, nLineBreak );
InsertElement( XsResId( STR_THUMBPRINT_SHA1 ), aLBEntry, aDetails, true ); InsertElement( XsResId( STR_THUMBPRINT_SHA1 ), aLBEntry, aDetails, true );
aSeq = xCert->getMD5Thumbprint(); aSeq = xCert->getMD5Thumbprint();
aLBEntry = XmlSec::GetHexString( aSeq, pHexSep ); aLBEntry = xmlsec::GetHexString( aSeq, pHexSep );
aDetails = XmlSec::GetHexString( aSeq, pHexSep, nLineBreak ); aDetails = xmlsec::GetHexString( aSeq, pHexSep, nLineBreak );
InsertElement( XsResId( STR_THUMBPRINT_MD5 ), aLBEntry, aDetails, true ); InsertElement( XsResId( STR_THUMBPRINT_MD5 ), aLBEntry, aDetails, true );
m_pElementsLB->SetSelectHdl( LINK( this, CertificateViewerDetailsTP, ElementSelectHdl ) ); m_pElementsLB->SetSelectHdl( LINK( this, CertificateViewerDetailsTP, ElementSelectHdl ) );
...@@ -426,7 +429,7 @@ void CertificateViewerCertPathTP::ActivatePage() ...@@ -426,7 +429,7 @@ void CertificateViewerCertPathTP::ActivatePage()
for (i = nCnt-1; i >= 0; i--) for (i = nCnt-1; i >= 0; i--)
{ {
const Reference< security::XCertificate > rCert = pCertPath[ i ]; const Reference< security::XCertificate > rCert = pCertPath[ i ];
OUString sName = XmlSec::GetContentPart( rCert->getSubjectName() ); OUString sName = xmlsec::GetContentPart( rCert->getSubjectName() );
//Verify the certificate //Verify the certificate
sal_Int32 certStatus = mpDlg->mxSecurityEnvironment->verifyCertificate(rCert, sal_Int32 certStatus = mpDlg->mxSecurityEnvironment->verifyCertificate(rCert,
Sequence<Reference<css::security::XCertificate> >()); Sequence<Reference<css::security::XCertificate> >());
......
...@@ -48,14 +48,17 @@ ...@@ -48,14 +48,17 @@
#include <tools/date.hxx> #include <tools/date.hxx>
#include <tools/time.hxx> #include <tools/time.hxx>
#include <unotools/datetime.hxx>
#include <vcl/treelistentry.hxx> #include <vcl/treelistentry.hxx>
#include <strings.hrc> #include <strings.hrc>
#include <resourcemanager.hxx> #include <resourcemanager.hxx>
#include <comphelper/xmlsechelper.hxx>
#include <vcl/weld.hxx> #include <vcl/weld.hxx>
#include <unotools/configitem.hxx> #include <unotools/configitem.hxx>
using namespace comphelper;
using namespace css::security; using namespace css::security;
using namespace css::uno; using namespace css::uno;
using namespace css; using namespace css;
...@@ -587,8 +590,8 @@ void DigitalSignaturesDialog::ImplFillSignaturesBox() ...@@ -587,8 +590,8 @@ void DigitalSignaturesDialog::ImplFillSignaturesBox()
bCertValid = false; bCertValid = false;
} }
aSubject = XmlSec::GetContentPart( xCert->getSubjectName() ); aSubject = xmlsec::GetContentPart( xCert->getSubjectName() );
aIssuer = XmlSec::GetContentPart( xCert->getIssuerName() ); aIssuer = xmlsec::GetContentPart( xCert->getIssuerName() );
} }
else if (!rInfo.ouGpgCertificate.isEmpty()) else if (!rInfo.ouGpgCertificate.isEmpty())
{ {
...@@ -596,7 +599,7 @@ void DigitalSignaturesDialog::ImplFillSignaturesBox() ...@@ -596,7 +599,7 @@ void DigitalSignaturesDialog::ImplFillSignaturesBox()
aIssuer = rInfo.ouGpgOwner; aIssuer = rInfo.ouGpgOwner;
} }
aDateTimeStr = XmlSec::GetDateTimeString( rInfo.stDateTime ); aDateTimeStr = utl::GetDateTimeString( rInfo.stDateTime );
aDescription = rInfo.ouDescription; aDescription = rInfo.ouDescription;
// Decide type string. // Decide type string.
......
...@@ -33,16 +33,18 @@ ...@@ -33,16 +33,18 @@
#include <comphelper/sequence.hxx> #include <comphelper/sequence.hxx>
#include <sfx2/filedlghelper.hxx> #include <sfx2/filedlghelper.hxx>
#include <comphelper/processfactory.hxx> #include <comphelper/processfactory.hxx>
#include <comphelper/xmlsechelper.hxx>
#include <com/sun/star/uno/Exception.hpp> #include <com/sun/star/uno/Exception.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/ui/dialogs/FolderPicker.hpp> #include <com/sun/star/ui/dialogs/FolderPicker.hpp>
#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
#include <tools/urlobj.hxx> #include <tools/urlobj.hxx>
#include <unotools/datetime.hxx>
#include <vcl/treelistentry.hxx> #include <vcl/treelistentry.hxx>
#include <strings.hrc> #include <strings.hrc>
#include <resourcemanager.hxx>
using namespace comphelper;
using namespace ::com::sun::star; using namespace ::com::sun::star;
...@@ -328,9 +330,9 @@ void MacroSecurityTrustedSourcesTP::FillCertLB() ...@@ -328,9 +330,9 @@ void MacroSecurityTrustedSourcesTP::FillCertLB()
// create from RawData // create from RawData
xCert = mpDlg->mxSecurityEnvironment->createCertificateFromAscii( rEntry[ 2 ] ); xCert = mpDlg->mxSecurityEnvironment->createCertificateFromAscii( rEntry[ 2 ] );
SvTreeListEntry* pLBEntry = m_pTrustCertLB->InsertEntry( XmlSec::GetContentPart( xCert->getSubjectName() ) ); SvTreeListEntry* pLBEntry = m_pTrustCertLB->InsertEntry( xmlsec::GetContentPart( xCert->getSubjectName() ) );
m_pTrustCertLB->SetEntryText( XmlSec::GetContentPart( xCert->getIssuerName() ), pLBEntry, 1 ); m_pTrustCertLB->SetEntryText( xmlsec::GetContentPart( xCert->getIssuerName() ), pLBEntry, 1 );
m_pTrustCertLB->SetEntryText( XmlSec::GetDateTimeString( xCert->getNotValidAfter() ), pLBEntry, 2 ); m_pTrustCertLB->SetEntryText( utl::GetDateTimeString( xCert->getNotValidAfter() ), pLBEntry, 2 );
pLBEntry->SetUserData( reinterpret_cast<void*>(nEntry) ); // misuse user data as index pLBEntry->SetUserData( reinterpret_cast<void*>(nEntry) ); // misuse user data as index
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment