Kaydet (Commit) 88ac77c0 authored tarafından Samuel Mehrbrodt's avatar Samuel Mehrbrodt Kaydeden (comit) Thorsten Behrens

gpg4libre: List and view GPG keys

* Add GPG implementation of css::xml::crypto UNO interfaces (part of that is only stub atm)
* List gpg keys along with other certificates
* Viewing gpg certificates: Not all properties are implemented yet

Change-Id: I7f60b26efe949a94bf8fe1b8d4d428002c2995b1
Reviewed-on: https://gerrit.libreoffice.org/33843Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarSiegmund Gorr <siegmund.gorr@cib.de>
Reviewed-by: 's avatarThorsten Behrens <Thorsten.Behrens@CIB.de>
üst ed0e8f97
...@@ -624,6 +624,7 @@ $(eval $(call gb_Helper_register_libraries_for_install,PLAINLIBS_OOO,ooo, \ ...@@ -624,6 +624,7 @@ $(eval $(call gb_Helper_register_libraries_for_install,PLAINLIBS_OOO,ooo, \
xmlsecurity \ xmlsecurity \
xsec_fw \ xsec_fw \
xsec_xmlsec \ xsec_xmlsec \
$(if $(filter-out MACOSX WNT,$(OS)),xsec_gpg) \
xstor \ xstor \
$(if $(filter $(OS),MACOSX), \ $(if $(filter $(OS),MACOSX), \
macab1 \ macab1 \
......
...@@ -124,6 +124,7 @@ DEFAULTS = \ ...@@ -124,6 +124,7 @@ DEFAULTS = \
'xmlsecurity.xmlsecurity' : ( 6, EXCLUDE, INCLUDE, INCLUDE), # 5.1 'xmlsecurity.xmlsecurity' : ( 6, EXCLUDE, INCLUDE, INCLUDE), # 5.1
'xmlsecurity.xsec_fw' : ( 2, EXCLUDE, INCLUDE, EXCLUDE), # 2.7 'xmlsecurity.xsec_fw' : ( 2, EXCLUDE, INCLUDE, EXCLUDE), # 2.7
'xmlsecurity.xsec_xmlsec' : ( 2, EXCLUDE, INCLUDE, INCLUDE), # 4.4 'xmlsecurity.xsec_xmlsec' : ( 2, EXCLUDE, INCLUDE, INCLUDE), # 4.4
'xmlsecurity.xsec_gpg' : ( 2, EXCLUDE, INCLUDE, INCLUDE), # ?
} }
def remove_rare(raw, min_use=-1): def remove_rare(raw, min_use=-1):
......
...@@ -43,7 +43,8 @@ bool Plugin::ignoreLocation( SourceLocation loc ) ...@@ -43,7 +43,8 @@ bool Plugin::ignoreLocation( SourceLocation loc )
const char* bufferName = compiler.getSourceManager().getPresumedLoc( expansionLoc ).getFilename(); const char* bufferName = compiler.getSourceManager().getPresumedLoc( expansionLoc ).getFilename();
if (bufferName == NULL if (bufferName == NULL
|| strncmp( bufferName, SRCDIR "/external/", strlen( SRCDIR "/external/" )) == 0 || strncmp( bufferName, SRCDIR "/external/", strlen( SRCDIR "/external/" )) == 0
|| strcmp( bufferName, SRCDIR "/sdext/source/pdfimport/wrapper/keyword_list" ) == 0 ) || strcmp( bufferName, SRCDIR "/sdext/source/pdfimport/wrapper/keyword_list" ) == 0
|| strncmp( bufferName, SRCDIR "/xmlsecurity/source/gpg", strlen( SRCDIR "/xmlsecurity/source/gpg" )) == 0 )
// workdir/CustomTarget/sdext/pdfimport/hash.cxx is generated from // workdir/CustomTarget/sdext/pdfimport/hash.cxx is generated from
// sdext/source/pdfimport/wrapper/keyword_list by gperf, which // sdext/source/pdfimport/wrapper/keyword_list by gperf, which
// inserts various #line directives denoting the latter into the // inserts various #line directives denoting the latter into the
......
...@@ -463,6 +463,13 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,com/sun/star/xml/crypto,\ ...@@ -463,6 +463,13 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,com/sun/star/xml/crypto,\
SEInitializer \ SEInitializer \
XMLSecurityContext \ XMLSecurityContext \
)) ))
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,com/sun/star/xml/crypto/gpg,\
GpgSecurityEnvironment \
GpgSEInitializer \
GpgXMLEncryption \
GpgXMLSecurityContext \
GpgXMLSignature \
))
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,com/sun/star/xml/dom,\ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,com/sun/star/xml/dom,\
DocumentBuilder \ DocumentBuilder \
SAXDocumentBuilder \ SAXDocumentBuilder \
......
/* -*- 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/.
*/
#ifndef __com_sun_star_xml_crypto_gpg_GpgSEInitializer_idl_
#define __com_sun_star_xml_crypto_gpg_GpgSEInitializer_idl_
#include <com/sun/star/xml/crypto/XSEInitializer.idl>
module com { module sun { module star { module xml { module crypto { module gpg {
/**
* Service implementing XSEInitializer
*
* @since LibreOffice 5.4
*/
service GpgSEInitializer : XSEInitializer;
} ; } ; } ; } ; } ; } ;
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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/.
*/
#ifndef __com_sun_star_xml_crypto_gpg_GpgSecurityEnvironment_idl_
#define __com_sun_star_xml_crypto_gpg_GpgSecurityEnvironment_idl_
#include <com/sun/star/xml/crypto/XSecurityEnvironment.idl>
module com { module sun { module star { module xml { module crypto { module gpg {
/**
* Service implementing XSecurityEnvironment
*
* @since LibreOffice 5.4
*/
service GpgSecurityEnvironment : XSecurityEnvironment;
} ; } ; } ; } ; } ; } ;
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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/.
*/
#ifndef __com_sun_star_xml_crypto_gpg_GpgXMLEncryption_idl_
#define __com_sun_star_xml_crypto_gpg_GpgXMLEncryption_idl_
#include <com/sun/star/uno/XInterface.idl>
#include <com/sun/star/uno/Exception.idl>
#include <com/sun/star/xml/crypto/XXMLEncryption.idl>
#include <com/sun/star/lang/XInitialization.idl>
module com { module sun { module star { module xml { module crypto { module gpg {
/**
* Service implementing XXMLEncryption
*
* @since LibreOffice 5.4
*/
service GpgXMLEncryption {
interface com::sun::star::xml::crypto::XXMLEncryption ;
interface com::sun::star::lang::XInitialization ;
} ;
} ; } ; } ; } ; } ; } ;
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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/.
*/
#ifndef __com_sun_star_xml_crypto_gpg_GpgXMLSecurityContext_idl_
#define __com_sun_star_xml_crypto_gpg_GpgXMLSecurityContext_idl_
#include <com/sun/star/xml/crypto/XXMLSecurityContext.idl>
module com { module sun { module star { module xml { module crypto { module gpg {
/**
* Service implementing XXMLSecurityContext
*
* @since LibreOffice 5.4
*/
service GpgXMLSecurityContext : XXMLSecurityContext;
} ; } ; } ; } ; } ; } ;
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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/.
*/
#ifndef __com_sun_star_xml_crypto_gpg_GpgXmlSignature_idl_
#define __com_sun_star_xml_crypto_gpg_GpgXmlSignature_idl_
#include <com/sun/star/uno/XInterface.idl>
#include <com/sun/star/uno/Exception.idl>
#include <com/sun/star/xml/crypto/XXMLSignature.idl>
#include <com/sun/star/lang/XInitialization.idl>
module com { module sun { module star { module xml { module crypto { module gpg {
/**
* Service implementing XXMLSignature
*
* @since LibreOffice 5.4
*/
service GpgXMLSignature {
interface com::sun::star::xml::crypto::XXMLSignature ;
interface com::sun::star::lang::XInitialization ;
} ;
} ; } ; } ; } ; } ; } ;
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -109,6 +109,7 @@ $(eval $(call gb_Rdb_add_components,services,\ ...@@ -109,6 +109,7 @@ $(eval $(call gb_Rdb_add_components,services,\
xmloff/source/transform/xof \ xmloff/source/transform/xof \
xmloff/util/xo \ xmloff/util/xo \
xmlscript/util/xmlscript \ xmlscript/util/xmlscript \
$(if $(filter-out MACOSX WNT,$(OS)),xmlsecurity/util/xsec_gpg) \
$(if $(ENABLE_NSS), \ $(if $(ENABLE_NSS), \
xmlsecurity/util/xmlsecurity \ xmlsecurity/util/xmlsecurity \
xmlsecurity/util/xsec_xmlsec$(if $(filter WNT,$(OS)),.windows)) \ xmlsecurity/util/xsec_xmlsec$(if $(filter WNT,$(OS)),.windows)) \
......
...@@ -20,7 +20,7 @@ $(eval $(call gb_Library_add_defs,xmlsecurity,\ ...@@ -20,7 +20,7 @@ $(eval $(call gb_Library_add_defs,xmlsecurity,\
-DXMLSECURITY_DLLIMPLEMENTATION \ -DXMLSECURITY_DLLIMPLEMENTATION \
)) ))
$(eval $(call gb_Library_use_external,xmlsecurity,boost_headers)) $(eval $(call gb_Library_use_externals,xmlsecurity,boost_headers))
$(eval $(call gb_Library_set_precompiled_header,xmlsecurity,$(SRCDIR)/xmlsecurity/inc/pch/precompiled_xmlsecurity)) $(eval $(call gb_Library_set_precompiled_header,xmlsecurity,$(SRCDIR)/xmlsecurity/inc/pch/precompiled_xmlsecurity))
...@@ -46,6 +46,12 @@ $(eval $(call gb_Library_use_libraries,xmlsecurity,\ ...@@ -46,6 +46,12 @@ $(eval $(call gb_Library_use_libraries,xmlsecurity,\
$(gb_UWINAPI) \ $(gb_UWINAPI) \
)) ))
ifneq ($(filter-out WNT MACOSX,$(OS)),)
$(eval $(call gb_Library_use_libraries,xmlsecurity,\
xsec_gpg \
))
endif
$(eval $(call gb_Library_add_exception_objects,xmlsecurity,\ $(eval $(call gb_Library_add_exception_objects,xmlsecurity,\
xmlsecurity/source/component/certificatecontainer \ xmlsecurity/source/component/certificatecontainer \
xmlsecurity/source/component/documentdigitalsignatures \ xmlsecurity/source/component/documentdigitalsignatures \
......
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# 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/.
#
$(eval $(call gb_Library_Library,xsec_gpg))
$(eval $(call gb_Library_set_componentfile,xsec_gpg,xmlsecurity/util/xsec_gpg))
$(eval $(call gb_Library_set_include,xsec_gpg,\
$$(INCLUDE) \
-I$(SRCDIR)/xmlsecurity/inc \
-I$(SRCDIR)/xmlsecurity/source/gpg \
))
$(eval $(call gb_Library_add_defs,xsec_gpg,\
-DXSECFW_DLLIMPLEMENTATION \
-DXMLSEC_CRYPTO_GPG \
))
$(eval $(call gb_Library_use_custom_headers,xsec_gpg,\
officecfg/registry \
))
$(eval $(call gb_Library_use_sdk_api,xsec_gpg))
$(eval $(call gb_Library_set_precompiled_header,xsec_gpg,$(SRCDIR)/xmlsecurity/inc/pch/precompiled_xsec_gpg))
$(eval $(call gb_Library_use_externals,xsec_gpg,gpgmepp))
$(eval $(call gb_Library_use_libraries,xsec_gpg,\
comphelper \
cppu \
cppuhelper \
sal \
svl \
tl \
xo \
$(gb_UWINAPI) \
))
$(eval $(call gb_Library_add_exception_objects,xsec_gpg,\
xmlsecurity/source/gpg/CertificateImpl \
xmlsecurity/source/gpg/CipherContext \
xmlsecurity/source/gpg/DigestContext \
xmlsecurity/source/gpg/GpgComponentFactory \
xmlsecurity/source/gpg/SecurityEnvironment \
xmlsecurity/source/gpg/SEInitializer \
xmlsecurity/source/gpg/XMLEncryption \
xmlsecurity/source/gpg/XMLSecurityContext \
xmlsecurity/source/gpg/XMLSignature \
))
# vim: set noet sw=4 ts=4:
...@@ -19,6 +19,12 @@ $(eval $(call gb_Module_add_targets,xmlsecurity,\ ...@@ -19,6 +19,12 @@ $(eval $(call gb_Module_add_targets,xmlsecurity,\
Library_xsec_xmlsec \ Library_xsec_xmlsec \
)) ))
ifneq ($(filter-out WNT MACOSX,$(OS)),)
$(eval $(call gb_Module_add_targets,xmlsecurity,\
Library_xsec_gpg \
))
endif
$(eval $(call gb_Module_add_slowcheck_targets,xmlsecurity,\ $(eval $(call gb_Module_add_slowcheck_targets,xmlsecurity,\
CppunitTest_xmlsecurity_signing \ CppunitTest_xmlsecurity_signing \
CppunitTest_xmlsecurity_pdfsigning \ CppunitTest_xmlsecurity_pdfsigning \
......
Stuff for document signing. Stuff for document signing.
This code provides dialogs, and infrastructure wrapping libxmlsec that This code provides dialogs, and infrastructure wrapping libxmlsec and gpgme that
implements document signing. implements document signing.
...@@ -40,12 +40,19 @@ namespace xml { namespace crypto { ...@@ -40,12 +40,19 @@ namespace xml { namespace crypto {
class HeaderBar; class HeaderBar;
struct UserData
{
css::uno::Reference<css::security::XCertificate> xCertificate;
css::uno::Reference<css::xml::crypto::XSecurityEnvironment> xSecurityEnvironment;
};
class CertificateChooser : public ModalDialog class CertificateChooser : public ModalDialog
{ {
private: private:
css::uno::Reference< css::uno::XComponentContext > mxCtx; css::uno::Reference< css::uno::XComponentContext > mxCtx;
css::uno::Reference< css::xml::crypto::XSecurityEnvironment > mxSecurityEnvironment; std::vector< css::uno::Reference< css::xml::crypto::XSecurityEnvironment > > mxSecurityEnvironments;
css::uno::Sequence< css::uno::Reference< css::security::XCertificate > > maCerts; css::uno::Sequence< css::uno::Reference< css::security::XCertificate > > maCerts;
std::vector<std::shared_ptr<UserData>> mvUserData;
VclPtr<SvSimpleTable> m_pCertLB; VclPtr<SvSimpleTable> m_pCertLB;
VclPtr<PushButton> m_pViewBtn; VclPtr<PushButton> m_pViewBtn;
...@@ -54,8 +61,6 @@ private: ...@@ -54,8 +61,6 @@ private:
bool mbInitialized; bool mbInitialized;
sal_uInt16 GetSelectedEntryPos() const;
DECL_LINK(ViewButtonHdl, Button*, void); DECL_LINK(ViewButtonHdl, Button*, void);
DECL_LINK(CertificateHighlightHdl, SvTreeListBox*, void ); DECL_LINK(CertificateHighlightHdl, SvTreeListBox*, void );
DECL_LINK(CertificateSelectHdl, SvTreeListBox*, bool ); DECL_LINK(CertificateSelectHdl, SvTreeListBox*, bool );
...@@ -66,7 +71,9 @@ private: ...@@ -66,7 +71,9 @@ private:
void HandleOneUsageBit(OUString& string, int& bits, int bit, const char *name); void HandleOneUsageBit(OUString& string, int& bits, int bit, const char *name);
public: public:
CertificateChooser(vcl::Window* pParent, css::uno::Reference< css::uno::XComponentContext>& rxCtx, css::uno::Reference< css::xml::crypto::XSecurityEnvironment >& rxSecurityEnvironment); CertificateChooser(vcl::Window* pParent,
css::uno::Reference< css::uno::XComponentContext>& rxCtx,
std::vector< css::uno::Reference< css::xml::crypto::XSecurityEnvironment > >& rxSecurityEnvironments);
virtual ~CertificateChooser() override; virtual ~CertificateChooser() override;
virtual void dispose() override; virtual void dispose() override;
......
...@@ -49,6 +49,8 @@ public: ...@@ -49,6 +49,8 @@ public:
css::uno::Reference<css::embed::XStorage> mxTempSignatureStorage; css::uno::Reference<css::embed::XStorage> mxTempSignatureStorage;
css::uno::Reference<css::xml::crypto::XSEInitializer> mxSEInitializer; css::uno::Reference<css::xml::crypto::XSEInitializer> mxSEInitializer;
css::uno::Reference<css::xml::crypto::XXMLSecurityContext> mxSecurityContext; css::uno::Reference<css::xml::crypto::XXMLSecurityContext> mxSecurityContext;
css::uno::Reference<css::xml::crypto::XSEInitializer> mxGpgSEInitializer;
css::uno::Reference<css::xml::crypto::XXMLSecurityContext> mxGpgSecurityContext;
DocumentSignatureManager(const css::uno::Reference<css::uno::XComponentContext>& xContext, DocumentSignatureMode eMode); DocumentSignatureManager(const css::uno::Reference<css::uno::XComponentContext>& xContext, DocumentSignatureMode eMode);
~DocumentSignatureManager(); ~DocumentSignatureManager();
...@@ -76,6 +78,7 @@ public: ...@@ -76,6 +78,7 @@ public:
bool init(); bool init();
/// Get the security environment. /// Get the security environment.
css::uno::Reference<css::xml::crypto::XSecurityEnvironment> getSecurityEnvironment(); css::uno::Reference<css::xml::crypto::XSecurityEnvironment> getSecurityEnvironment();
css::uno::Reference<css::xml::crypto::XSecurityEnvironment> getGpgSecurityEnvironment();
}; };
#endif // INCLUDED_XMLSECURITY_INC_DOCUMENTSIGNATUREMANAGER_HXX #endif // INCLUDED_XMLSECURITY_INC_DOCUMENTSIGNATUREMANAGER_HXX
......
/* -*- 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/.
*/
#include "precompiled_xsec_gpg.hxx"
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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 has been autogenerated by update_pch.sh. It is possible to edit it
manually (such as when an include file has been moved/renamed/removed). All such
manual changes will be rewritten by the next run of update_pch.sh (which presumably
also fixes all possible problems, so it's usually better to use it).
Generated on 2017-03-03 09:38:52 using:
./bin/update_pch xmlsecurity/ xsec_gpg --cutoff=1 --exclude:system --include:module --include:local
If after updating build fails, use the following command to locate conflicting headers:
./bin/update_pch_bisect ./xmlsecurity/inc/pch/precompiled_xsec_gpg.hxx "make xmlsecurity/.build" --find-conflicts
*/
#include <context.h>
#include <gpgme.h>
#include <key.h>
#include <keylistresult.h>
#include <list>
#include <com/sun/star/xml/crypto/gpg/GpgSecurityEnvironment.hpp>
#include <com/sun/star/xml/crypto/gpg/GpgXMLSecurityContext.hpp>
#include <comphelper/processfactory.hxx>
#include <comphelper/servicehelper.hxx>
#include <cppuhelper/factory.hxx>
#include <cppuhelper/supportsservice.hxx>
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -447,14 +447,16 @@ sal_Bool DocumentDigitalSignatures::isAuthorTrusted( ...@@ -447,14 +447,16 @@ sal_Bool DocumentDigitalSignatures::isAuthorTrusted(
Reference< css::security::XCertificate > DocumentDigitalSignatures::chooseCertificate(OUString& rDescription) Reference< css::security::XCertificate > DocumentDigitalSignatures::chooseCertificate(OUString& rDescription)
{ {
Reference< css::xml::crypto::XSecurityEnvironment > xSecEnv; std::vector< Reference< css::xml::crypto::XSecurityEnvironment > > xSecEnvs;
DocumentSignatureMode eMode{}; DocumentSignatureMode eMode{};
DocumentSignatureManager aSignatureManager(mxCtx, eMode); DocumentSignatureManager aSignatureManager(mxCtx, eMode);
if (aSignatureManager.init()) if (aSignatureManager.init()) {
xSecEnv = aSignatureManager.getSecurityEnvironment(); xSecEnvs.push_back(aSignatureManager.getSecurityEnvironment());
xSecEnvs.push_back(aSignatureManager.getGpgSecurityEnvironment());
}
ScopedVclPtrInstance< CertificateChooser > aChooser(nullptr, mxCtx, xSecEnv); ScopedVclPtrInstance< CertificateChooser > aChooser(nullptr, mxCtx, xSecEnvs);
if (aChooser->Execute() != RET_OK) if (aChooser->Execute() != RET_OK)
return Reference< css::security::XCertificate >(nullptr); return Reference< css::security::XCertificate >(nullptr);
......
...@@ -32,23 +32,13 @@ ...@@ -32,23 +32,13 @@
#include <vcl/msgbox.hxx> #include <vcl/msgbox.hxx>
#include <svtools/treelistentry.hxx> #include <svtools/treelistentry.hxx>
using namespace ::com::sun::star; using namespace css;
#define INVAL_SEL 0xFFFF CertificateChooser::CertificateChooser(vcl::Window* _pParent,
uno::Reference<uno::XComponentContext>& _rxCtx,
sal_uInt16 CertificateChooser::GetSelectedEntryPos() const std::vector< css::uno::Reference< css::xml::crypto::XSecurityEnvironment > >& rxSecurityEnvironments)
{ : ModalDialog(_pParent, "SelectCertificateDialog", "xmlsec/ui/selectcertificatedialog.ui"),
sal_uInt16 nSel = INVAL_SEL; mvUserData()
SvTreeListEntry* pSel = m_pCertLB->FirstSelected();
if( pSel )
nSel = (sal_uInt16) reinterpret_cast<sal_uIntPtr>( pSel->GetUserData() );
return (sal_uInt16) nSel;
}
CertificateChooser::CertificateChooser(vcl::Window* _pParent, uno::Reference<uno::XComponentContext>& _rxCtx, uno::Reference<xml::crypto::XSecurityEnvironment>& _rxSecurityEnvironment)
: ModalDialog(_pParent, "SelectCertificateDialog", "xmlsec/ui/selectcertificatedialog.ui")
{ {
get(m_pOKBtn, "ok"); get(m_pOKBtn, "ok");
get(m_pViewBtn, "viewcert"); get(m_pViewBtn, "viewcert");
...@@ -71,7 +61,7 @@ CertificateChooser::CertificateChooser(vcl::Window* _pParent, uno::Reference<uno ...@@ -71,7 +61,7 @@ CertificateChooser::CertificateChooser(vcl::Window* _pParent, uno::Reference<uno
m_pViewBtn->SetClickHdl( LINK( this, CertificateChooser, ViewButtonHdl ) ); m_pViewBtn->SetClickHdl( LINK( this, CertificateChooser, ViewButtonHdl ) );
mxCtx = _rxCtx; mxCtx = _rxCtx;
mxSecurityEnvironment = _rxSecurityEnvironment; mxSecurityEnvironments = rxSecurityEnvironments;
mbInitialized = false; mbInitialized = false;
// disable buttons // disable buttons
...@@ -89,6 +79,7 @@ void CertificateChooser::dispose() ...@@ -89,6 +79,7 @@ void CertificateChooser::dispose()
m_pViewBtn.clear(); m_pViewBtn.clear();
m_pOKBtn.clear(); m_pOKBtn.clear();
m_pDescriptionED.clear(); m_pDescriptionED.clear();
mvUserData.clear();
ModalDialog::dispose(); ModalDialog::dispose();
} }
...@@ -159,36 +150,44 @@ void CertificateChooser::ImplInitialize() ...@@ -159,36 +150,44 @@ void CertificateChooser::ImplInitialize()
if ( mbInitialized ) if ( mbInitialized )
return; return;
try for (auto &secEnvironment : mxSecurityEnvironments)
{ {
maCerts = mxSecurityEnvironment->getPersonalCertificates(); uno::Sequence< uno::Reference< security::XCertificate > > xCerts;
} try
catch (security::NoPasswordException&) {
{ xCerts = secEnvironment->getPersonalCertificates();
} }
catch (security::NoPasswordException&)
sal_Int32 nCertificates = maCerts.getLength(); {
for( sal_Int32 nCert = nCertificates; nCert; ) }
{
uno::Reference< security::XCertificate > xCert = maCerts[ --nCert ];
// Check if we have a private key for this...
long nCertificateCharacters = mxSecurityEnvironment->getCertificateCharacters(xCert);
if (!(nCertificateCharacters & security::CertificateCharacters::HAS_PRIVATE_KEY)) sal_Int32 nCertificates = xCerts.getLength();
for( sal_Int32 nCert = nCertificates; nCert; )
{ {
::comphelper::removeElementAt( maCerts, nCert ); uno::Reference< security::XCertificate > xCert = xCerts[ --nCert ];
nCertificates = maCerts.getLength(); // Check if we have a private key for this...
long nCertificateCharacters = secEnvironment->getCertificateCharacters(xCert);
if (!(nCertificateCharacters & security::CertificateCharacters::HAS_PRIVATE_KEY))
{
::comphelper::removeElementAt( xCerts, nCert );
nCertificates = xCerts.getLength();
}
} }
}
// fill list of certificates; the first entry will be selected // fill list of certificates; the first entry will be selected
for ( sal_Int32 nC = 0; nC < nCertificates; ++nC ) for ( sal_Int32 nC = 0; nC < nCertificates; ++nC )
{ {
SvTreeListEntry* pEntry = m_pCertLB->InsertEntry( XmlSec::GetContentPart( maCerts[ nC ]->getSubjectName() ) std::shared_ptr<UserData> userData = std::make_shared<UserData>();
+ "\t" + XmlSec::GetContentPart( maCerts[ nC ]->getIssuerName() ) userData->xCertificate = xCerts[ nC ];
+ "\t" + UsageInClearText( maCerts[ nC ]->getCertificateUsage() ) userData->xSecurityEnvironment = secEnvironment;
+ "\t" + XmlSec::GetDateString( maCerts[ nC ]->getNotValidAfter() ) ); mvUserData.push_back(userData);
pEntry->SetUserData( reinterpret_cast<void*>(nC) ); // missuse user data as index SvTreeListEntry* pEntry = m_pCertLB->InsertEntry( XmlSec::GetContentPart( xCerts[ nC ]->getSubjectName() )
+ "\t" + XmlSec::GetContentPart( xCerts[ nC ]->getIssuerName() )
+ "\t" + UsageInClearText( xCerts[ nC ]->getCertificateUsage() )
+ "\t" + XmlSec::GetDateString( xCerts[ nC ]->getNotValidAfter() ) );
pEntry->SetUserData( userData.get() );
}
} }
// enable/disable buttons // enable/disable buttons
...@@ -199,10 +198,12 @@ void CertificateChooser::ImplInitialize() ...@@ -199,10 +198,12 @@ void CertificateChooser::ImplInitialize()
uno::Reference< css::security::XCertificate > CertificateChooser::GetSelectedCertificate() uno::Reference< css::security::XCertificate > CertificateChooser::GetSelectedCertificate()
{ {
uno::Reference< css::security::XCertificate > xCert; SvTreeListEntry* pSel = m_pCertLB->FirstSelected();
sal_uInt16 nSelected = GetSelectedEntryPos(); if( !pSel )
if ( nSelected < maCerts.getLength() ) return uno::Reference< css::security::XCertificate >();
xCert = maCerts[ nSelected ];
UserData* userData = static_cast<UserData*>(pSel->GetUserData());
uno::Reference<security::XCertificate> xCert = userData->xCertificate;
return xCert; return xCert;
} }
...@@ -232,12 +233,17 @@ IMPL_LINK_NOARG(CertificateChooser, ViewButtonHdl, Button*, void) ...@@ -232,12 +233,17 @@ IMPL_LINK_NOARG(CertificateChooser, ViewButtonHdl, Button*, void)
void CertificateChooser::ImplShowCertificateDetails() void CertificateChooser::ImplShowCertificateDetails()
{ {
uno::Reference< css::security::XCertificate > xCert = GetSelectedCertificate(); SvTreeListEntry* pSel = m_pCertLB->FirstSelected();
if( xCert.is() ) if( !pSel )
{ return;
ScopedVclPtrInstance< CertificateViewer > aViewer( this, mxSecurityEnvironment, xCert, true );
aViewer->Execute(); UserData* userData = static_cast<UserData*>(pSel->GetUserData());
}
if (!userData->xSecurityEnvironment.is() || !userData->xCertificate.is())
return;
ScopedVclPtrInstance< CertificateViewer > aViewer( this, userData->xSecurityEnvironment, userData->xCertificate, true );
aViewer->Execute();
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -383,9 +383,11 @@ IMPL_LINK_NOARG(DigitalSignaturesDialog, AddButtonHdl, Button*, void) ...@@ -383,9 +383,11 @@ IMPL_LINK_NOARG(DigitalSignaturesDialog, AddButtonHdl, Button*, void)
return; return;
try try
{ {
uno::Reference<xml::crypto::XSecurityEnvironment> xSecEnv = maSignatureManager.getSecurityEnvironment(); std::vector<uno::Reference<xml::crypto::XSecurityEnvironment>> xSecEnvs;
xSecEnvs.push_back(maSignatureManager.getSecurityEnvironment());
xSecEnvs.push_back(maSignatureManager.getGpgSecurityEnvironment());
ScopedVclPtrInstance< CertificateChooser > aChooser( this, mxCtx, xSecEnv ); ScopedVclPtrInstance< CertificateChooser > aChooser( this, mxCtx, xSecEnvs );
if ( aChooser->Execute() == RET_OK ) if ( aChooser->Execute() == RET_OK )
{ {
sal_Int32 nSecurityId; sal_Int32 nSecurityId;
......
...@@ -289,8 +289,22 @@ vector< pair< OUString, OUString> > parseDN(const OUString& rRawString) ...@@ -289,8 +289,22 @@ vector< pair< OUString, OUString> > parseDN(const OUString& rRawString)
OUString GetContentPart( const OUString& _rRawString ) OUString GetContentPart( const OUString& _rRawString )
{ {
char const * aIDs[] = { "CN", "OU", "O", "E", nullptr }; char const * aIDs[] = { "CN", "OU", "O", "E", nullptr };
OUString retVal; bool shouldBeParsed = false;
int i = 0; int i = 0;
while ( aIDs[i] )
{
if (_rRawString.startsWith(OUString::createFromAscii(aIDs[i++])))
{
shouldBeParsed = true;
break;
}
}
if (!shouldBeParsed)
return _rRawString;
OUString retVal;
i = 0;
vector< pair< OUString, OUString > > vecAttrValueOfDN = parseDN(_rRawString); vector< pair< OUString, OUString > > vecAttrValueOfDN = parseDN(_rRawString);
while ( aIDs[i] ) while ( aIDs[i] )
{ {
......
/* -*- 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/.
*/
#include "CertificateImpl.hxx"
#include <comphelper/servicehelper.hxx>
using namespace css;
using namespace css::uno;
using namespace css::security;
using namespace css::util;
CertificateImpl::CertificateImpl() :
m_pKey(nullptr)
{
}
CertificateImpl::~CertificateImpl()
{
}
//Methods from XCertificateImpl
sal_Int16 SAL_CALL CertificateImpl::getVersion()
throw ( RuntimeException, std::exception)
{
return 0;
}
Sequence< sal_Int8 > SAL_CALL CertificateImpl::getSerialNumber()
throw ( RuntimeException, std::exception)
{
return Sequence< sal_Int8 > ();
}
OUString SAL_CALL CertificateImpl::getIssuerName()
throw ( RuntimeException, std::exception)
{
return OStringToOUString(m_pKey.userID(0).name(), RTL_TEXTENCODING_UTF8);
}
OUString SAL_CALL CertificateImpl::getSubjectName()
throw ( RuntimeException, std::exception)
{
return OUString("");
}
namespace {
DateTime convertUnixTimeToDateTime(time_t time)
{
DateTime dateTime;
struct tm *timeStruct = gmtime(&time);
dateTime.Year = timeStruct->tm_year + 1900;
dateTime.Month = timeStruct->tm_mon + 1;
dateTime.Day = timeStruct->tm_mday;
dateTime.Hours = timeStruct->tm_hour;
dateTime.Minutes = timeStruct->tm_min;
dateTime.Seconds = timeStruct->tm_sec;
return dateTime;
}
}
DateTime SAL_CALL CertificateImpl::getNotValidBefore()
throw ( RuntimeException, std::exception)
{
const GpgME::Subkey subkey = m_pKey.subkey(0);
if (subkey.isNull())
return DateTime();
return convertUnixTimeToDateTime(m_pKey.subkey(0).creationTime());
}
DateTime SAL_CALL CertificateImpl::getNotValidAfter()
throw ( RuntimeException, std::exception)
{
const GpgME::Subkey subkey = m_pKey.subkey(0);
if (subkey.isNull() || subkey.neverExpires())
return DateTime();
return convertUnixTimeToDateTime(m_pKey.subkey(0).expirationTime());
}
Sequence< sal_Int8 > SAL_CALL CertificateImpl::getIssuerUniqueID()
throw ( RuntimeException, std::exception)
{
return Sequence< sal_Int8 > ();
}
Sequence< sal_Int8 > SAL_CALL CertificateImpl::getSubjectUniqueID()
throw ( RuntimeException, std::exception)
{
return Sequence< sal_Int8 > ();
}
Sequence< Reference< XCertificateExtension > > SAL_CALL CertificateImpl::getExtensions()
throw ( RuntimeException, std::exception)
{
return Sequence< Reference< XCertificateExtension > > ();
}
Reference< XCertificateExtension > SAL_CALL CertificateImpl::findCertificateExtension( const Sequence< sal_Int8 >& /*oid*/ )
throw (RuntimeException, std::exception)
{
return Reference< XCertificateExtension > ();
}
Sequence< sal_Int8 > SAL_CALL CertificateImpl::getEncoded()
throw ( RuntimeException, std::exception)
{
return Sequence< sal_Int8 > ();
}
OUString SAL_CALL CertificateImpl::getSubjectPublicKeyAlgorithm()
throw ( RuntimeException, std::exception)
{
return OUString();
}
Sequence< sal_Int8 > SAL_CALL CertificateImpl::getSubjectPublicKeyValue()
throw ( RuntimeException, std::exception)
{
return Sequence< sal_Int8 > ();
}
OUString SAL_CALL CertificateImpl::getSignatureAlgorithm()
throw ( RuntimeException, std::exception)
{
return OUString();
}
Sequence< sal_Int8 > SAL_CALL CertificateImpl::getSHA1Thumbprint()
throw ( RuntimeException, std::exception)
{
return Sequence< sal_Int8 > ();
}
uno::Sequence<sal_Int8> CertificateImpl::getSHA256Thumbprint()
throw (uno::RuntimeException, std::exception)
{
return Sequence< sal_Int8 > ();
}
Sequence< sal_Int8 > SAL_CALL CertificateImpl::getMD5Thumbprint()
throw ( RuntimeException, std::exception)
{
return Sequence< sal_Int8 > ();
}
sal_Int32 SAL_CALL CertificateImpl::getCertificateUsage()
throw ( RuntimeException, std::exception)
{
return 0;
}
/* XUnoTunnel */
sal_Int64 SAL_CALL CertificateImpl::getSomething(const Sequence< sal_Int8 >& aIdentifier)
throw( RuntimeException, std::exception )
{
if( aIdentifier.getLength() == 16 && 0 == memcmp( getUnoTunnelId().getConstArray(), aIdentifier.getConstArray(), 16 ) ) {
return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this));
}
return 0 ;
}
/* XUnoTunnel extension */
namespace
{
class CertificateImplUnoTunnelId : public rtl::Static< UnoTunnelIdInit, CertificateImplUnoTunnelId > {};
}
const Sequence< sal_Int8>& CertificateImpl::getUnoTunnelId() {
return CertificateImplUnoTunnelId::get().getSeq();
}
void CertificateImpl::setCertificate(GpgME::Key key)
{
m_pKey = key;
}
const GpgME::Key* CertificateImpl::getCertificate() const
{
return &m_pKey;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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/.
*/
#ifndef INCLUDED_XMLSECURITY_SOURCE_GPG_X509CERTIFICATE_HXX
#define INCLUDED_XMLSECURITY_SOURCE_GPG_X509CERTIFICATE_HXX
#include <certificate.hxx>
#include <sal/types.h>
#include <sal/config.h>
#include <rtl/ustring.hxx>
#include <cppuhelper/factory.hxx>
#include <cppuhelper/implbase.hxx>
#include <com/sun/star/uno/Exception.hpp>
#include <com/sun/star/uno/RuntimeException.hpp>
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <com/sun/star/uno/SecurityException.hpp>
#include <com/sun/star/security/XCertificate.hpp>
#include <key.h>
class CertificateImpl : public cppu::WeakImplHelper< css::security::XCertificate,
css::lang::XUnoTunnel >,
public xmlsecurity::Certificate
{
private:
GpgME::Key m_pKey;
public:
CertificateImpl();
virtual ~CertificateImpl() override;
//Methods from XCertificate
virtual sal_Int16 SAL_CALL getVersion()
throw ( css::uno::RuntimeException, std::exception) override;
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getSerialNumber()
throw ( css::uno::RuntimeException, std::exception) override;
virtual OUString SAL_CALL getIssuerName()
throw ( css::uno::RuntimeException, std::exception) override;
virtual OUString SAL_CALL getSubjectName()
throw ( css::uno::RuntimeException, std::exception) override;
virtual css::util::DateTime SAL_CALL getNotValidBefore()
throw ( css::uno::RuntimeException, std::exception) override;
virtual css::util::DateTime SAL_CALL getNotValidAfter()
throw ( css::uno::RuntimeException, std::exception) override;
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getIssuerUniqueID()
throw ( css::uno::RuntimeException, std::exception) override;
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getSubjectUniqueID()
throw ( css::uno::RuntimeException, std::exception) override;
virtual css::uno::Sequence< css::uno::Reference< css::security::XCertificateExtension > > SAL_CALL getExtensions()
throw ( css::uno::RuntimeException, std::exception) override;
virtual css::uno::Reference< css::security::XCertificateExtension > SAL_CALL findCertificateExtension(const css::uno::Sequence< sal_Int8 >& oid)
throw (css::uno::RuntimeException, std::exception) override;
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getEncoded()
throw ( css::uno::RuntimeException, std::exception) override;
virtual OUString SAL_CALL getSubjectPublicKeyAlgorithm()
throw ( css::uno::RuntimeException, std::exception) override;
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getSubjectPublicKeyValue()
throw ( css::uno::RuntimeException, std::exception) override;
virtual OUString SAL_CALL getSignatureAlgorithm()
throw ( css::uno::RuntimeException, std::exception) override;
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getSHA1Thumbprint()
throw ( css::uno::RuntimeException, std::exception) override;
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getMD5Thumbprint()
throw ( css::uno::RuntimeException, std::exception) override;
virtual sal_Int32 SAL_CALL getCertificateUsage()
throw ( css::uno::RuntimeException, std::exception) override;
//Methods from XUnoTunnel
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 >& aIdentifier)
throw (css::uno::RuntimeException, std::exception) override;
static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId();
/// @see xmlsecurity::Certificate::getSHA256Thumbprint().
virtual css::uno::Sequence<sal_Int8> getSHA256Thumbprint()
throw (css::uno::RuntimeException, std::exception) override;
// Helper methods
void setCertificate(GpgME::Key key);
const GpgME::Key* getCertificate() const;
} ;
#endif // INCLUDED_XMLSECURITY_SOURCE_GPG_X509CERTIFICATE_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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/.
*/
#include "CipherContext.hxx"
using namespace css;
using namespace css::uno;
using namespace css::lang;
Sequence< sal_Int8 > SAL_CALL CipherContext::convertWithCipherContext( const Sequence< sal_Int8 >& /*aData*/ )
throw ( IllegalArgumentException, DisposedException, RuntimeException, std::exception)
{
Sequence<sal_Int8>* seq = new Sequence< sal_Int8 >(0);
return *seq;
}
uno::Sequence< sal_Int8 > SAL_CALL CipherContext::finalizeCipherContextAndDispose()
throw (DisposedException, RuntimeException, std::exception)
{
Sequence<sal_Int8>* seq = new Sequence< sal_Int8 >(0);
return *seq;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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/.
*/
#ifndef INCLUDED_XMLSECURITY_SOURCE_GPG_CIPHERCONTEXT_HXX
#define INCLUDED_XMLSECURITY_SOURCE_GPG_CIPHERCONTEXT_HXX
#include <com/sun/star/xml/crypto/XCipherContext.hpp>
#include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
#include <cppuhelper/implbase.hxx>
class CipherContext : public cppu::WeakImplHelper< css::xml::crypto::XCipherContext >
{
private:
public:
// XCipherContext
virtual css::uno::Sequence< ::sal_Int8 > SAL_CALL convertWithCipherContext(const css::uno::Sequence< ::sal_Int8 >& aData)
throw (css::lang::IllegalArgumentException, css::lang::DisposedException, css::uno::RuntimeException, std::exception) override;
virtual css::uno::Sequence< ::sal_Int8 > SAL_CALL finalizeCipherContextAndDispose()
throw (css::lang::DisposedException, css::uno::RuntimeException, std::exception) override;
};
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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/.
*/
#include "DigestContext.hxx"
using namespace css;
using namespace css::uno;
using namespace css::lang;
void SAL_CALL DigestContext::updateDigest( const uno::Sequence< ::sal_Int8 >& /*aData*/ )
throw (DisposedException, RuntimeException, std::exception)
{
}
uno::Sequence< sal_Int8 > SAL_CALL DigestContext::finalizeDigestAndDispose()
throw (DisposedException, RuntimeException, std::exception)
{
Sequence<sal_Int8>* seq = new Sequence< sal_Int8 >(0);
return *seq;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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/.
*/
#ifndef INCLUDED_XMLSECURITY_SOURCE_GPG_DIGESTCONTEXT_HXX
#define INCLUDED_XMLSECURITY_SOURCE_GPG_DIGESTCONTEXT_HXX
#include <com/sun/star/xml/crypto/XDigestContext.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/uno/RuntimeException.hpp>
#include <cppuhelper/implbase.hxx>
class DigestContext : public cppu::WeakImplHelper< css::xml::crypto::XDigestContext >
{
public:
// XDigestContext
virtual void SAL_CALL updateDigest( const css::uno::Sequence< ::sal_Int8 >& aData )
throw (css::lang::DisposedException, css::uno::RuntimeException, std::exception) override;
virtual css::uno::Sequence< ::sal_Int8 > SAL_CALL finalizeDigestAndDispose()
throw (css::lang::DisposedException, css::uno::RuntimeException, std::exception) override;
};
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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/.
*/
#include "SecurityEnvironment.hxx"
#include "SEInitializer.hxx"
#include "XMLSignature.hxx"
#include "XMLEncryption.hxx"
#include "XMLSecurityContext.hxx"
#include <cppuhelper/factory.hxx>
using namespace cppu;
using namespace css::uno;
using namespace css::lang;
using namespace css::registry;
extern "C"
{
SAL_DLLPUBLIC_EXPORT void* SAL_CALL xsec_gpg_component_getFactory( const sal_Char* pImplName , void* pServiceManager , void* /*pRegistryKey*/ )
{
void* pRet = nullptr;
Reference< XSingleServiceFactory > xFactory ;
if( pImplName != nullptr && pServiceManager != nullptr )
{
#ifdef XMLSEC_CRYPTO_GPG
if( SEInitializer_getImplementationName().equalsAscii( pImplName ) )
{
xFactory.set( createSingleFactory(
static_cast< XMultiServiceFactory * >( pServiceManager ),
OUString::createFromAscii( pImplName ),
SEInitializer_createInstance, SEInitializer_getSupportedServiceNames() ) );
}
else if( XMLSignatureGpg::impl_getImplementationName().equalsAscii( pImplName ) )
{
xFactory = XMLSignatureGpg::impl_createFactory( static_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
}
else if( XMLSecurityContextGpg::impl_getImplementationName().equalsAscii( pImplName ) )
{
xFactory = XMLSecurityContextGpg::impl_createFactory( static_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
}
else if( SecurityEnvironmentGpg::impl_getImplementationName().equalsAscii( pImplName ) )
{
xFactory = SecurityEnvironmentGpg::impl_createFactory( static_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
}
else if( XMLEncryptionGpg::impl_getImplementationName().equalsAscii( pImplName ) )
{
xFactory = XMLEncryptionGpg::impl_createFactory( static_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
}
#endif
}
if( xFactory.is() ) {
xFactory->acquire() ;
pRet = xFactory.get() ;
}
return pRet ;
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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/.
*/
#include "SEInitializer.hxx"
#include "SecurityEnvironment.hxx"
#include <comphelper/processfactory.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <com/sun/star/xml/crypto/gpg/GpgSecurityEnvironment.hpp>
#include <com/sun/star/xml/crypto/gpg/GpgXMLSecurityContext.hpp>
using namespace css;
using namespace css::lang;
using namespace css::uno;
using namespace css::xml::crypto;
SEInitializerGpg::SEInitializerGpg( const css::uno::Reference< css::uno::XComponentContext > &rxContext )
{
m_xContext = rxContext;
}
SEInitializerGpg::~SEInitializerGpg()
{
}
/* XSEInitializer */
Reference< XXMLSecurityContext > SAL_CALL SEInitializerGpg::createSecurityContext( const OUString& )
throw (RuntimeException, std::exception)
{
try
{
/* Build XML Security Context */
Reference< XXMLSecurityContext > xSecCtx = xml::crypto::gpg::GpgXMLSecurityContext::create(m_xContext);
Reference< XSecurityEnvironment > xSecEnv = xml::crypto::gpg::GpgSecurityEnvironment::create(m_xContext);
Reference< XUnoTunnel > xSecEnvTunnel(xSecEnv, uno::UNO_QUERY_THROW);
sal_Int32 n = xSecCtx->addSecurityEnvironment(xSecEnv);
//originally the SecurityEnvironment with the internal slot was set as default
xSecCtx->setDefaultSecurityEnvironmentIndex( n );
return xSecCtx;
}
catch( const uno::Exception& )
{
return nullptr;
}
}
void SAL_CALL SEInitializerGpg::freeSecurityContext( const uno::Reference< XXMLSecurityContext >& )
throw (uno::RuntimeException, std::exception)
{
}
OUString SEInitializer_getImplementationName()
throw (uno::RuntimeException)
{
return OUString("com.sun.star.xml.security.SEInitializer_Gpg");
}
uno::Sequence< OUString > SAL_CALL SEInitializer_getSupportedServiceNames( )
throw (uno::RuntimeException)
{
return {"com.sun.star.xml.crypto.gpg.GpgSEInitializer"};
}
uno::Reference< uno::XInterface > SAL_CALL SEInitializer_createInstance( const uno::Reference< lang::XMultiServiceFactory > & rxMSF)
throw( uno::Exception )
{
return static_cast<cppu::OWeakObject*>(new SEInitializerGpg(comphelper::getComponentContext(rxMSF)));
}
/* XServiceInfo */
OUString SAL_CALL SEInitializerGpg::getImplementationName()
throw (uno::RuntimeException, std::exception)
{
return SEInitializer_getImplementationName();
}
sal_Bool SAL_CALL SEInitializerGpg::supportsService( const OUString& rServiceName )
throw (uno::RuntimeException, std::exception)
{
return cppu::supportsService(this, rServiceName);
}
uno::Sequence< OUString > SAL_CALL SEInitializerGpg::getSupportedServiceNames()
throw (uno::RuntimeException, std::exception)
{
return SEInitializer_getSupportedServiceNames();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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/.
*/
#ifndef INCLUDED_XMLSECURITY_SOURCE_GPG_SEINITIALIZER_HXX
#define INCLUDED_XMLSECURITY_SOURCE_GPG_SEINITIALIZER_HXX
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/xml/crypto/XXMLSecurityContext.hpp>
#include <com/sun/star/xml/crypto/XSEInitializer.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <cppuhelper/implbase.hxx>
class SEInitializerGpg : public cppu::WeakImplHelper< css::xml::crypto::XSEInitializer,
css::lang::XServiceInfo >
{
protected:
css::uno::Reference< css::uno::XComponentContext > m_xContext;
public:
explicit SEInitializerGpg(const css::uno::Reference<css::uno::XComponentContext > &rxContext);
virtual ~SEInitializerGpg() override;
/* XSEInitializer */
virtual css::uno::Reference< css::xml::crypto::XXMLSecurityContext >
SAL_CALL createSecurityContext( const OUString& )
throw (css::uno::RuntimeException, std::exception) override;
virtual void SAL_CALL freeSecurityContext( const css::uno::Reference<
css::xml::crypto::XXMLSecurityContext >& securityContext )
throw (css::uno::RuntimeException, std::exception) override;
/* XServiceInfo */
virtual OUString SAL_CALL getImplementationName( )
throw (css::uno::RuntimeException, std::exception) override;
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
throw (css::uno::RuntimeException, std::exception) override;
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( )
throw (css::uno::RuntimeException, std::exception) override;
};
/// @throws css::uno::RuntimeException
OUString SEInitializer_getImplementationName()
throw ( css::uno::RuntimeException );
/// @throws css::uno::RuntimeException
css::uno::Sequence< OUString > SAL_CALL SEInitializer_getSupportedServiceNames()
throw ( css::uno::RuntimeException );
/// @throws css::uno::Exception
css::uno::Reference< css::uno::XInterface > SAL_CALL SEInitializer_createInstance(
const css::uno::Reference< css::lang::XMultiServiceFactory > & rxMSF)
throw ( css::uno::Exception );
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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/.
*/
#include "SecurityEnvironment.hxx"
#include "CertificateImpl.hxx"
#include <cppuhelper/supportsservice.hxx>
#include <comphelper/servicehelper.hxx>
#include <list>
#include <gpgme.h>
#include <context.h>
#include <key.h>
#include <keylistresult.h>
using namespace css;
using namespace css::security;
using namespace css::uno;
using namespace css::lang;
SecurityEnvironmentGpg::SecurityEnvironmentGpg()
{
}
SecurityEnvironmentGpg::~SecurityEnvironmentGpg()
{
}
/* XServiceInfo */
OUString SAL_CALL SecurityEnvironmentGpg::getImplementationName()
throw( RuntimeException, std::exception )
{
return impl_getImplementationName();
}
/* XServiceInfo */
sal_Bool SAL_CALL SecurityEnvironmentGpg::supportsService( const OUString& serviceName)
throw( RuntimeException, std::exception )
{
return cppu::supportsService(this, serviceName);
}
/* XServiceInfo */
Sequence< OUString > SAL_CALL SecurityEnvironmentGpg::getSupportedServiceNames()
throw( RuntimeException, std::exception )
{
return impl_getSupportedServiceNames() ;
}
//Helper for XServiceInfo
Sequence< OUString > SecurityEnvironmentGpg::impl_getSupportedServiceNames()
{
return { "com.sun.star.xml.crypto.gpg.GpgSecurityEnvironment" } ;
}
OUString SecurityEnvironmentGpg::impl_getImplementationName()
throw( RuntimeException )
{
return OUString("com.sun.star.xml.security.SecurityEnvironment_Gpg");
}
//Helper for registry
Reference< XInterface > SAL_CALL SecurityEnvironmentGpg::impl_createInstance( const Reference< XMultiServiceFactory >& )
throw( RuntimeException )
{
return Reference< XInterface >( *new SecurityEnvironmentGpg ) ;
}
Reference< XSingleServiceFactory > SecurityEnvironmentGpg::impl_createFactory( const Reference< XMultiServiceFactory >& aServiceManager ) {
return ::cppu::createSingleFactory( aServiceManager , impl_getImplementationName() , impl_createInstance , impl_getSupportedServiceNames() ) ;
}
/* XUnoTunnel */
sal_Int64 SAL_CALL SecurityEnvironmentGpg::getSomething( const Sequence< sal_Int8 >& aIdentifier )
throw( RuntimeException, std::exception )
{
if( aIdentifier.getLength() == 16 && 0 == memcmp( getUnoTunnelId().getConstArray(), aIdentifier.getConstArray(), 16 ) ) {
return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this));
}
return 0 ;
}
/* XUnoTunnel extension */
namespace
{
class theSecurityEnvironmentUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSecurityEnvironmentUnoTunnelId > {};
}
const Sequence< sal_Int8>& SecurityEnvironmentGpg::getUnoTunnelId() {
return theSecurityEnvironmentUnoTunnelId::get().getSeq();
}
OUString SecurityEnvironmentGpg::getSecurityEnvironmentInformation()
throw( RuntimeException, std::exception )
{
return OUString("");
}
Sequence< Reference < XCertificate > > SecurityEnvironmentGpg::getPersonalCertificates()
throw( SecurityException , RuntimeException, std::exception )
{
GpgME::initializeLibrary();
GpgME::Error err = GpgME::checkEngine(GpgME::OpenPGP);
if (err)
throw RuntimeException("The GpgME library failed to initialize for the OpenPGP protocol.");
std::shared_ptr<GpgME::Context> ctx(GpgME::Context::createForProtocol(GpgME::OpenPGP));
if (ctx == nullptr)
throw RuntimeException("The GpgME library failed to initialize for the OpenPGP protocol.");
CertificateImpl* xCert;
std::list< CertificateImpl* > certsList;
ctx->setKeyListMode(GPGME_KEYLIST_MODE_LOCAL);
err = ctx->startKeyListing();
while (!err) {
GpgME::Key k = ctx->nextKey(err);
if (err)
break;
if (!k.isInvalid() && k.canEncrypt() && (k.ownerTrust() == GpgME::Key::Ultimate)) {
xCert = new CertificateImpl();
xCert->setCertificate(k);
certsList.push_back(xCert);
}
}
ctx->endKeyListing();
Sequence< Reference< XCertificate > > xCertificateSequence(certsList.size());
std::list< CertificateImpl* >::iterator xcertIt;
int i;
for (i = 0, xcertIt = certsList.begin(); xcertIt != certsList.end(); ++xcertIt, ++i)
xCertificateSequence[i] = *xcertIt ;
return xCertificateSequence;
}
Reference< XCertificate > SecurityEnvironmentGpg::getCertificate( const OUString& /*issuerName*/, const Sequence< sal_Int8 >& /*serialNumber*/ )
throw( SecurityException , RuntimeException, std::exception )
{
return nullptr;
}
Sequence< Reference < XCertificate > > SecurityEnvironmentGpg::buildCertificatePath( const Reference< XCertificate >& /*begin*/ )
throw( SecurityException , RuntimeException, std::exception )
{
return Sequence< Reference < XCertificate > >();
}
Reference< XCertificate > SecurityEnvironmentGpg::createCertificateFromRaw( const Sequence< sal_Int8 >& /*rawCertificate*/ )
throw( SecurityException , RuntimeException, std::exception )
{
return nullptr;
}
Reference< XCertificate > SecurityEnvironmentGpg::createCertificateFromAscii( const OUString& /*asciiCertificate*/ )
throw( SecurityException , RuntimeException, std::exception )
{
return nullptr;
}
sal_Int32 SecurityEnvironmentGpg::verifyCertificate( const Reference< XCertificate >& /*aCert*/,
const Sequence< Reference< XCertificate > >& /*intermediateCerts*/ )
throw( SecurityException, RuntimeException, std::exception )
{
return 0;
}
sal_Int32 SecurityEnvironmentGpg::getCertificateCharacters(
const Reference< XCertificate >& /*aCert*/)
throw( SecurityException, RuntimeException, std::exception )
{
// const CertificateImpl* xCert;
// const GpgME::Key* key;
//
// Reference< XUnoTunnel > xCertTunnel(aCert, UNO_QUERY_THROW) ;
// xCert = reinterpret_cast<CertificateImpl*>(sal::static_int_cast<sal_uIntPtr>(xCertTunnel->getSomething(CertificateImpl::getUnoTunnelId()))) ;
// if (xCert == nullptr)
// throw RuntimeException();
//
// key = xCert->getCertificate();
//
sal_Int32 characters = 0x0;
// TODO There is a bug in gpgme, hasSecret() always returns false. Need to find a workaround.
//if (key->hasSecret())
characters |= CertificateCharacters::HAS_PRIVATE_KEY;
return characters;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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/.
*/
#ifndef INCLUDED_XMLSECURITY_SOURCE_GPG_SECURITYENVIRONMENT_HXX
#define INCLUDED_XMLSECURITY_SOURCE_GPG_SECURITYENVIRONMENT_HXX
#include <sal/config.h>
#include <rtl/ustring.hxx>
#include <cppuhelper/factory.hxx>
#include <cppuhelper/implbase.hxx>
#include <com/sun/star/uno/Exception.hpp>
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/uno/SecurityException.hpp>
#include <com/sun/star/xml/crypto/XSecurityEnvironment.hpp>
#include <com/sun/star/security/XCertificate.hpp>
#include <com/sun/star/security/CertificateCharacters.hpp>
#include <com/sun/star/security/CertificateValidity.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
class SecurityEnvironmentGpg : public cppu::WeakImplHelper< css::xml::crypto::XSecurityEnvironment,
css::lang::XServiceInfo,
css::lang::XUnoTunnel >
{
private:
osl::Mutex m_mutex;
public:
SecurityEnvironmentGpg();
virtual ~SecurityEnvironmentGpg() override;
//Methods from XSecurityEnvironment
//Methods from XServiceInfo
virtual OUString SAL_CALL getImplementationName()
throw( css::uno::RuntimeException, std::exception ) override;
virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName)
throw( css::uno::RuntimeException, std::exception ) override;
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
throw( css::uno::RuntimeException, std::exception ) override;
//Helper for XServiceInfo
static css::uno::Sequence< OUString > impl_getSupportedServiceNames() ;
/// @throws css::uno::RuntimeException
static OUString impl_getImplementationName()
throw( css::uno::RuntimeException ) ;
//Helper for registry
/// @throws css::uno::RuntimeException
static css::uno::Reference< css::uno::XInterface > SAL_CALL impl_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& aServiceManager)
throw( css::uno::RuntimeException ) ;
static css::uno::Reference< css::lang::XSingleServiceFactory > impl_createFactory( const css::uno::Reference< css::lang::XMultiServiceFactory >& aServiceManager ) ;
virtual ::sal_Int32 SAL_CALL verifyCertificate(
const css::uno::Reference<
css::security::XCertificate >& xCert,
const css::uno::Sequence<
css::uno::Reference< css::security::XCertificate > > &
intermediateCerts)
throw (css::uno::SecurityException, css::uno::RuntimeException, std::exception) override;
virtual ::sal_Int32 SAL_CALL getCertificateCharacters( const css::uno::Reference< css::security::XCertificate >& xCert )
throw (css::uno::SecurityException, css::uno::RuntimeException, std::exception) override;
virtual OUString SAL_CALL getSecurityEnvironmentInformation()
throw (css::uno::RuntimeException, std::exception) override;
//Methods from XUnoTunnel
virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier )
throw (css::uno::RuntimeException, std::exception) override;
static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId() ;
virtual css::uno::Sequence< css::uno::Reference< css::security::XCertificate > > SAL_CALL getPersonalCertificates()
throw( css::uno::SecurityException , css::uno::RuntimeException, std::exception ) override;
virtual css::uno::Reference< css::security::XCertificate > SAL_CALL getCertificate( const OUString& issuerName, const css::uno::Sequence< sal_Int8 >& serialNumber )
throw( css::uno::SecurityException , css::uno::RuntimeException, std::exception ) override;
virtual css::uno::Sequence< css::uno::Reference< css::security::XCertificate > > SAL_CALL buildCertificatePath(
const css::uno::Reference< css::security::XCertificate >& beginCert )
throw( css::uno::SecurityException , css::uno::RuntimeException, std::exception ) override;
virtual css::uno::Reference< css::security::XCertificate > SAL_CALL createCertificateFromRaw(
const css::uno::Sequence< sal_Int8 >& rawCertificate )
throw( css::uno::SecurityException , css::uno::RuntimeException, std::exception ) override;
virtual css::uno::Reference< css::security::XCertificate > SAL_CALL createCertificateFromAscii(
const OUString& asciiCertificate )
throw( css::uno::SecurityException , css::uno::RuntimeException, std::exception ) override;
} ;
#endif // INCLUDED_XMLSECURITY_SOURCE_GPG_SECURITYENVIRONMENT_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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/.
*/
#include "XMLEncryption.hxx"
#include <cppuhelper/supportsservice.hxx>
using namespace css::uno;
using namespace css::lang;
using namespace css::xml::wrapper;
using namespace css::xml::crypto;
XMLEncryptionGpg::XMLEncryptionGpg() {
}
XMLEncryptionGpg::~XMLEncryptionGpg() {
}
/* XXMLEncryption */
Reference< XXMLEncryptionTemplate > SAL_CALL XMLEncryptionGpg::encrypt(const Reference< XXMLEncryptionTemplate >& /*aTemplate*/,
const Reference< XSecurityEnvironment >& /*aEnvironment*/)
throw (XMLEncryptionException, SecurityException, RuntimeException, std::exception)
{
return nullptr;
}
/* XXMLEncryption */
Reference< XXMLEncryptionTemplate > SAL_CALL XMLEncryptionGpg::decrypt(const Reference< XXMLEncryptionTemplate >& /*aTemplate*/,
const Reference< XXMLSecurityContext >& /*aSecurityCtx*/)
throw (XMLEncryptionException, SecurityException, RuntimeException, std::exception)
{
return nullptr;
}
/* XServiceInfo */
OUString SAL_CALL XMLEncryptionGpg::getImplementationName()
throw( RuntimeException, std::exception )
{
return impl_getImplementationName() ;
}
/* XServiceInfo */
sal_Bool SAL_CALL XMLEncryptionGpg::supportsService( const OUString& serviceName)
throw( RuntimeException, std::exception )
{
return cppu::supportsService(this, serviceName);
}
/* XServiceInfo */
Sequence< OUString > SAL_CALL XMLEncryptionGpg::getSupportedServiceNames()
throw( RuntimeException, std::exception )
{
return impl_getSupportedServiceNames() ;
}
//Helper for XServiceInfo
Sequence< OUString > XMLEncryptionGpg::impl_getSupportedServiceNames()
{
return {"com.sun.star.xml.crypto.gpg.GpgXMLEncryption"};
}
OUString XMLEncryptionGpg::impl_getImplementationName()
throw( RuntimeException )
{
return OUString("com.sun.star.xml.security.XMLEncryption_Gpg");
}
//Helper for registry
Reference< XInterface > SAL_CALL XMLEncryptionGpg::impl_createInstance( const Reference< XMultiServiceFactory >& )
throw( RuntimeException )
{
return Reference< XInterface >(*new XMLEncryptionGpg);
}
Reference< XSingleServiceFactory > XMLEncryptionGpg::impl_createFactory( const Reference< XMultiServiceFactory >& aServiceManager )
{
return ::cppu::createSingleFactory(aServiceManager, impl_getImplementationName(), impl_createInstance, impl_getSupportedServiceNames());
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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/.
*/
#ifndef INCLUDED_XMLSECURITY_SOURCE_GPG_XMLENCRYPTION_HXX
#define INCLUDED_XMLSECURITY_SOURCE_GPG_XMLENCRYPTION_HXX
#include <sal/config.h>
#include <rtl/ustring.hxx>
#include <cppuhelper/factory.hxx>
#include <cppuhelper/implbase.hxx>
#include <com/sun/star/uno/Exception.hpp>
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/xml/crypto/XXMLEncryption.hpp>
#include <com/sun/star/xml/crypto/XXMLEncryptionTemplate.hpp>
#include <com/sun/star/xml/crypto/XXMLSecurityContext.hpp>
#include <com/sun/star/xml/crypto/XMLEncryptionException.hpp>
class XMLEncryptionGpg : public cppu::WeakImplHelper< css::xml::crypto::XXMLEncryption,
css::lang::XServiceInfo >
{
public:
explicit XMLEncryptionGpg();
virtual ~XMLEncryptionGpg() override;
// XXMLEncryption
virtual css::uno::Reference< css::xml::crypto::XXMLEncryptionTemplate > SAL_CALL encrypt(
const css::uno::Reference< css::xml::crypto::XXMLEncryptionTemplate >& aTemplate ,
const css::uno::Reference< css::xml::crypto::XSecurityEnvironment >& aEnvironment)
// ) throw( css::uno::Exception , css::uno::RuntimeException ) ;
throw (css::xml::crypto::XMLEncryptionException ,
css::uno::SecurityException,
css::uno::RuntimeException, std::exception) override;
virtual css::uno::Reference< css::xml::crypto::XXMLEncryptionTemplate > SAL_CALL decrypt(
const css::uno::Reference< css::xml::crypto::XXMLEncryptionTemplate >& aTemplate ,
const css::uno::Reference< css::xml::crypto::XXMLSecurityContext >& aContext
) throw (css::xml::crypto::XMLEncryptionException ,
css::uno::SecurityException,
css::uno::RuntimeException, std::exception) override;
// XServiceInfo
virtual OUString SAL_CALL getImplementationName() throw( css::uno::RuntimeException, std::exception ) override;
virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName)
throw( css::uno::RuntimeException, std::exception ) override;
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
throw( css::uno::RuntimeException, std::exception ) override;
// Helper for XServiceInfo
static css::uno::Sequence< OUString > impl_getSupportedServiceNames() ;
/// @throws css::uno::RuntimeException
static OUString impl_getImplementationName() throw( css::uno::RuntimeException ) ;
// Helper for registry
/// @throws css::uno::RuntimeException
static css::uno::Reference< css::uno::XInterface > SAL_CALL impl_createInstance(
const css::uno::Reference< css::lang::XMultiServiceFactory >& aServiceManager )
throw( css::uno::RuntimeException ) ;
static css::uno::Reference< css::lang::XSingleServiceFactory > impl_createFactory(
const css::uno::Reference< css::lang::XMultiServiceFactory >& aServiceManager ) ;
} ;
#endif // INCLUDED_XMLSECURITY_SOURCE_GPG_XMLENCRYPTION_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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/.
*/
#include "XMLSecurityContext.hxx"
#include "SecurityEnvironment.hxx"
#include <cppuhelper/supportsservice.hxx>
using namespace css::uno;
using namespace css::lang;
using namespace css::xml::crypto;
XMLSecurityContextGpg::XMLSecurityContextGpg()
: m_nDefaultEnvIndex(-1)
{
}
XMLSecurityContextGpg::~XMLSecurityContextGpg()
{
}
sal_Int32 SAL_CALL XMLSecurityContextGpg::addSecurityEnvironment(
const Reference< XSecurityEnvironment >& aSecurityEnvironment)
throw (css::security::SecurityInfrastructureException, RuntimeException, std::exception)
{
if(!aSecurityEnvironment.is())
throw RuntimeException("Invalid SecurityEnvironment given!");
m_vSecurityEnvironments.push_back(aSecurityEnvironment);
return m_vSecurityEnvironments.size() - 1 ;
}
sal_Int32 SAL_CALL XMLSecurityContextGpg::getSecurityEnvironmentNumber()
throw (RuntimeException, std::exception)
{
return m_vSecurityEnvironments.size();
}
Reference< XSecurityEnvironment > SAL_CALL XMLSecurityContextGpg::getSecurityEnvironmentByIndex(sal_Int32 index)
throw (RuntimeException, std::exception)
{
if (index < 0 || index >= ( sal_Int32 )m_vSecurityEnvironments.size())
throw RuntimeException("Invalid index");
return m_vSecurityEnvironments[index];
}
Reference< XSecurityEnvironment > SAL_CALL XMLSecurityContextGpg::getSecurityEnvironment()
throw (RuntimeException, std::exception)
{
if (m_nDefaultEnvIndex < 0 || m_nDefaultEnvIndex >= (sal_Int32) m_vSecurityEnvironments.size())
throw RuntimeException("Invalid index");
return getSecurityEnvironmentByIndex(m_nDefaultEnvIndex);
}
sal_Int32 SAL_CALL XMLSecurityContextGpg::getDefaultSecurityEnvironmentIndex()
throw (RuntimeException, std::exception)
{
return m_nDefaultEnvIndex ;
}
void SAL_CALL XMLSecurityContextGpg::setDefaultSecurityEnvironmentIndex(sal_Int32 nDefaultEnvIndex)
throw (RuntimeException, std::exception)
{
m_nDefaultEnvIndex = nDefaultEnvIndex;
}
/* XServiceInfo */
OUString SAL_CALL XMLSecurityContextGpg::getImplementationName()
throw( RuntimeException, std::exception )
{
return impl_getImplementationName() ;
}
/* XServiceInfo */
sal_Bool SAL_CALL XMLSecurityContextGpg::supportsService( const OUString& serviceName)
throw( RuntimeException, std::exception )
{
return cppu::supportsService(this, serviceName);
}
/* XServiceInfo */
Sequence< OUString > SAL_CALL XMLSecurityContextGpg::getSupportedServiceNames()
throw( RuntimeException, std::exception )
{
return impl_getSupportedServiceNames() ;
}
//Helper for XServiceInfo
Sequence< OUString > XMLSecurityContextGpg::impl_getSupportedServiceNames()
{
return {"com.sun.star.xml.crypto.gpg.GpgXMLSecurityContext"};
}
OUString XMLSecurityContextGpg::impl_getImplementationName()
throw( RuntimeException )
{
return OUString("com.sun.star.xml.security.XMLSecurityContext_Gpg");
}
//Helper for registry
Reference< XInterface > SAL_CALL XMLSecurityContextGpg::impl_createInstance( const Reference< XMultiServiceFactory >& )
throw( RuntimeException )
{
return Reference< XInterface >( *new XMLSecurityContextGpg ) ;
}
Reference< XSingleServiceFactory > XMLSecurityContextGpg::impl_createFactory( const Reference< XMultiServiceFactory >& aServiceManager )
{
return ::cppu::createSingleFactory( aServiceManager , impl_getImplementationName() , impl_createInstance , impl_getSupportedServiceNames() ) ;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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/.
*/
#ifndef INCLUDED_XMLSECURITY_SOURCE_GPG_XMLSECURITYCONTEXT_HXX
#define INCLUDED_XMLSECURITY_SOURCE_GPG_XMLSECURITYCONTEXT_HXX
#include <sal/config.h>
#include <rtl/ustring.hxx>
#include <cppuhelper/factory.hxx>
#include <cppuhelper/implbase.hxx>
#include <com/sun/star/uno/Exception.hpp>
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <com/sun/star/xml/crypto/XSecurityEnvironment.hpp>
#include <com/sun/star/security/SecurityInfrastructureException.hpp>
#include <com/sun/star/xml/crypto/XXMLSecurityContext.hpp>
#include <vector>
class XMLSecurityContextGpg : public cppu::WeakImplHelper< css::xml::crypto::XXMLSecurityContext,
css::lang::XServiceInfo >
{
private:
std::vector< css::uno::Reference< css::xml::crypto::XSecurityEnvironment > > m_vSecurityEnvironments;
sal_Int32 m_nDefaultEnvIndex;
public:
XMLSecurityContextGpg() ;
virtual ~XMLSecurityContextGpg() override;
// XXMLSecurityContext
virtual sal_Int32 SAL_CALL addSecurityEnvironment(
const css::uno::Reference< css::xml::crypto::XSecurityEnvironment >& aSecurityEnvironment
) throw (css::security::SecurityInfrastructureException, css::uno::RuntimeException, std::exception) override;
virtual ::sal_Int32 SAL_CALL getSecurityEnvironmentNumber( )
throw (css::uno::RuntimeException, std::exception) override;
virtual css::uno::Reference<css::xml::crypto::XSecurityEnvironment > SAL_CALL getSecurityEnvironmentByIndex(sal_Int32 index)
throw (css::uno::RuntimeException, std::exception) override;
virtual css::uno::Reference<css::xml::crypto::XSecurityEnvironment > SAL_CALL getSecurityEnvironment()
throw (css::uno::RuntimeException, std::exception) override;
virtual sal_Int32 SAL_CALL getDefaultSecurityEnvironmentIndex( )
throw (css::uno::RuntimeException, std::exception) override;
virtual void SAL_CALL setDefaultSecurityEnvironmentIndex( sal_Int32 nDefaultEnvIndex )
throw (css::uno::RuntimeException, std::exception) override;
// XServiceInfo
virtual OUString SAL_CALL getImplementationName() throw( css::uno::RuntimeException, std::exception ) override;
virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName)
throw( css::uno::RuntimeException, std::exception ) override;
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
throw( css::uno::RuntimeException, std::exception ) override;
// XServiceInfo
static css::uno::Sequence< OUString > impl_getSupportedServiceNames() ;
/// @throws css::uno::RuntimeException
static OUString impl_getImplementationName() throw( css::uno::RuntimeException ) ;
//Helper for registry
/// @throws css::uno::RuntimeException
static css::uno::Reference< css::uno::XInterface > SAL_CALL impl_createInstance(
const css::uno::Reference< css::lang::XMultiServiceFactory >& aServiceManager )
throw( css::uno::RuntimeException ) ;
static css::uno::Reference< css::lang::XSingleServiceFactory > impl_createFactory(
const css::uno::Reference< css::lang::XMultiServiceFactory >& aServiceManager ) ;
} ;
#endif // INCLUDED_XMLSECURITY_SOURCE_GPG_XMLSECURITYCONTEXT_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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/.
*/
#include "XMLSignature.hxx"
#include "SecurityEnvironment.hxx"
#include "XMLSecurityContext.hxx"
#include <cppuhelper/supportsservice.hxx>
using namespace css::uno;
using namespace css::lang;
using namespace css::xml::wrapper;
using namespace css::xml::crypto;
XMLSignatureGpg::XMLSignatureGpg()
{
}
XMLSignatureGpg::~XMLSignatureGpg()
{
}
/* XXMLSignature */
Reference< XXMLSignatureTemplate > SAL_CALL XMLSignatureGpg::generate(const Reference< XXMLSignatureTemplate >& /*aTemplate*/,
const Reference< XSecurityEnvironment >& /*aEnvironment*/)
throw( css::xml::crypto::XMLSignatureException, css::uno::SecurityException, css::uno::RuntimeException, std::exception )
{
return nullptr;
}
/* XXMLSignature */
Reference< XXMLSignatureTemplate > SAL_CALL XMLSignatureGpg::validate(const Reference< XXMLSignatureTemplate >& /*aTemplate*/,
const Reference< XXMLSecurityContext >& /*aSecurityCtx*/)
throw(css::uno::RuntimeException, css::uno::SecurityException, css::xml::crypto::XMLSignatureException, std::exception)
{
return nullptr;
}
/* XServiceInfo */
OUString SAL_CALL XMLSignatureGpg::getImplementationName()
throw( RuntimeException, std::exception )
{
return impl_getImplementationName() ;
}
/* XServiceInfo */
sal_Bool SAL_CALL XMLSignatureGpg::supportsService( const OUString& serviceName)
throw( RuntimeException, std::exception )
{
return cppu::supportsService(this, serviceName);
}
/* XServiceInfo */
Sequence< OUString > SAL_CALL XMLSignatureGpg::getSupportedServiceNames() throw( RuntimeException, std::exception )
{
return impl_getSupportedServiceNames() ;
}
//Helper for XServiceInfo
Sequence< OUString > XMLSignatureGpg::impl_getSupportedServiceNames()
{
return {"com.sun.star.xml.crypto.gpg.GpgXMLSignature"};
}
OUString XMLSignatureGpg::impl_getImplementationName()
throw( RuntimeException )
{
return OUString("com.sun.star.xml.security.XMLSignature_Gpg");
}
//Helper for registry
Reference< XInterface > SAL_CALL XMLSignatureGpg::impl_createInstance( const Reference< XMultiServiceFactory >& )
throw( RuntimeException )
{
return Reference< XInterface >( *new XMLSignatureGpg ) ;
}
Reference< XSingleServiceFactory > XMLSignatureGpg::impl_createFactory( const Reference< XMultiServiceFactory >& aServiceManager )
{
return cppu::createSingleFactory( aServiceManager , impl_getImplementationName() , impl_createInstance , impl_getSupportedServiceNames() ) ;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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/.
*/
#ifndef INCLUDED_XMLSECURITY_SOURCE_XMLSEC_GPG_XMLSIGNATURE_HXX
#define INCLUDED_XMLSECURITY_SOURCE_XMLSEC_GPG_XMLSIGNATURE_HXX
#include <sal/config.h>
#include <rtl/ustring.hxx>
#include <cppuhelper/factory.hxx>
#include <cppuhelper/implbase.hxx>
#include <com/sun/star/uno/Exception.hpp>
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/xml/crypto/XXMLSignature.hpp>
#include <com/sun/star/xml/crypto/XXMLSignatureTemplate.hpp>
#include <com/sun/star/xml/crypto/XXMLSecurityContext.hpp>
#include <com/sun/star/xml/crypto/XMLSignatureException.hpp>
class XMLSignatureGpg : public cppu::WeakImplHelper< css::xml::crypto::XXMLSignature,
css::lang::XServiceInfo >
{
public:
explicit XMLSignatureGpg();
virtual ~XMLSignatureGpg() override;
// XXMLSignature
virtual css::uno::Reference< css::xml::crypto::XXMLSignatureTemplate > SAL_CALL generate(
const css::uno::Reference< css::xml::crypto::XXMLSignatureTemplate >& aTemplate ,
const css::uno::Reference< css::xml::crypto::XSecurityEnvironment >& aEnvironment
) throw (css::xml::crypto::XMLSignatureException,
css::uno::SecurityException,
css::uno::RuntimeException, std::exception) override;
virtual css::uno::Reference< css::xml::crypto::XXMLSignatureTemplate > SAL_CALL validate(
const css::uno::Reference< css::xml::crypto::XXMLSignatureTemplate >& aTemplate ,
const css::uno::Reference< css::xml::crypto::XXMLSecurityContext >& aContext
) throw(css::uno::RuntimeException,
css::uno::SecurityException,
css::xml::crypto::XMLSignatureException, std::exception) override;
// XServiceInfo
virtual OUString SAL_CALL getImplementationName()
throw( css::uno::RuntimeException, std::exception ) override;
virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName)
throw( css::uno::RuntimeException, std::exception ) override;
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
throw( css::uno::RuntimeException, std::exception ) override;
// Helper for XServiceInfo
static css::uno::Sequence< OUString > impl_getSupportedServiceNames() ;
/// @throws css::uno::RuntimeException
static OUString impl_getImplementationName() throw( css::uno::RuntimeException ) ;
//Helper for registry
/// @throws css::uno::RuntimeException
static css::uno::Reference< css::uno::XInterface > SAL_CALL impl_createInstance(
const css::uno::Reference< css::lang::XMultiServiceFactory >& aServiceManager )
throw( css::uno::RuntimeException ) ;
static css::uno::Reference< css::lang::XSingleServiceFactory > impl_createFactory(
const css::uno::Reference< css::lang::XMultiServiceFactory >& aServiceManager ) ;
} ;
#endif // INCLUDED_XMLSECURITY_SOURCE_XMLSEC_GPG_XMLSIGNATURE_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <com/sun/star/io/XTruncate.hpp> #include <com/sun/star/io/XTruncate.hpp>
#include <com/sun/star/embed/XTransactedObject.hpp> #include <com/sun/star/embed/XTransactedObject.hpp>
#include <com/sun/star/xml/crypto/SEInitializer.hpp> #include <com/sun/star/xml/crypto/SEInitializer.hpp>
#include <com/sun/star/xml/crypto/gpg/GpgSEInitializer.hpp>
#include <comphelper/storagehelper.hxx> #include <comphelper/storagehelper.hxx>
#include <rtl/ustrbuf.hxx> #include <rtl/ustrbuf.hxx>
...@@ -36,7 +37,7 @@ ...@@ -36,7 +37,7 @@
#include <certificate.hxx> #include <certificate.hxx>
#include <biginteger.hxx> #include <biginteger.hxx>
using namespace com::sun::star; using namespace css;
DocumentSignatureManager::DocumentSignatureManager(const uno::Reference<uno::XComponentContext>& xContext, DocumentSignatureMode eMode) DocumentSignatureManager::DocumentSignatureManager(const uno::Reference<uno::XComponentContext>& xContext, DocumentSignatureMode eMode)
: mxContext(xContext), : mxContext(xContext),
...@@ -51,13 +52,24 @@ bool DocumentSignatureManager::init() ...@@ -51,13 +52,24 @@ bool DocumentSignatureManager::init()
{ {
SAL_WARN_IF(mxSEInitializer.is(), "xmlsecurity.helper", "DocumentSignatureManager::Init - mxSEInitializer already set!"); SAL_WARN_IF(mxSEInitializer.is(), "xmlsecurity.helper", "DocumentSignatureManager::Init - mxSEInitializer already set!");
SAL_WARN_IF(mxSecurityContext.is(), "xmlsecurity.helper", "DocumentSignatureManager::Init - mxSecurityContext already set!"); SAL_WARN_IF(mxSecurityContext.is(), "xmlsecurity.helper", "DocumentSignatureManager::Init - mxSecurityContext already set!");
SAL_WARN_IF(mxGpgSEInitializer.is(), "xmlsecurity.helper", "DocumentSignatureManager::Init - mxGpgSEInitializer already set!");
mxSEInitializer = css::xml::crypto::SEInitializer::create(mxContext); mxSEInitializer = xml::crypto::SEInitializer::create(mxContext);
#if !defined(MACOSX) && !defined(WNT)
mxGpgSEInitializer = xml::crypto::gpg::GpgSEInitializer::create(mxContext);
#endif
if (mxSEInitializer.is()) if (mxSEInitializer.is())
mxSecurityContext = mxSEInitializer->createSecurityContext(OUString()); mxSecurityContext = mxSEInitializer->createSecurityContext(OUString());
#if !defined(MACOSX) && !defined(WNT)
if (mxGpgSEInitializer.is())
mxGpgSecurityContext = mxGpgSEInitializer->createSecurityContext(OUString());
return mxSecurityContext.is() && mxGpgSecurityContext.is();
#else
return mxSecurityContext.is(); return mxSecurityContext.is();
#endif
} }
PDFSignatureHelper& DocumentSignatureManager::getPDFSignatureHelper() PDFSignatureHelper& DocumentSignatureManager::getPDFSignatureHelper()
...@@ -504,4 +516,9 @@ uno::Reference<xml::crypto::XSecurityEnvironment> DocumentSignatureManager::getS ...@@ -504,4 +516,9 @@ uno::Reference<xml::crypto::XSecurityEnvironment> DocumentSignatureManager::getS
return mxSecurityContext.is() ? mxSecurityContext->getSecurityEnvironment() : uno::Reference<xml::crypto::XSecurityEnvironment>(); return mxSecurityContext.is() ? mxSecurityContext->getSecurityEnvironment() : uno::Reference<xml::crypto::XSecurityEnvironment>();
} }
uno::Reference<xml::crypto::XSecurityEnvironment> DocumentSignatureManager::getGpgSecurityEnvironment()
{
return mxGpgSecurityContext.is() ? mxGpgSecurityContext->getSecurityEnvironment() : uno::Reference<xml::crypto::XSecurityEnvironment>();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
<?xml version="1.0" encoding="UTF-8"?>
<!--
* 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/.
*
-->
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
prefix="xsec_gpg" xmlns="http://openoffice.org/2010/uno-components">
<implementation name="com.sun.star.xml.security.SEInitializer_Gpg">
<service name="com.sun.star.xml.crypto.gpg.GpgSEInitializer"/>
</implementation>
<implementation name="com.sun.star.xml.security.SecurityEnvironment_Gpg">
<service name="com.sun.star.xml.crypto.gpg.GpgSecurityEnvironment"/>
</implementation>
<!-- TODO Not implemented yet
<implementation name="com.sun.star.xml.security.XMLDocumentWrapper_Gpg">
<service name="com.sun.star.xml.wrapper.XMLDocumentWrapper"/>
</implementation>
<implementation name="com.sun.star.xml.security.XMLElementWrapper_Gpg">
<service name="com.sun.star.xml.wrapper.XMLElementWrapper"/>
</implementation>-->
<implementation name="com.sun.star.xml.security.XMLEncryption_Gpg">
<service name="com.sun.star.xml.crypto.gpg.GpgXMLEncryption"/>
</implementation>
<implementation name="com.sun.star.xml.security.XMLSecurityContext_Gpg">
<service name="com.sun.star.xml.crypto.gpg.GpgXMLSecurityContext"/>
</implementation>
<implementation name="com.sun.star.xml.security.XMLSignature_Gpg">
<service name="com.sun.star.xml.crypto.gpg.GpgXMLSignature"/>
</implementation>-->
</component>
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