[Libreoffice-commits] core.git: Branch 'feature/cib_contract3756' - 1775 commits - accessibility/inc accessibility/Library_acc.mk accessibility/source android/README android/source animations/source avmedia/source basctl/inc basctl/Library_basctl.mk basctl/source basctl/uiconfig basegfx/Library_basegfx.mk basegfx/source basic/inc basic/Library_sb.mk basic/qa basic/source bean/com bin/check-elf-dynamic-objects bin/distro-install-file-lists bin/find-most-common-warn-messages.py bin/find-unneeded-includes bin/gbuild-to-ide bin/lo-all-static-libs bin/moveglobalheaders.sh bin/update_pch bin/update_pch.sh bridges/inc bridges/Library_cpp_uno.mk bridges/source canvas/source canvas/workben chart2/inc chart2/Library_chartcontroller.mk chart2/Library_chartcore.mk chart2/qa chart2/source chart2/uiconfig chart2/UIConfig_chart2.mk cli_ure/readme.txt codemaker/source comphelper/CppunitTest_comphelper_parallelsort_test.mk comphelper/Library_comphelper.mk comphelper/Module_comphelper.mk comphelper/qa comphelper/s ource compilerplugins/clang compilerplugins/.gitignore compilerplugins/Makefile-clang.mk config.guess config_host/config_feature_desktop.h.in config_host/config_feature_opencl.h.in config_host/config_features.h.in config_host/config_global.h.in config_host/config_vclplug.h.in config_host.mk.in configmgr/Library_configmgr.mk configmgr/source configure.ac connectivity/Library_ado.mk connectivity/Library_calc.mk connectivity/Library_dbase.mk connectivity/Library_dbpool2.mk connectivity/Library_dbtools.mk connectivity/Library_file.mk connectivity/Library_firebird_sdbc.mk connectivity/Library_flat.mk connectivity/Library_jdbc.mk connectivity/Library_mysql_jdbc.mk connectivity/Library_odbc.mk connectivity/Library_postgresql-sdbc-impl.mk connectivity/README connectivity/source cppcanvas/Library_cppcanvas.mk cppuhelper/Library_cppuhelper.mk cppuhelper/source cppu/source cpputools/Executable_uno.mk cui/CppunitTest_cui_dialogs_test.mk cui/inc cui/Library_cui.mk cui/qa cui/source cui/uiconfig cui/UIConfig_cui.mk dbaccess/Executable_odbcconfig.mk dbaccess/inc dbaccess/Library_dbahsql.mk dbaccess/Library_dba.mk dbaccess/Library_dbaxml.mk dbaccess/Library_dbmm.mk dbaccess/Library_dbu.mk dbaccess/Library_sdbt.mk dbaccess/Module_dbaccess.mk dbaccess/qa dbaccess/README dbaccess/source dbaccess/uiconfig dbaccess/UIConfig_dbaccess.mk desktop/Executable_minidump_upload.mk desktop/Executable_quickstart.mk desktop/Executable_sbase.mk desktop/Executable_scalc.mk desktop/Executable_sdraw.mk desktop/Executable_simpress.mk desktop/Executable_smath.mk desktop/Executable_soffice_bin.mk desktop/Executable_soffice_com.mk desktop/Executable_soffice_exe.mk desktop/Executable_sweb.mk desktop/Executable_swriter.mk desktop/Executable_unoinfo.mk desktop/Executable_unopkg_bin.mk desktop/Executable_unopkg_com.mk desktop/Executable_unopkg.mk desktop/Library_deploymentgui.mk desktop/Library_deploymentmisc.mk desktop/Library_deployment.mk desktop/Library_sofficeapp.mk desktop/Pagein_common.mk desktop /qa desktop/source desktop/StaticLibrary_winloader.mk desktop/test desktop/unx desktop/util desktop/win32 desktop/WinResTarget_sbase.mk desktop/WinResTarget_scalc.mk desktop/WinResTarget_sdraw.mk desktop/WinResTarget_simpress.mk desktop/WinResTarget_smath.mk desktop/WinResTarget_sofficebin.mk desktop/WinResTarget_soffice.mk desktop/WinResTarget_sweb.mk desktop/WinResTarget_swriter.mk dictionaries distro-configs/Jenkins distro-configs/LibreOfficeAndroidX86_64.conf distro-configs/LibreOfficeFlatpak.conf distro-configs/LibreOfficeMacOSX.conf distro-configs/LibreOfficeOnline.conf distro-configs/LibreOfficeOssFuzz.conf download.lst drawinglayer/Library_drawinglayer.mk drawinglayer/source dtrans/source editeng/inc editeng/Library_editeng.mk editeng/source embeddedobj/IwyuFilter_embeddedobj.yaml embeddedobj/source embedserv/source emfio/inc emfio/Library_emfio.mk emfio/source extensions/Executable_twain32shim.mk extensions/inc extensions/Library_pcr.mk extensions/Library_WinUserInfoBe.mk e xtensions/source extensions/uiconfig external/boost external/breakpad external/cairo external/clucene external/expat external/firebird external/gpgmepp external/harfbuzz external/icu external/libabw external/libcdr external/libcmis external/libebook external/libepubgen external/libetonyek external/libfreehand external/libmspub external/libmwaw external/libodfgen external/liborcus external/libpagemaker external/libqxp external/librevenge external/libstaroffice external/libvisio external/libwpd external/libwps external/libzmf external/nss external/pdfium external/postgresql extras/AllLangPackage_autotextshare.mk extras/CustomTarget_autotextshare.mk extras/README extras/source filter/Library_gie.mk filter/qa filter/source filter/uiconfig forms/Library_frm.mk forms/source formula/inc formula/source formula/uiconfig fpicker/inc fpicker/Library_fps_office.mk fpicker/source fpicker/uiconfig framework/inc framework/Library_fwe.mk framework/Library_fwi.mk framework/Library_fwk.mk framework/L ibrary_fwl.mk framework/qa framework/source framework/uiconfig .git-blame-ignore-revs .gitreview helpcompiler/inc helpcompiler/source helpcontent2 hwpfilter/Library_hwp.mk hwpfilter/source i18nlangtag/source i18npool/Library_localedata_en.mk i18npool/Library_localedata_euro.mk i18npool/Library_localedata_others.mk i18npool/source i18nutil/source icon-themes/breeze icon-themes/breeze_dark icon-themes/breeze_svg icon-themes/colibre icon-themes/colibre_svg icon-themes/elementary icon-themes/elementary_svg icon-themes/karasa_jaga icon-themes/karasa_jaga_svg icon-themes/sifr icon-themes/tango idlc/Executable_idlc.mk idlc/inc idlc/source idl/inc idl/source include/basegfx include/basic include/canvas include/com include/comphelper include/connectivity include/cppuhelper include/dbaccess include/desktop include/drawinglayer include/editeng include/filter include/formula include/framework include/i18nlangtag include/IwyuFilter_include.yaml include/jvmfwk include/LibreOfficeKit include/o3tl include/oox include/opencl include/osl include/package include/registry include/rtl include/sal include/sax include/sfx2 include/store include/svl include/svtools include/svx include/test include/toolkit include/tools include/typelib include/ucbhelper include/uno include/unotest include/unotools include/vbahelper include/vcl include/xmloff include/xmlreader instsetoo_native/CustomTarget_install.mk instsetoo_native/CustomTarget_setup.mk instsetoo_native/inc_ooohelppack instsetoo_native/inc_openoffice ios/CustomTarget_iOS_setup.mk io/source jvmfwk/source l10ntools/inc l10ntools/source libreofficekit/qa libreofficekit/source lingucomponent/source linguistic/Library_lng.mk linguistic/source logerrit lotuswordpro/inc lotuswordpro/Library_lwpft.mk lotuswordpro/source m4/l_atomic.m4 Makefile.in nlpsolver/src o3tl/CompilerTest_o3tl_unsafe_downcast.mk o3tl/Module_o3tl.mk o3tl/qa odk/build-examples_common.mk odk/examples odk/Package_odk_headers.mk odk/settings offapi/com offapi/type_reference offapi/UnoApi_offapi.mk officecfg/registry onlineupdate/Executable_test_updater_dialog.mk onlineupdate/Executable_updater.mk onlineupdate/source oox/inc oox/Library_oox.mk oox/source oox/util opencl/Executable_opencltest.mk opencl/source osx/soffice.xcodeproj package/inc package/Library_package2.mk package/Library_xstor.mk package/qa package/source pch/inc pch/Makefile pch/Module_pch.mk pch/README pch/StaticLibrary_precompiled_system.mk pch/system_empty.cxx postprocess/CustomTarget_signing.mk postprocess/Rdb_services.mk postprocess/signing pyuno/Executable_python.mk pyuno/inc pyuno/source qadevOOo/objdsc qadevOOo/tests readlicense_oo/license README.md registry/Executable_regmerge.mk registry/Executable_regview.mk registry/source reportbuilder/java reportdesign/inc reportdesign/Library_rpt.mk reportdesign/Library_rptui.mk reportdesign/Library_rptxml.mk reportdesign/source reportdesign/uiconfig RepositoryExternal.mk Repository.mk RepositoryModule_host.mk sal/inc sal/Library_sal.mk sa l/osl sal/qa sal/rtl sal/test sal/textenc sax/CppunitTest_sax_attributes.mk sax/CppunitTest_sax.mk sax/CppunitTest_sax_parser.mk sax/CppunitTest_sax_xmlimport.mk sax/inc sax/IwyuFilter_sax.yaml sax/Library_expwrap.mk sax/Library_sax.mk sax/qa sax/source scaddins/Library_analysis.mk scaddins/Library_date.mk scaddins/Library_pricing.mk scaddins/source sccomp/source sc/CppunitTest_sc_addin_functions_test.mk sc/CppunitTest_sc_anchor_test.mk sc/CppunitTest_sc_annotationobj.mk sc/CppunitTest_sc_annotationshapeobj.mk sc/CppunitTest_sc_annotationsobj.mk sc/CppunitTest_sc_arealinkobj.mk sc/CppunitTest_sc_arealinksobj.mk sc/CppunitTest_sc_array_functions_test.mk sc/CppunitTest_sc_autoformatobj.mk sc/CppunitTest_sc_autoformatsobj.mk sc/CppunitTest_sc_bugfix_test.mk sc/CppunitTest_sc_cache_test.mk sc/CppunitTest_sc_cellcursorobj.mk sc/CppunitTest_sc_cellfieldsobj.mk sc/CppunitTest_sc_cellformatsenumeration.mk sc/CppunitTest_sc_cellformatsobj.mk sc/CppunitTest_sc_cellobj.mk sc/CppunitTest_sc_cel lrangeobj.mk sc/CppunitTest_sc_cellrangesobj.mk sc/CppunitTest_sc_cellsearchobj.mk sc/CppunitTest_sc_cellsenumeration.mk sc/CppunitTest_sc_cellsobj.mk sc/CppunitTest_sc_chart2dataprovider.mk sc/CppunitTest_sc_chartobj.mk sc/CppunitTest_sc_chart_regression_test.mk sc/CppunitTest_sc_chartsobj.mk sc/CppunitTest_sc_check_data_pilot_field.mk sc/CppunitTest_sc_check_data_pilot_table.mk sc/CppunitTest_sc_check_xcell_ranges_query.mk sc/CppunitTest_sc_cond_format_merge.mk sc/CppunitTest_sc_consolidationdescriptorobj.mk sc/CppunitTest_sc_copypaste.mk sc/CppunitTest_sc_core.mk sc/CppunitTest_sc_database_functions_test.mk sc/CppunitTest_sc_databaserangeobj.mk sc/CppunitTest_sc_databaserangesobj.mk sc/CppunitTest_sc_datapilotfieldgroupitemobj.mk sc/CppunitTest_sc_datapilotfieldgroupobj.mk sc/CppunitTest_sc_datapilotfieldgroupsobj.mk sc/CppunitTest_sc_datapilotfieldobj.mk sc/CppunitTest_sc_datapilotfieldsobj.mk sc/CppunitTest_sc_datapilotitemobj.mk sc/CppunitTest_sc_datapilotitemsobj.mk sc/Cppuni tTest_sc_datapilottableobj.mk sc/CppunitTest_sc_datapilottablesobj.mk sc/CppunitTest_sc_dataprovider.mk sc/CppunitTest_sc_datatransformation.mk sc/CppunitTest_sc_datetime_functions_test.mk sc/CppunitTest_sc_ddelinkobj.mk sc/CppunitTest_sc_ddelinksobj.mk sc/CppunitTest_sc_documentconfigurationobj.mk sc/CppunitTest_sc_drawpageobj.mk sc/CppunitTest_sc_drawpagesobj.mk sc/CppunitTest_sc_editfieldobj_cell.mk sc/CppunitTest_sc_editfieldobj_header.mk sc/CppunitTest_sc_filterdescriptorbase.mk sc/CppunitTest_sc_filters_test.mk sc/CppunitTest_sc_financial_functions_test.mk sc/CppunitTest_sc_functiondescriptionobj.mk sc/CppunitTest_sc_functionlistobj.mk sc/CppunitTest_sc_functions_test_old.mk sc/CppunitTest_sc_headerfieldsobj.mk sc/CppunitTest_sc_headerfootercontentobj.mk sc/CppunitTest_sc_html_export_test.mk sc/CppunitTest_sc_importdescriptorbaseobj.mk sc/CppunitTest_sc_indexenumeration_cellannotationsenumeration.mk sc/CppunitTest_sc_indexenumeration_cellarealinksenumeration.mk sc/CppunitTest_ sc_indexenumeration_databaserangesenumeration.mk sc/CppunitTest_sc_indexenumeration_datapilotfieldsenumeration.mk sc/CppunitTest_sc_indexenumeration_datapilotitemsenumeration.mk sc/CppunitTest_sc_indexenumeration_datapilottablesenumeration.mk sc/CppunitTest_sc_indexenumeration_ddelinksenumeration.mk sc/CppunitTest_sc_indexenumeration_functiondescriptionenumeration.mk sc/CppunitTest_sc_indexenumeration_labelrangesenumeration.mk sc/CppunitTest_sc_indexenumeration_namedrangesenumeration.mk sc/CppunitTest_sc_indexenumeration_scenariosenumeration.mk sc/CppunitTest_sc_indexenumeration_sheetcellrangesenumeration.mk sc/CppunitTest_sc_indexenumeration_sheetlinksenumeration.mk sc/CppunitTest_sc_indexenumeration_spreadsheetsenumeration.mk sc/CppunitTest_sc_indexenumeration_spreadsheetviewpanesenumeration.mk sc/CppunitTest_sc_indexenumeration_subtotalfieldsenumeration.mk sc/CppunitTest_sc_indexenumeration_tableautoformatenumeration.mk sc/CppunitTest_sc_indexenumeration_tablechartsenumeration.mk sc/CppunitTest_sc_indexenumeration_tablecolumnsenumeration.mk sc/CppunitTest_sc_indexenumeration_tableconditionalentryenumeration.mk sc/CppunitTest_sc_indexenumeration_tablerowsenumeration.mk sc/CppunitTest_sc_indexenumeration_textfieldenumeration.mk sc/CppunitTest_sc_information_functions_test.mk sc/CppunitTest_sc_labelrangeobj.mk sc/CppunitTest_sc_labelrangesobj.mk sc/CppunitTest_sc_logical_functions_test.mk sc/CppunitTest_sc_macros_test.mk sc/CppunitTest_sc_mark_test.mk sc/CppunitTest_sc_mathematical_functions_test.mk sc/CppunitTest_sc_modelobj.mk sc/CppunitTest_sc_namedrangeobj.mk sc/CppunitTest_sc_namedrangesobj.mk sc/CppunitTest_sc_new_cond_format_api.mk sc/CppunitTest_sc_opencl_test.mk sc/CppunitTest_sc_outlineobj.mk sc/CppunitTest_sc_parallelism.mk sc/CppunitTest_sc_pdf_export.mk sc/CppunitTest_sc_perfobj.mk sc/CppunitTest_sc_pivottable_filters_test.mk sc/CppunitTest_sc_rangelst_test.mk sc/CppunitTest_sc_range_test.mk sc/CppunitTest_sc_recentfunctionsobj.mk sc/CppunitTest_s c_recordchanges.mk sc/CppunitTest_sc_scenariosobj.mk sc/CppunitTest_sc_screenshots.mk sc/CppunitTest_sc_shapeobj.mk sc/CppunitTest_sc_sheetlinkobj.mk sc/CppunitTest_sc_sheetlinksobj.mk sc/CppunitTest_sc_sortdescriptorbaseobj.mk sc/CppunitTest_sc_spreadsheet_functions_test.mk sc/CppunitTest_sc_spreadsheetsettings.mk sc/CppunitTest_sc_spreadsheetsettingsobj.mk sc/CppunitTest_sc_statistical_functions_test.mk sc/CppunitTest_sc_stylefamiliesobj.mk sc/CppunitTest_sc_stylefamilyobj.mk sc/CppunitTest_sc_subsequent_export_test.mk sc/CppunitTest_sc_subsequent_filters_test.mk sc/CppunitTest_sc_subtotaldescriptorbase.mk sc/CppunitTest_sc_subtotalfieldobj.mk sc/CppunitTest_sc_tablecolumnobj.mk sc/CppunitTest_sc_tablecolumnsobj.mk sc/CppunitTest_sc_tableconditionalentryobj.mk sc/CppunitTest_sc_tableconditionalformat.mk sc/CppunitTest_sc_tablerowobj.mk sc/CppunitTest_sc_tablerowsobj.mk sc/CppunitTest_sc_tablesheetobj.mk sc/CppunitTest_sc_tablesheetsobj.mk sc/CppunitTest_sc_tablevalidationobj.mk sc /CppunitTest_sc_tabviewobj.mk sc/CppunitTest_sc_text_functions_test.mk sc/CppunitTest_sc_tiledrendering.mk sc/CppunitTest_sc_ucalc.mk sc/CppunitTest_sc_uniquecellformatsenumeration.mk sc/CppunitTest_sc_uniquecellformatsobj.mk sc/CppunitTest_sc_viewpaneobj.mk schema/libreoffice sc/inc sc/IwyuFilter_sc.yaml sc/Library_scd.mk sc/Library_scfilt.mk sc/Library_sc.mk sc/Library_scqahelper.mk sc/Library_scui.mk sc/Library_vbaobj.mk scp2/AutoInstall.mk scp2/InstallModule_spsupp.mk scp2/InstallScript_setup_osl.mk scp2/Module_scp2.mk scp2/source sc/qa scripting/java scripting/source sc/source sc/uiconfig sc/UIConfig_scalc.mk sd/CppunitTest_sd_activex_controls_tests.mk sd/CppunitTest_sd_dialogs_test.mk sd/CppunitTest_sd_export_ooxml1.mk sd/CppunitTest_sd_export_ooxml2.mk sd/CppunitTest_sd_export_tests.mk sd/CppunitTest_sd_filters_test.mk sd/CppunitTest_sd_html_export_tests.mk sd/CppunitTest_sd_import_tests.mk sd/CppunitTest_sd_import_tests_smartart.mk sd/CppunitTest_sd_misc_tests.mk sd/CppunitT est_sd_svg_export_tests.mk sd/CppunitTest_sd_tiledrendering.mk sd/CppunitTest_sd_uiimpress.mk sd/CppunitTest_sd_uimpress.mk sdext/Executable_xpdfimport.mk sdext/Library_PresentationMinimizer.mk sdext/Library_PresenterScreen.mk sdext/source sd/inc sd/IwyuFilter_sd.yaml sd/Library_sdd.mk sd/Library_sdfilt.mk sd/Library_sd.mk sd/Library_sdui.mk sd/qa sd/sdi sd/source sd/uiconfig sd/workben setup_native/scripts setup_native/source sfx2/classification sfx2/inc sfx2/Library_sfx.mk sfx2/qa sfx2/sdi sfx2/source sfx2/uiconfig shell/Executable_senddoc.mk shell/Executable_spsupp_helper.mk shell/inc shell/source slideshow/CppunitTest_slideshow.mk slideshow/Library_slideshow.mk slideshow/source solenv/bin solenv/clang-format solenv/CompilerTest_compilerplugins_clang.mk solenv/flatpak-manifest.in solenv/gbuild solenv/gbuildtojson solenv/inc solenv/sanitizers soltools/cpp soltools/mkdepend sot/Library_sot.mk sot/source starmath/CppunitTest_starmath_qa_cppunit.mk starmath/inc starmath/Library_sm.mk starmath/qa starmath/source starmath/uiconfig stoc/source stoc/test svgio/inc svgio/Library_svgio.mk svgio/qa svgio/source svl/IwyuFilter_svl.yaml svl/Library_svl.mk svl/qa svl/source svl/unx svtools/inc svtools/IwyuFilter_svtools.yaml svtools/Library_svt.mk svtools/qa svtools/source svtools/uiconfig svtools/UIConfig_svt.mk svx/Executable_gengal.mk svx/inc svx/Library_svxcore.mk svx/Library_svx.mk svx/qa svx/sdi svx/source svx/uiconfig sw/CppunitTest_sw_accessible_relation_set.mk sw/CppunitTest_sw_apitests.mk sw/CppunitTest_sw_dialogs_test_2.mk sw/CppunitTest_sw_dialogs_test.mk sw/CppunitTest_sw_docbookexport.mk sw/CppunitTest_sw_filters_test2.mk sw/CppunitTest_sw_filters_test.mk sw/CppunitTest_sw_fodfexport.mk sw/CppunitTest_sw_globalfilter.mk sw/CppunitTest_sw_htmlexport.mk sw/CppunitTest_sw_htmlimport.mk sw/CppunitTest_sw_layoutwriter.mk sw/CppunitTest_sw_macros_test.mk sw/CppunitTest_sw_mailmerge.mk sw/CppunitTest_sw_odfexport.mk sw/CppunitTest_sw_odfimport.mk sw/CppunitTest_sw _ooxmlencryption.mk sw/CppunitTest_sw_ooxmlexport8.mk sw/CppunitTest_sw_ooxmlfieldexport.mk sw/CppunitTest_sw_ooxmlimport2.mk sw/CppunitTest_sw_ooxmlimport.mk sw/CppunitTest_sw_ooxmllinks.mk sw/CppunitTest_sw_ooxmlw14export.mk sw/CppunitTest_sw_rtfexport2.mk sw/CppunitTest_sw_rtfexport3.mk sw/CppunitTest_sw_rtfexport4.mk sw/CppunitTest_sw_rtfexport5.mk sw/CppunitTest_sw_rtfexport.mk sw/CppunitTest_sw_rtfimport.mk sw/CppunitTest_sw_tiledrendering.mk sw/CppunitTest_sw_txtexport.mk sw/CppunitTest_sw_uibase_unit.mk sw/CppunitTest_sw_uiwriter.mk sw/CppunitTest_sw_unowriter.mk sw/CppunitTest_sw_uwriter.mk sw/CppunitTest_sw_ww8export2.mk sw/CppunitTest_sw_ww8export3.mk sw/CppunitTest_sw_ww8export.mk sw/CppunitTest_sw_ww8import.mk sw/CppunitTest_sw_xhtmlexport.mk sw/inc sw/IwyuFilter_sw.yaml sw/Library_msword.mk sw/Library_swd.mk sw/Library_sw.mk sw/Library_swui.mk sw/Library_vbaswobj.mk sw/ooxmlexport_setup.mk sw/PythonTest_sw_python.mk sw/qa sw/sdi sw/source sw/uiconfig sysui/desktop test /Library_subsequenttest.mk test/source toolkit/inc toolkit/IwyuFilter_toolkit.yaml toolkit/qa toolkit/source tools/CppunitTest_tools_test.mk tools/Library_tl.mk tools/qa tools/source translations ucbhelper/source ucb/IwyuFilter_ucb.yaml ucb/source udkapi/com udkapi/type_reference uitest/calc_tests uitest/demo_ui uitest/libreoffice uitest/ui_logger_dsl UnoControls/source unodevtools/source unoidl/source unotest/source unotools/Library_utl.mk unotools/source unoxml/Library_unoxml.mk unoxml/source uui/inc uui/Library_uui.mk uui/source vbahelper/Library_msforms.mk vbahelper/Library_vbahelper.mk vbahelper/source vcl/commonfuzzer.mk vcl/CppunitTest_vcl_bitmap_test.mk vcl/CppunitTest_vcl_graphic_test.mk vcl/Executable_ui-previewer.mk vcl/Executable_xid_fullscreen_on_all_monitors.mk vcl/headless vcl/inc vcl/ios vcl/IwyuFilter_vcl.yaml vcl/Library_vcl.mk vcl/Library_vclplug_gen.mk vcl/Library_vclplug_gtk3_kde5.mk vcl/Library_vclplug_gtk3.mk vcl/Library_vclplug_gtk.mk vcl/Library_vclplug_win. mk vcl/Module_vcl.mk vcl/opengl vcl/osx vcl/Package_osxres.mk vcl/qa vcl/qt5 vcl/quartz vcl/README vcl/README.vars vcl/source vcl/StaticLibrary_fuzzerstubs.mk vcl/uiconfig vcl/UIConfig_vcl.mk vcl/unx vcl/win vcl/workben winaccessibility/Library_winaccessibility.mk winaccessibility/source wizards/com wizards/source writerfilter/Library_writerfilter.mk writerfilter/source writerperfect/inc writerperfect/Library_wpftdraw.mk writerperfect/Library_wpftwriter.mk writerperfect/qa writerperfect/source xmlhelp/IwyuFilter_xmlhelp.yaml xmlhelp/source xmloff/inc xmloff/IwyuFilter_xmloff.yaml xmloff/Library_xof.mk xmloff/Library_xo.mk xmloff/qa xmloff/source xmloff/util xmlreader/source xmlscript/Library_xmlscript.mk xmlscript/source xmlsecurity/inc xmlsecurity/Library_xmlsecurity.mk xmlsecurity/Library_xsec_xmlsec.mk xmlsecurity/qa xmlsecurity/source xmlsecurity/uiconfig
Serge Krot (via logerrit)
logerrit at kemper.freedesktop.org
Wed Oct 16 00:25:57 UTC 2019
Rebased ref, commits from common ancestor:
commit 461af74fdb609562295eb0c08cc96e55c15bf7db
Author: Serge Krot <Serge.Krot at cib.de>
AuthorDate: Tue Oct 15 13:04:49 2019 +0200
Commit: Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Wed Oct 16 02:21:59 2019 +0200
Tooltips: Use HELPWINSTYLE_BALLOON when tooltip contains \n
Change-Id: I33ef48b5a90338471d85a613ede73eada323381c
Reviewed-on: https://gerrit.libreoffice.org/80825
Reviewed-by: Serge Krot (CIB) <Serge.Krot at cib.de>
Tested-by: Serge Krot (CIB) <Serge.Krot at cib.de>
diff --git a/vcl/source/app/help.cxx b/vcl/source/app/help.cxx
old mode 100644
new mode 100755
index 035230c69235..ec0e1d0579fc
--- a/vcl/source/app/help.cxx
+++ b/vcl/source/app/help.cxx
@@ -326,7 +326,7 @@ void HelpTextWindow::SetHelpText( const OUString& rHelpText )
{
maHelpText = rHelpText;
ApplySettings(*this);
- if ( mnHelpWinStyle == HELPWINSTYLE_QUICK && maHelpText.getLength() < HELPTEXTMAXLEN)
+ if ( mnHelpWinStyle == HELPWINSTYLE_QUICK && maHelpText.getLength() < HELPTEXTMAXLEN && maHelpText.indexOf('\n') < 0)
{
Size aSize;
aSize.setHeight( GetTextHeight() );
@@ -384,7 +384,7 @@ void HelpTextWindow::Paint( vcl::RenderContext& rRenderContext, const tools::Rec
}
// paint text
- if (mnHelpWinStyle == HELPWINSTYLE_QUICK && maHelpText.getLength() < HELPTEXTMAXLEN)
+ if (mnHelpWinStyle == HELPWINSTYLE_QUICK && maHelpText.getLength() < HELPTEXTMAXLEN && maHelpText.indexOf('\n') < 0)
{
if ( mnStyle & QuickHelpFlags::CtrlText )
rRenderContext.DrawCtrlText(maTextRect.TopLeft(), maHelpText);
commit af28d1df5ff3863a362d7afffd4fb322cad07971
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Mon Oct 14 10:37:45 2019 +0200
Commit: Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Wed Oct 16 02:21:59 2019 +0200
.gitreview: Update default branch
Change-Id: Ie7acdd15ee51f4d1e8d7a5b13ca107d64a360b61
Reviewed-on: https://gerrit.libreoffice.org/80758
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
diff --git a/.gitreview b/.gitreview
index 199752b8b09e..0193cec971ff 100644
--- a/.gitreview
+++ b/.gitreview
@@ -3,5 +3,4 @@ host=gerrit.libreoffice.org
port=29418
project=core
defaultremote=logerrit
-defaultbranch=master
-
+defaultbranch=feature/cib_contract3756
commit 4ca2c13bc2e51ffa35f53972e7a22771efcedbd3
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Thu Oct 10 08:13:51 2019 +0200
Commit: Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Wed Oct 16 02:21:58 2019 +0200
Add document-level option to lock down content extraction
Setting this option will prevent copying/dragging any content from LO
to another program or even another LO window.
Change-Id: Ifbc032a4fa69ac1a17d4b500f5a30f5399d84ed7
Reviewed-on: https://gerrit.libreoffice.org/80586
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
(cherry picked from commit 075f20a4b696f9e85d11dc977806e41a49e6de61)
Reviewed-on: https://gerrit.libreoffice.org/80757
Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
diff --git a/offapi/com/sun/star/frame/XModel2.idl b/offapi/com/sun/star/frame/XModel2.idl
index b3ae90358854..0a5944e0e6f0 100644
--- a/offapi/com/sun/star/frame/XModel2.idl
+++ b/offapi/com/sun/star/frame/XModel2.idl
@@ -144,6 +144,7 @@ interface XModel2 : com::sun::star::frame::XModel
<li>com::sun::star::document::MediaDescriptor::SuggestedSaveAsName</li>
<li>com::sun::star::document::MediaDescriptor::LockContentExtraction</li>
<li>com::sun::star::document::MediaDescriptor::EncryptionData</li>
+ <li>com::sun::star::document::MediaDescriptor::LockContentExtraction</li>
</ul>
@throws com::sun::star::lang::IllegalArgumentException When trying to set an unsupported property
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index 039f21e0a233..736cc87ebf75 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -1082,6 +1082,11 @@ void SAL_CALL SfxBaseModel::setArgs(const Sequence<beans::PropertyValue>& aArgs)
{
pMedium->GetItemSet()->Put(SfxUnoAnyItem(SID_ENCRYPTIONDATA, rArg.Value));
}
+ else if (rArg.Name == "LockContentExtraction")
+ {
+ rArg.Value >>= bValue;
+ pMedium->GetItemSet()->Put(SfxBoolItem(SID_LOCK_CONTENT_EXTRACTION, bValue));
+ }
else
{
throw lang::IllegalArgumentException("Setting property not supported: " + rArg.Name,
commit 904763514465daab724c2815a74af8de95085416
Author: Vasily Melenchuk <vasily.melenchuk at cib.de>
AuthorDate: Mon Oct 14 00:01:52 2019 +0300
Commit: Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Wed Oct 16 02:21:05 2019 +0200
temporary: do not clean up EncryptionData during SaveAs
This clean up can ruin sensetive encryption details saving document
in plain mode which is not expected.
Relaization is not final and requires more atention.
Change-Id: I46b757af81e68ad4781e83b1a0e0b6da3a5e13e1
diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx
index 7b2e705e45e5..cf8df0b417cc 100644
--- a/package/source/zippackage/ZipPackage.cxx
+++ b/package/source/zippackage/ZipPackage.cxx
@@ -1752,7 +1752,7 @@ void SAL_CALL ZipPackage::setPropertyValue( const OUString& aPropertyName, const
if ( !( aValue >>= aKeys ) )
throw IllegalArgumentException(THROW_WHERE, uno::Reference< uno::XInterface >(), 2 );
- if ( aKeys.hasElements() )
+/* if ( aKeys.hasElements() )
{
bool bHasSHA256 = false;
bool bHasSHA1 = false;
@@ -1766,7 +1766,7 @@ void SAL_CALL ZipPackage::setPropertyValue( const OUString& aPropertyName, const
if ( !bHasSHA256 && !bHasSHA1 )
throw IllegalArgumentException(THROW_WHERE "Expected keys are not provided!", uno::Reference< uno::XInterface >(), 2 );
- }
+ }*/
m_aStorageEncryptionKeys = aKeys;
m_aEncryptionKey.realloc( 0 );
diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx
index 8dc5b8eecbd7..482fad092d09 100644
--- a/sfx2/source/dialog/filedlghelper.cxx
+++ b/sfx2/source/dialog/filedlghelper.cxx
@@ -1415,7 +1415,7 @@ ErrCode FileDialogHelper_Impl::execute( std::vector<OUString>& rpURLList,
// the password will be set in case user decide so
rpSet->ClearItem( SID_PASSWORDINTERACTION );
rpSet->ClearItem( SID_PASSWORD );
- rpSet->ClearItem( SID_ENCRYPTIONDATA );
+ //rpSet->ClearItem( SID_ENCRYPTIONDATA );
rpSet->ClearItem( SID_RECOMMENDREADONLY );
rpSet->ClearItem( SID_MODIFYPASSWORDINFO );
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index 5e04a0c09c34..813a1e251674 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -810,10 +810,21 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
bool bPreselectPassword = false;
- const SfxUnoAnyItem* pOldEncryptionDataItem = SfxItemSet::GetItem<SfxUnoAnyItem>(GetMedium()->GetItemSet(), SID_ENCRYPTIONDATA, false);
const SfxStringItem* pOldPasswordItem = SfxItemSet::GetItem<SfxStringItem>(GetMedium()->GetItemSet(), SID_PASSWORD, false);
- if ( pOldEncryptionDataItem || pOldPasswordItem )
+ if (pOldPasswordItem)
+ {
bPreselectPassword = true;
+ }
+ else
+ {
+ const SfxUnoAnyItem* pOldEncryptionDataItem = SfxItemSet::GetItem<SfxUnoAnyItem>(GetMedium()->GetItemSet(), SID_ENCRYPTIONDATA, false);
+ if (pOldEncryptionDataItem)
+ {
+ uno::Sequence< beans::NamedValue > aEncryptionData;
+ pOldEncryptionDataItem->GetValue() >>= aEncryptionData;
+
+ }
+ }
uno::Sequence< beans::PropertyValue > aDispatchArgs;
if ( rReq.GetArgs() )
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index 5dfcd6829df5..8975c32fe051 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -2757,11 +2757,11 @@ bool SfxObjectShell::PreDoSaveAs_Impl(const OUString& rFileName, const OUString&
std::unique_ptr<SfxAllItemSet> pMergedParams(new SfxAllItemSet( *pMedium->GetItemSet() ));
// in "SaveAs" title and password will be cleared ( maybe the new itemset contains new values, otherwise they will be empty )
- pMergedParams->ClearItem( SID_ENCRYPTIONDATA );
+ //pMergedParams->ClearItem( SID_ENCRYPTIONDATA );
pMergedParams->ClearItem( SID_PASSWORD );
// #i119366# - As the SID_ENCRYPTIONDATA and SID_PASSWORD are using for setting password together, we need to clear them both.
// Also, ( maybe the new itemset contains new values, otherwise they will be empty )
- pMergedParams->ClearItem( SID_ENCRYPTIONDATA );
+// pMergedParams->ClearItem( SID_ENCRYPTIONDATA );
pMergedParams->ClearItem( SID_DOCINFO_TITLE );
pMergedParams->ClearItem( SID_INPUTSTREAM );
commit 72df9496f875fd39664a671b9a0e994b1871e8ed
Author: Vasily Melenchuk <vasily.melenchuk at cib.de>
AuthorDate: Sun Oct 13 23:56:39 2019 +0300
Commit: Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Wed Oct 16 02:21:04 2019 +0200
oox: init OLE container if any encryption data is present
Some encryption methods could use other than "OOXPassword"
values. So we could rely just on "EncryptionData" exists and
it is not empty
Change-Id: Iece53601282a1bd30b592c998c77185c9dcbbe7c
diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx
index b6e44b56b416..b52e6a0d9a28 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -882,13 +882,7 @@ Reference<XStream> XmlFilterBase::implGetOutputStream( MediaDescriptor& rMediaDe
MediaDescriptor::PROP_ENCRYPTIONDATA(),
Sequence< NamedValue >() );
- OUString aPassword;
- auto pProp = std::find_if(aMediaEncData.begin(), aMediaEncData.end(),
- [](const NamedValue& rProp) { return rProp.Name == "OOXPassword"; });
- if (pProp != aMediaEncData.end())
- pProp->Value >>= aPassword;
-
- if (aPassword.isEmpty())
+ if (aMediaEncData.getLength() == 0)
{
return FilterBase::implGetOutputStream( rMediaDescriptor );
}
commit 840e2896b464cea8ecfa0f0f4dfc7d5d6cb830e5
Author: Vasily Melenchuk <vasily.melenchuk at cib.de>
AuthorDate: Sun Oct 13 23:53:22 2019 +0300
Commit: Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Wed Oct 16 02:17:59 2019 +0200
oox: XPackageEncryption interface simplification
instead of two methods to write ecrypted data and encryption info
just one is used.
Change-Id: Ie31f363a0b76cfe5b67b15c1b98b0e556578b5c8
diff --git a/include/oox/crypto/AgileEngine.hxx b/include/oox/crypto/AgileEngine.hxx
index afef194e53e9..de3836ffdb19 100644
--- a/include/oox/crypto/AgileEngine.hxx
+++ b/include/oox/crypto/AgileEngine.hxx
@@ -128,6 +128,9 @@ private:
void setupEncryptionParameters(AgileEncryptionParameters const & rAgileEncryptionParameters);
bool setupEncryptionKey(OUString const & rPassword);
+ css::uno::Sequence<sal_Int8> writeEncryptionInfo();
+ css::uno::Sequence<sal_Int8> writeEncryptedDocument(const css::uno::Reference<css::io::XInputStream>& rxInputStream);
+
public:
AgileEngine(const css::uno::Reference< css::uno::XComponentContext >& rxContext);
@@ -143,10 +146,7 @@ public:
// Encryption
- virtual css::uno::Sequence<css::beans::NamedValue> SAL_CALL writeEncryptionInfo() override;
-
- virtual void SAL_CALL encrypt(const css::uno::Reference<css::io::XInputStream>& rxInputStream,
- css::uno::Reference<css::io::XOutputStream>& rxOutputStream) override;
+ virtual css::uno::Sequence<css::beans::NamedValue> SAL_CALL encrypt(const css::uno::Reference<css::io::XInputStream>& rxInputStream) override;
virtual sal_Bool SAL_CALL setupEncryption(const css::uno::Sequence<css::beans::NamedValue>& rMediaEncData) override;
diff --git a/include/oox/crypto/Standard2007Engine.hxx b/include/oox/crypto/Standard2007Engine.hxx
index feaf6a3ada6f..50be627a86e7 100644
--- a/include/oox/crypto/Standard2007Engine.hxx
+++ b/include/oox/crypto/Standard2007Engine.hxx
@@ -37,6 +37,8 @@ class OOX_DLLPUBLIC Standard2007Engine : public cppu::WeakImplHelper<css::packag
bool calculateEncryptionKey(const OUString& rPassword);
css::uno::Reference<css::io::XInputStream> getStream(const css::uno::Sequence<css::beans::NamedValue> & rStreams, const OUString sStreamName);
+ css::uno::Sequence<sal_Int8> writeEncryptionInfo();
+ css::uno::Sequence<sal_Int8> writeEncryptedDocument(const css::uno::Reference<css::io::XInputStream>& rxInputStream);
public:
Standard2007Engine(const css::uno::Reference<css::uno::XComponentContext>& rxContext);
@@ -53,10 +55,7 @@ public:
// Encryption
- virtual css::uno::Sequence<css::beans::NamedValue> SAL_CALL writeEncryptionInfo() override;
-
- virtual void SAL_CALL encrypt(const css::uno::Reference<css::io::XInputStream>& rxInputStream,
- css::uno::Reference<css::io::XOutputStream>& rxOutputStream) override;
+ virtual css::uno::Sequence<css::beans::NamedValue> SAL_CALL encrypt(const css::uno::Reference<css::io::XInputStream>& rxInputStream) override;
virtual sal_Bool SAL_CALL setupEncryption(const css::uno::Sequence<css::beans::NamedValue>& rMediaEncData) override;
diff --git a/offapi/com/sun/star/packages/XPackageEncryption.idl b/offapi/com/sun/star/packages/XPackageEncryption.idl
index 298a089af6c7..0fba1d9c3ba7 100644
--- a/offapi/com/sun/star/packages/XPackageEncryption.idl
+++ b/offapi/com/sun/star/packages/XPackageEncryption.idl
@@ -52,11 +52,6 @@ interface XPackageEncryption: com::sun::star::uno::XInterface
/**
TODO
*/
- sequence<com::sun::star::beans::NamedValue> writeEncryptionInfo();
-
- /**
- TODO
- */
sequence<com::sun::star::beans::NamedValue> createEncryptionData([in] string rPassword);
/**
@@ -67,8 +62,7 @@ interface XPackageEncryption: com::sun::star::uno::XInterface
/**
TODO
*/
- void encrypt([in] com::sun::star::io::XInputStream rxInputStream,
- [out] com::sun::star::io::XOutputStream rxOutputStream);
+ sequence<com::sun::star::beans::NamedValue> encrypt([in] com::sun::star::io::XInputStream rxInputStream);
/**
TODO
diff --git a/oox/source/crypto/AgileEngine.cxx b/oox/source/crypto/AgileEngine.cxx
index 35104903d918..54dd841ef2bf 100644
--- a/oox/source/crypto/AgileEngine.cxx
+++ b/oox/source/crypto/AgileEngine.cxx
@@ -756,7 +756,7 @@ bool AgileEngine::setupEncryptionKey(OUString const & rPassword)
return true;
}
-css::uno::Sequence<css::beans::NamedValue> AgileEngine::writeEncryptionInfo()
+css::uno::Sequence<sal_Int8> AgileEngine::writeEncryptionInfo()
{
Reference<XOutputStream> aEncryptionInfoStream(
mxContext->getServiceManager()->createInstanceWithContext("com.sun.star.io.SequenceOutputStream", mxContext),
@@ -820,20 +820,19 @@ css::uno::Sequence<css::beans::NamedValue> AgileEngine::writeEncryptionInfo()
rStream.close();
aEncryptionInfoStream->flush();
- // Store all streams into sequence and return back
- comphelper::SequenceAsHashMap aStreams;
-
Reference<XSequenceOutputStream> aEncryptionInfoSequenceStream(aEncryptionInfoStream, UNO_QUERY);
- aStreams["EncryptionInfo"] <<= aEncryptionInfoSequenceStream->getWrittenBytes();
- return aStreams.getAsConstNamedValueList();
+ return aEncryptionInfoSequenceStream->getWrittenBytes();
}
-void AgileEngine::encrypt(const css::uno::Reference<css::io::XInputStream> & rxInputStream,
- css::uno::Reference<css::io::XOutputStream> & rxOutputStream)
+css::uno::Sequence<sal_Int8> AgileEngine::writeEncryptedDocument(const css::uno::Reference<css::io::XInputStream>& rxInputStream)
{
CryptoHash aCryptoHash(mInfo.hmacKey, cryptoHashTypeFromString(mInfo.hashAlgorithm));
- BinaryXOutputStream aBinaryOutputStream(rxOutputStream, false);
+ Reference<XOutputStream> aOutputStream(
+ mxContext->getServiceManager()->createInstanceWithContext("com.sun.star.io.SequenceOutputStream", mxContext),
+ UNO_QUERY);
+ BinaryXOutputStream aBinaryOutputStream(aOutputStream, false);
+
BinaryXInputStream aBinaryInputStream(rxInputStream, false);
Reference<XSeekable> xSeekable(rxInputStream, UNO_QUERY);
sal_uInt32 nLength = xSeekable->getLength();
@@ -890,6 +889,18 @@ void AgileEngine::encrypt(const css::uno::Reference<css::io::XInputStream> & rx
}
mInfo.hmacHash = aCryptoHash.finalize();
encryptHmacValue();
+
+ Reference<XSequenceOutputStream> aSequenceStream(aOutputStream, UNO_QUERY);
+ return aSequenceStream->getWrittenBytes();
+}
+
+
+css::uno::Sequence<css::beans::NamedValue> AgileEngine::encrypt(const css::uno::Reference<css::io::XInputStream> & rxInputStream)
+{
+ comphelper::SequenceAsHashMap aStreams;
+ aStreams["EncryptedPackage"] <<= writeEncryptedDocument(rxInputStream);
+ aStreams["EncryptionInfo"] <<= writeEncryptionInfo();
+ return aStreams.getAsConstNamedValueList();
}
} // namespace core
diff --git a/oox/source/crypto/DocumentEncryption.cxx b/oox/source/crypto/DocumentEncryption.cxx
index 2dba0f035df5..2f0457911aed 100644
--- a/oox/source/crypto/DocumentEncryption.cxx
+++ b/oox/source/crypto/DocumentEncryption.cxx
@@ -78,12 +78,7 @@ bool DocumentEncryption::encrypt()
mxPackageEncryption->setupEncryption(mMediaEncData);
- Reference<XOutputStream> xOutputStream(mrOleStorage.openOutputStream("EncryptedPackage"), UNO_SET_THROW);
- mxPackageEncryption->encrypt(xInputStream, xOutputStream);
- xOutputStream->flush();
- xOutputStream->closeOutput();
-
- Sequence<NamedValue> aStreams = mxPackageEncryption->writeEncryptionInfo();
+ Sequence<NamedValue> aStreams = mxPackageEncryption->encrypt(xInputStream);
for (const NamedValue & aStream : aStreams)
{
diff --git a/oox/source/crypto/Standard2007Engine.cxx b/oox/source/crypto/Standard2007Engine.cxx
index 50f23e2cf491..9ddde339b1d5 100644
--- a/oox/source/crypto/Standard2007Engine.cxx
+++ b/oox/source/crypto/Standard2007Engine.cxx
@@ -257,7 +257,7 @@ sal_Bool Standard2007Engine::setupEncryption(const css::uno::Sequence<css::beans
return true;
}
-css::uno::Sequence<css::beans::NamedValue> Standard2007Engine::writeEncryptionInfo()
+css::uno::Sequence<sal_Int8> Standard2007Engine::writeEncryptionInfo()
{
Reference<XOutputStream> aEncryptionInfoStream(
mxContext->getServiceManager()->createInstanceWithContext("com.sun.star.io.SequenceOutputStream", mxContext),
@@ -283,21 +283,17 @@ css::uno::Sequence<css::beans::NamedValue> Standard2007Engine::writeEncryptionIn
rStream.close();
aEncryptionInfoStream->flush();
- // Store all streams into sequence and return back
- comphelper::SequenceAsHashMap aStreams;
-
Reference<XSequenceOutputStream> aEncryptionInfoSequenceStream(aEncryptionInfoStream, UNO_QUERY);
- aStreams["EncryptionInfo"] <<= aEncryptionInfoSequenceStream->getWrittenBytes();
- return aStreams.getAsConstNamedValueList();
+ return aEncryptionInfoSequenceStream->getWrittenBytes();
}
-void Standard2007Engine::encrypt(const css::uno::Reference<css::io::XInputStream> & rxInputStream,
- css::uno::Reference<css::io::XOutputStream> & rxOutputStream)
+css::uno::Sequence<sal_Int8> Standard2007Engine::writeEncryptedDocument(const css::uno::Reference<css::io::XInputStream> & rxInputStream)
{
- if (mKey.empty())
- return;
+ Reference<XOutputStream> aOutputStream(
+ mxContext->getServiceManager()->createInstanceWithContext("com.sun.star.io.SequenceOutputStream", mxContext),
+ UNO_QUERY);
+ BinaryXOutputStream aBinaryOutputStream(aOutputStream, false);
- BinaryXOutputStream aBinaryOutputStream(rxOutputStream, false);
BinaryXInputStream aBinaryInputStream(rxInputStream, false);
Reference<XSeekable> xSeekable(rxInputStream, UNO_QUERY);
@@ -321,6 +317,21 @@ void Standard2007Engine::encrypt(const css::uno::Reference<css::io::XInputStream
outputLength = aEncryptor.update(outputBuffer, inputBuffer, inputLength);
aBinaryOutputStream.writeMemory(outputBuffer.data(), outputLength);
}
+
+ Reference<XSequenceOutputStream> aSequenceStream(aOutputStream, UNO_QUERY);
+ return aSequenceStream->getWrittenBytes();
+}
+
+css::uno::Sequence<css::beans::NamedValue> Standard2007Engine::encrypt(const css::uno::Reference<css::io::XInputStream> & rxInputStream)
+{
+ if (mKey.empty())
+ return css::uno::Sequence<css::beans::NamedValue>();
+
+ comphelper::SequenceAsHashMap aStreams;
+
+ aStreams["EncryptedPackage"] <<= writeEncryptedDocument(rxInputStream);
+ aStreams["EncryptionInfo"] <<= writeEncryptionInfo();
+ return aStreams.getAsConstNamedValueList();
}
css::uno::Reference<css::io::XInputStream> Standard2007Engine::getStream(const css::uno::Sequence<css::beans::NamedValue> & rStreams, const OUString sStreamName)
commit 4825bf7a70a8aea4157f5b5c43763596c90bc14d
Author: Vasily Melenchuk <vasily.melenchuk at cib.de>
AuthorDate: Sun Oct 13 21:29:24 2019 +0300
Commit: Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Wed Oct 16 02:17:59 2019 +0200
oox: avoid control freeze on exception
If exception happens somewhere in exportDocument() or later,
document controls could be remain locked and later cause crash
due to missing exception handler.
To avoid this simple lock guard was implemented releasing controls
even on exception.
Change-Id: I1ce4e487833ddc4b1f1b708f3a7e10bb299ef354
diff --git a/oox/source/core/filterbase.cxx b/oox/source/core/filterbase.cxx
index c99c77ba870f..ca57d3920a0c 100644
--- a/oox/source/core/filterbase.cxx
+++ b/oox/source/core/filterbase.cxx
@@ -110,6 +110,23 @@ DocumentOpenedGuard::~DocumentOpenedGuard()
rUrlPool.maUrls.erase( maUrl );
}
+class ControllerLockGuard
+{
+public:
+ explicit ControllerLockGuard(const Reference< XModel > & xModel)
+ : mxModel (xModel)
+ {
+ mxModel->lockControllers();
+ }
+
+ ~ControllerLockGuard()
+ {
+ mxModel->unlockControllers();
+ }
+private:
+ const Reference< XModel > & mxModel;
+};
+
} // namespace
/** Specifies whether this filter is an import or export filter. */
@@ -159,8 +176,6 @@ struct FilterBaseImpl
/// @throws IllegalArgumentException
void setDocumentModel( const Reference< XComponent >& rxComponent );
-
- void initializeFilter();
};
FilterBaseImpl::FilterBaseImpl( const Reference< XComponentContext >& rxContext ) :
@@ -185,18 +200,6 @@ void FilterBaseImpl::setDocumentModel( const Reference< XComponent >& rxComponen
}
}
-void FilterBaseImpl::initializeFilter()
-{
- try
- {
- // lock the model controllers
- mxModel->lockControllers();
- }
- catch( Exception& )
- {
- }
-}
-
FilterBase::FilterBase( const Reference< XComponentContext >& rxContext ) :
mxImpl( new FilterBaseImpl( rxContext ) )
{
@@ -472,7 +475,8 @@ sal_Bool SAL_CALL FilterBase::filter( const Sequence< PropertyValue >& rMediaDes
DocumentOpenedGuard aOpenedGuard( mxImpl->maFileUrl );
if( aOpenedGuard.isValid() || mxImpl->maFileUrl.isEmpty() )
{
- mxImpl->initializeFilter();
+ ControllerLockGuard aCtrlLockGuard(mxImpl->mxModel);
+
switch( mxImpl->meDirection )
{
case FILTERDIRECTION_UNKNOWN:
@@ -492,7 +496,6 @@ sal_Bool SAL_CALL FilterBase::filter( const Sequence< PropertyValue >& rMediaDes
}
break;
}
- mxImpl->mxModel->unlockControllers();
}
return bRet;
}
commit a7122ceebaacc122cc2d55ec933d5ecaebed4532
Author: Vasily Melenchuk <vasily.melenchuk at cib.de>
AuthorDate: Thu Oct 10 10:45:44 2019 +0300
Commit: Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Wed Oct 16 02:17:58 2019 +0200
crypto: predefine classes for later usage in unittests
Change-Id: I2835803eaa2670ca5cae5445049bbc95f303dd08
diff --git a/include/oox/crypto/AgileEngine.hxx b/include/oox/crypto/AgileEngine.hxx
index 39f8103a6a03..afef194e53e9 100644
--- a/include/oox/crypto/AgileEngine.hxx
+++ b/include/oox/crypto/AgileEngine.hxx
@@ -24,6 +24,8 @@ namespace oox {
class BinaryXOutputStream;
}
+namespace com::sun::star::uno { class XComponentContext; }
+
namespace oox {
namespace core {
diff --git a/include/oox/crypto/Standard2007Engine.hxx b/include/oox/crypto/Standard2007Engine.hxx
index e838d7b064d3..feaf6a3ada6f 100644
--- a/include/oox/crypto/Standard2007Engine.hxx
+++ b/include/oox/crypto/Standard2007Engine.hxx
@@ -22,6 +22,8 @@ namespace oox {
class BinaryXOutputStream;
}
+namespace com::sun::star::uno { class XComponentContext; }
+
namespace oox {
namespace core {
commit 8121d935fcbf8478bfbef86e299d9c9ddd949442
Author: Serge Krot <Serge.Krot at cib.de>
AuthorDate: Thu Oct 10 10:01:16 2019 +0200
Commit: Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Wed Oct 16 02:17:58 2019 +0200
Fix compilation: SAL_CALL is missing in method declaration
Change-Id: I4fc5e2de894a523d2a222ad9e7e04e1f1c01b9c5
Reviewed-on: https://gerrit.libreoffice.org/80590
Reviewed-by: Serge Krot (CIB) <Serge.Krot at cib.de>
Tested-by: Serge Krot (CIB) <Serge.Krot at cib.de>
diff --git a/include/oox/crypto/AgileEngine.hxx b/include/oox/crypto/AgileEngine.hxx
index 3a8b49e21de8..39f8103a6a03 100644
--- a/include/oox/crypto/AgileEngine.hxx
+++ b/include/oox/crypto/AgileEngine.hxx
@@ -131,24 +131,24 @@ public:
// Decryption
- sal_Bool generateEncryptionKey(const OUString & rPassword) override;
- sal_Bool readEncryptionInfo(const css::uno::Sequence<css::beans::NamedValue>& aStreams) override;
- sal_Bool decrypt(const css::uno::Reference<css::io::XInputStream>& rxInputStream,
+ virtual sal_Bool SAL_CALL generateEncryptionKey(const OUString & rPassword) override;
+ virtual sal_Bool SAL_CALL readEncryptionInfo(const css::uno::Sequence<css::beans::NamedValue>& aStreams) override;
+ virtual sal_Bool SAL_CALL decrypt(const css::uno::Reference<css::io::XInputStream>& rxInputStream,
css::uno::Reference<css::io::XOutputStream>& rxOutputStream) override;
- sal_Bool checkDataIntegrity() override;
+ virtual sal_Bool SAL_CALL checkDataIntegrity() override;
// Encryption
- css::uno::Sequence<css::beans::NamedValue> writeEncryptionInfo() override;
+ virtual css::uno::Sequence<css::beans::NamedValue> SAL_CALL writeEncryptionInfo() override;
- void encrypt(const css::uno::Reference<css::io::XInputStream>& rxInputStream,
+ virtual void SAL_CALL encrypt(const css::uno::Reference<css::io::XInputStream>& rxInputStream,
css::uno::Reference<css::io::XOutputStream>& rxOutputStream) override;
- sal_Bool setupEncryption(const css::uno::Sequence<css::beans::NamedValue>& rMediaEncData) override;
+ virtual sal_Bool SAL_CALL setupEncryption(const css::uno::Sequence<css::beans::NamedValue>& rMediaEncData) override;
- css::uno::Sequence<css::beans::NamedValue> createEncryptionData(const OUString& rPassword) override;
+ virtual css::uno::Sequence<css::beans::NamedValue> SAL_CALL createEncryptionData(const OUString& rPassword) override;
};
} // namespace core
diff --git a/include/oox/crypto/Standard2007Engine.hxx b/include/oox/crypto/Standard2007Engine.hxx
index d853f4e1a1af..e838d7b064d3 100644
--- a/include/oox/crypto/Standard2007Engine.hxx
+++ b/include/oox/crypto/Standard2007Engine.hxx
@@ -41,24 +41,24 @@ public:
// Decryption
- sal_Bool generateEncryptionKey(const OUString & rPassword) override;
- sal_Bool readEncryptionInfo(const css::uno::Sequence<css::beans::NamedValue>& aStreams) override;
- sal_Bool decrypt(const css::uno::Reference<css::io::XInputStream>& rxInputStream,
+ virtual sal_Bool SAL_CALL generateEncryptionKey(const OUString & rPassword) override;
+ virtual sal_Bool SAL_CALL readEncryptionInfo(const css::uno::Sequence<css::beans::NamedValue>& aStreams) override;
+ virtual sal_Bool SAL_CALL decrypt(const css::uno::Reference<css::io::XInputStream>& rxInputStream,
css::uno::Reference<css::io::XOutputStream>& rxOutputStream) override;
- sal_Bool checkDataIntegrity() override;
+ virtual sal_Bool SAL_CALL checkDataIntegrity() override;
// Encryption
- css::uno::Sequence<css::beans::NamedValue> writeEncryptionInfo() override;
+ virtual css::uno::Sequence<css::beans::NamedValue> SAL_CALL writeEncryptionInfo() override;
- void encrypt(const css::uno::Reference<css::io::XInputStream>& rxInputStream,
+ virtual void SAL_CALL encrypt(const css::uno::Reference<css::io::XInputStream>& rxInputStream,
css::uno::Reference<css::io::XOutputStream>& rxOutputStream) override;
- sal_Bool setupEncryption(const css::uno::Sequence<css::beans::NamedValue>& rMediaEncData) override;
+ virtual sal_Bool SAL_CALL setupEncryption(const css::uno::Sequence<css::beans::NamedValue>& rMediaEncData) override;
- css::uno::Sequence<css::beans::NamedValue> createEncryptionData(const OUString& rPassword) override;
+ virtual css::uno::Sequence<css::beans::NamedValue> SAL_CALL createEncryptionData(const OUString& rPassword) override;
};
} // namespace core
commit 0ad0783fff24cd1a8d8d05fc6b3483c55f82da14
Author: Vasily Melenchuk <vasily.melenchuk at cib.de>
AuthorDate: Tue Oct 8 11:46:05 2019 +0300
Commit: Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Wed Oct 16 02:17:58 2019 +0200
uno: XModel2->setArgs() now able to set "EncryptionData"
setArgs is able to set only limited media descriptor parameters.
Extending this list by one more.
Change-Id: I179a1cfc2cdd7b04becba0d7dfe9740d920ae4ee
Reviewed-on: https://gerrit.libreoffice.org/80432
Reviewed-by: Vasily Melenchuk <vasily.melenchuk at cib.de>
Tested-by: Vasily Melenchuk <vasily.melenchuk at cib.de>
diff --git a/offapi/com/sun/star/frame/XModel2.idl b/offapi/com/sun/star/frame/XModel2.idl
index c3a8d18a71b6..b3ae90358854 100644
--- a/offapi/com/sun/star/frame/XModel2.idl
+++ b/offapi/com/sun/star/frame/XModel2.idl
@@ -143,6 +143,7 @@ interface XModel2 : com::sun::star::frame::XModel
<li>com::sun::star::document::MediaDescriptor::SuggestedSaveAsDir</li>
<li>com::sun::star::document::MediaDescriptor::SuggestedSaveAsName</li>
<li>com::sun::star::document::MediaDescriptor::LockContentExtraction</li>
+ <li>com::sun::star::document::MediaDescriptor::EncryptionData</li>
</ul>
@throws com::sun::star::lang::IllegalArgumentException When trying to set an unsupported property
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index f4019db6b98d..039f21e0a233 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -1078,6 +1078,9 @@ void SAL_CALL SfxBaseModel::setArgs(const Sequence<beans::PropertyValue>& aArgs)
{
rArg.Value >>= bValue;
pMedium->GetItemSet()->Put(SfxBoolItem(SID_LOCK_CONTENT_EXTRACTION, bValue));
+ else if (rArg.Name == "EncryptionData")
+ {
+ pMedium->GetItemSet()->Put(SfxUnoAnyItem(SID_ENCRYPTIONDATA, rArg.Value));
}
else
{
commit dd31707b653298cafa520a36c732affb443383d0
Author: Serge Krot <Serge.Krot at cib.de>
AuthorDate: Wed Oct 9 17:15:37 2019 +0200
Commit: Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Wed Oct 16 02:16:44 2019 +0200
add new command for ToggleButtonToolbarContoller: createPopupMenu
Change-Id: I642763d577a7c6ceb8852ea54f592c32864ccfb8
Reviewed-on: https://gerrit.libreoffice.org/80556
Reviewed-by: Serge Krot (CIB) <Serge.Krot at cib.de>
Tested-by: Serge Krot (CIB) <Serge.Krot at cib.de>
diff --git a/framework/source/uielement/togglebuttontoolbarcontroller.cxx b/framework/source/uielement/togglebuttontoolbarcontroller.cxx
old mode 100644
new mode 100755
index fd8873dae765..92818083c1f7
--- a/framework/source/uielement/togglebuttontoolbarcontroller.cxx
+++ b/framework/source/uielement/togglebuttontoolbarcontroller.cxx
@@ -243,6 +243,10 @@ void ToggleButtonToolbarController::executeControlCommand( const css::frame::Con
}
}
}
+ else if ( rControlCommand.Command == "createPopupMenu" )
+ {
+ createPopupWindow();
+ }
}
IMPL_LINK( ToggleButtonToolbarController, MenuSelectHdl, Menu *, pMenu, bool )
commit 67b0808ba0ff150a7b1d46775f0c14190d3574f7
Author: Vasily Melenchuk <vasily.melenchuk at cib.de>
AuthorDate: Fri Oct 4 11:23:30 2019 +0300
Commit: Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Wed Oct 16 02:16:44 2019 +0200
IRM encryption implmentation is moved out of core
Change-Id: I2e83bfaf9e8190fe4839e2d39fcc9325305e4dda
diff --git a/include/oox/crypto/IRMEngine.hxx b/include/oox/crypto/IRMEngine.hxx
deleted file mode 100644
index c8ae7b125d86..000000000000
--- a/include/oox/crypto/IRMEngine.hxx
+++ /dev/null
@@ -1,70 +0,0 @@
-/* -*- 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_OOX_CRYPTO_IRMENGINE_HXX
-#define INCLUDED_OOX_CRYPTO_IRMENGINE_HXX
-
-#include <oox/dllapi.h>
-#include <com/sun/star/packages/XPackageEncryption.hpp>
-#include <rtl/ustring.hxx>
-#include <sal/types.h>
-
-namespace oox
-{
-namespace core
-{
-struct OOX_DLLPUBLIC IRMEncryptionInfo
-{
- OString license;
- bool bCanRead;
-};
-
-class OOX_DLLPUBLIC IRMEngine : public cppu::WeakImplHelper<css::packages::XPackageEncryption>
-{
- IRMEncryptionInfo mInfo;
- css::uno::Reference<css::uno::XComponentContext> mxContext;
-
- css::uno::Reference<css::io::XInputStream>
- getStream(const css::uno::Sequence<css::beans::NamedValue>& rStreams,
- const OUString sStreamName);
-
-public:
- IRMEngine(const css::uno::Reference<css::uno::XComponentContext>& rxContext);
-
- // Decryption
-
- sal_Bool generateEncryptionKey(const OUString& rPassword) override;
- sal_Bool
- readEncryptionInfo(const css::uno::Sequence<css::beans::NamedValue>& aStreams) override;
- sal_Bool decrypt(const css::uno::Reference<css::io::XInputStream>& rxInputStream,
- css::uno::Reference<css::io::XOutputStream>& rxOutputStream) override;
-
- sal_Bool checkDataIntegrity() override;
-
- // Encryption
-
- css::uno::Sequence<css::beans::NamedValue> writeEncryptionInfo() override;
-
- void encrypt(const css::uno::Reference<css::io::XInputStream>& rxInputStream,
- css::uno::Reference<css::io::XOutputStream>& rxOutputStream) override;
-
- sal_Bool
- setupEncryption(const css::uno::Sequence<css::beans::NamedValue>& rMediaEncData) override;
-
- css::uno::Sequence<css::beans::NamedValue>
- createEncryptionData(const OUString& rPassword) override;
-};
-
-} // namespace core
-} // namespace oox
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/oox/Library_oox.mk b/oox/Library_oox.mk
index b54b9283cba5..cc235b87e360 100644
--- a/oox/Library_oox.mk
+++ b/oox/Library_oox.mk
@@ -16,19 +16,8 @@ $(eval $(call gb_Library_use_custom_headers,oox,oox/generated))
$(eval $(call gb_Library_set_include,oox,\
$$(INCLUDE) \
-I$(SRCDIR)/oox/inc \
- -I"C:\Program Files\Active Directory Rights Management Services SDK 2.1\inc"\
))
-$(eval $(call gb_Library_add_libs,oox,\
- msipc_s.lib \
- msipc.lib \
-))
-
-$(eval $(call gb_Library_add_ldflags,oox,\
- -LIBPATH:"C:\Program Files\Active Directory Rights Management Services SDK 2.1\lib\x64"\
-))
-
-
ifeq ($(COM)-$(OS)-$(CPUNAME),GCC-LINUX-IA64)
# at least Debian Linux ia64 fails at compile time on
# link libooxlo.so which is apparently too large
@@ -109,7 +98,6 @@ $(eval $(call gb_Library_add_exception_objects,oox,\
oox/source/core/relationshandler \
oox/source/core/xmlfilterbase \
oox/source/crypto/AgileEngine \
- oox/source/crypto/IRMEngine \
oox/source/crypto/CryptTools \
oox/source/crypto/DocumentEncryption \
oox/source/crypto/DocumentDecryption \
diff --git a/oox/source/crypto/IRMEngine.cxx b/oox/source/crypto/IRMEngine.cxx
deleted file mode 100644
index 95135722ee08..000000000000
--- a/oox/source/crypto/IRMEngine.cxx
+++ /dev/null
@@ -1,447 +0,0 @@
-/* -*- 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 <oox/crypto/IRMEngine.hxx>
-
-#include <oox/helper/binaryinputstream.hxx>
-#include <oox/helper/binaryoutputstream.hxx>
-
-#include <sax/tools/converter.hxx>
-
-#include <comphelper/hash.hxx>
-#include <comphelper/docpasswordhelper.hxx>
-#include <comphelper/random.hxx>
-#include <comphelper/processfactory.hxx>
-#include <comphelper/base64.hxx>
-#include <comphelper/sequence.hxx>
-#include <comphelper/sequenceashashmap.hxx>
-
-#include <filter/msfilter/mscodec.hxx>
-#include <tools/stream.hxx>
-#include <tools/XmlWriter.hxx>
-
-#include <com/sun/star/io/XSeekable.hpp>
-#include <com/sun/star/io/XStream.hpp>
-#include <com/sun/star/io/SequenceInputStream.hpp>
-#include <com/sun/star/io/XSequenceOutputStream.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/xml/sax/XFastParser.hpp>
-#include <com/sun/star/xml/sax/XFastTokenHandler.hpp>
-#include <com/sun/star/xml/sax/FastParser.hpp>
-#include <com/sun/star/xml/sax/FastToken.hpp>
-
-#include <msipc.h>
-
-using namespace css;
-using namespace css::beans;
-using namespace css::io;
-using namespace css::lang;
-using namespace css::uno;
-using namespace css::xml::sax;
-using namespace css::xml;
-
-namespace oox
-{
-namespace core
-{
-extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface*
-com_sun_star_comp_oox_crypto_DRMEncryptedDataSpace_get_implementation(
- XComponentContext* pCtx, Sequence<Any> const& /*arguments*/)
-{
- return cppu::acquire(new IRMEngine(pCtx /*, arguments*/));
-}
-
-IRMEngine::IRMEngine(const Reference<XComponentContext>& rxContext)
- : mxContext(rxContext)
-{
-}
-
-sal_Bool IRMEngine::checkDataIntegrity() { return true; }
-
-sal_Bool IRMEngine::decrypt(const Reference<XInputStream>& rxInputStream,
- Reference<XOutputStream>& rxOutputStream)
-{
- BinaryXInputStream aInputStream(rxInputStream, true);
- BinaryXOutputStream aOutputStream(rxOutputStream, true);
-
- aInputStream.readInt64(); // Skip stream size
-
- HRESULT hr = IpcInitialize();
- if (FAILED(hr) && hr != HRESULT_FROM_WIN32(ERROR_ALREADY_INITIALIZED))
- {
- // ERROR_ALREADY_INITIALIZED not an error
- // TODO: some reaction?
- return false;
- }
-
- // Get decryption key
- IPC_BUFFER licenseBuffer;
- IPC_KEY_HANDLE key;
- licenseBuffer.pvBuffer = (void*)mInfo.license.getStr();
- licenseBuffer.cbBuffer = mInfo.license.getLength();
- hr = IpcGetKey(&licenseBuffer, 0, NULL, NULL, &key);
- if (FAILED(hr))
- {
- // TODO: some reaction?
- return false;
- }
-
- // Read rights
- BOOL value;
- hr = IpcAccessCheck(key, IPC_GENERIC_READ, &value);
- if (FAILED(hr))
- {
- // TODO: some reaction?
- return false;
- }
- mInfo.bCanRead = value;
-
- // Get size of decrypt block
- DWORD* blockSize;
- hr = IpcGetKeyProperty(key, IPC_KI_BLOCK_SIZE, nullptr, (LPVOID*)&blockSize);
- if (FAILED(hr))
- {
- // TODO: some reaction?
- return false;
- }
-
- char* pEncryptedBuffer = new char[*blockSize];
- char* pDecryptedBuffer = new char[*blockSize];
- int blockNo = 0;
- bool lastBlock = false;
-
- do
- {
- sal_uInt32 readBytes = aInputStream.readArray(pEncryptedBuffer, *blockSize);
- lastBlock = readBytes != *blockSize;
- DWORD bytes = 0;
- hr = IpcDecrypt(key, blockNo, lastBlock, (PBYTE)pEncryptedBuffer, *blockSize,
- (PBYTE)pDecryptedBuffer, *blockSize, &bytes);
-
- if (FAILED(hr))
- {
- // TODO: some reaction?
- return false;
- }
-
- aOutputStream.writeArray(pDecryptedBuffer, bytes);
-
- blockNo++;
- } while (!lastBlock);
-
- delete[] pEncryptedBuffer;
- delete[] pDecryptedBuffer;
-
- rxOutputStream->flush();
-
- return true;
-}
-
-uno::Sequence<beans::NamedValue> IRMEngine::createEncryptionData(const OUString& /*rPassword*/)
-{
- css::uno::Sequence<sal_uInt8> seq;
- seq.realloc(mInfo.license.getLength());
- memcpy(seq.getArray(), mInfo.license.getStr(), mInfo.license.getLength());
-
- comphelper::SequenceAsHashMap aEncryptionData;
- aEncryptionData["LicenseKey"] <<= seq;
- aEncryptionData["CryptoType"] <<= OUString("DRMEncryptedDataSpace");
- aEncryptionData["OOXPassword"] <<= OUString("1");
-
- return aEncryptionData.getAsConstNamedValueList();
-}
-
-uno::Reference<io::XInputStream> IRMEngine::getStream(const Sequence<NamedValue>& rStreams,
- const OUString sStreamName)
-{
- for (const auto& aStream : rStreams)
- {
- if (aStream.Name == sStreamName)
- {
- css::uno::Sequence<sal_Int8> aSeq;
- aStream.Value >>= aSeq;
- Reference<XInputStream> aStream(
- io::SequenceInputStream::createStreamFromSequence(mxContext, aSeq),
- UNO_QUERY_THROW);
- return aStream;
- }
- }
- return nullptr;
-}
-
-sal_Bool IRMEngine::readEncryptionInfo(const uno::Sequence<beans::NamedValue>& aStreams)
-{
- // Read TransformInfo storage for IRM ECMA documents (MS-OFFCRYPTO 2.2.4)
- uno::Reference<io::XInputStream> xTransformInfoStream
- = getStream(aStreams, "\006DataSpaces/TransformInfo/DRMEncryptedTransform/\006Primary");
- SAL_WARN_IF(!xTransformInfoStream.is(), "oox", "TransormInfo stream is missing!");
- BinaryXInputStream aBinaryStream(xTransformInfoStream, true);
-
- // MS-OFFCRYPTO 2.1.8: TransformInfoHeader
- aBinaryStream.readuInt32(); // TransformLength
- aBinaryStream.readuInt32(); // TransformType
- // TransformId
- sal_uInt32 aStringLength = aBinaryStream.readuInt32();
- OUString sTransformId = aBinaryStream.readUnicodeArray(aStringLength / 2);
- aBinaryStream.skip((4 - (aStringLength & 3)) & 3); // Skip padding
-
- // TransformName
- aStringLength = aBinaryStream.readuInt32();
- OUString sTransformName = aBinaryStream.readUnicodeArray(aStringLength / 2);
- aBinaryStream.skip((4 - (aStringLength & 3)) & 3); // Skip padding
-
- aBinaryStream.readuInt32(); // ReaderVersion
- aBinaryStream.readuInt32(); // UpdaterVersion
- aBinaryStream.readuInt32(); // WriterVersion
-
- // MS-OFFCRYPTO 2.2.5: ExtensibilityHeader
- aBinaryStream.readuInt32(); // ExtensibilityHeader
-
- // MS-OFFCRYPTO 2.2.6: XrMLLicense
- aStringLength = aBinaryStream.readuInt32();
- mInfo.license = aBinaryStream.readCharArray(aStringLength);
-
- if (mInfo.license.getLength()
- && static_cast<sal_uChar>(mInfo.license[0]) != 0x0ef) // BOM is missing?
- {
- mInfo.license = "\x0ef\x0bb\x0bf" + mInfo.license;
- }
-
- // TODO: CHECK info data
-
- return true;
-}
-
-sal_Bool IRMEngine::setupEncryption(const Sequence<NamedValue>& rMediaEncData)
-{
- for (int i = 0; i < rMediaEncData.getLength(); i++)
- {
- if (rMediaEncData[i].Name == "LicenseKey")
- {
- css::uno::Sequence<sal_uInt8> seq;
- rMediaEncData[i].Value >>= seq;
- mInfo.license = OString(reinterpret_cast<sal_Char*>(seq.getArray()), seq.getLength());
- }
- }
-
- return true;
-}
-
-Sequence<NamedValue> IRMEngine::writeEncryptionInfo()
-{
- // Write 0x6DataSpaces/DataSpaceMap
- Reference<XOutputStream> xDataSpaceMap(
- mxContext->getServiceManager()->createInstanceWithContext(
- "com.sun.star.io.SequenceOutputStream", mxContext),
- UNO_QUERY);
- BinaryXOutputStream aDataSpaceMapStream(xDataSpaceMap, false);
-
- aDataSpaceMapStream.WriteInt32(8); // Header length
- aDataSpaceMapStream.WriteInt32(1); // Entries count
-
- // DataSpaceMapEntry (MS-OFFCRYPTO 2.1.6.1)
- OUString sDataSpaceName("DRMEncryptedDataSpace");
- OUString sReferenceComponent("EncryptedPackage");
-
- aDataSpaceMapStream.WriteInt32(0x60); // Length
- aDataSpaceMapStream.WriteInt32(1); // References count
- aDataSpaceMapStream.WriteInt32(0); // References component type
-
- aDataSpaceMapStream.WriteInt32(sReferenceComponent.getLength() * 2);
- aDataSpaceMapStream.writeUnicodeArray(sReferenceComponent);
- for (int i = 0; i < sReferenceComponent.getLength() * 2 % 4; i++) // Padding
- {
- aDataSpaceMapStream.writeValue<sal_Char>(0);
- }
-
- aDataSpaceMapStream.WriteInt32(sDataSpaceName.getLength() * 2);
- aDataSpaceMapStream.writeUnicodeArray(sDataSpaceName);
- for (int i = 0; i < sDataSpaceName.getLength() * 2 % 4; i++) // Padding
- {
- aDataSpaceMapStream.writeValue<sal_Char>(0);
- }
-
- aDataSpaceMapStream.close();
- xDataSpaceMap->flush();
-
- // Write 0x6DataSpaces/Version
- Reference<XOutputStream> xVersion(mxContext->getServiceManager()->createInstanceWithContext(
- "com.sun.star.io.SequenceOutputStream", mxContext),
- UNO_QUERY);
- BinaryXOutputStream aVersionStream(xVersion, false);
-
- OUString sFeatureIdentifier("Microsoft.Container.DataSpaces");
- aVersionStream.WriteInt32(sFeatureIdentifier.getLength() * 2);
- aVersionStream.writeUnicodeArray(sFeatureIdentifier);
- for (int i = 0; i < sFeatureIdentifier.getLength() * 2 % 4; i++) // Padding
- {
- aVersionStream.writeValue<sal_Char>(0);
- }
-
- aVersionStream.WriteInt32(1); // Reader version
- aVersionStream.WriteInt32(1); // Updater version
- aVersionStream.WriteInt32(1); // Writer version
-
- aVersionStream.close();
- xVersion->flush();
-
- // Write 0x6DataSpaces/DataSpaceInfo/[dataspacename]
- Reference<XOutputStream> xDataSpaceInfo(
- mxContext->getServiceManager()->createInstanceWithContext(
- "com.sun.star.io.SequenceOutputStream", mxContext),
- UNO_QUERY);
- BinaryXOutputStream aDataSpaceInfoStream(xDataSpaceInfo, false);
-
- aDataSpaceInfoStream.WriteInt32(0x08); // Header length
- aDataSpaceInfoStream.WriteInt32(1); // Entries count
-
- OUString sTransformName("DRMEncryptedTransform");
- aDataSpaceInfoStream.WriteInt32(sTransformName.getLength() * 2);
- aDataSpaceInfoStream.writeUnicodeArray(sTransformName);
- for (int i = 0; i < sTransformName.getLength() * 2 % 4; i++) // Padding
- {
- aDataSpaceInfoStream.writeValue<sal_Char>(0);
- }
-
- aDataSpaceInfoStream.close();
- xDataSpaceInfo->flush();
-
- // Write 0x6DataSpaces/TransformInfo/[transformname]
- Reference<XOutputStream> xTransformInfo(
- mxContext->getServiceManager()->createInstanceWithContext(
- "com.sun.star.io.SequenceOutputStream", mxContext),
- UNO_QUERY);
- BinaryXOutputStream aTransformInfoStream(xTransformInfo, false);
- OUString sTransformId("{C73DFACD-061F-43B0-8B64-0C620D2A8B50}");
-
- // MS-OFFCRYPTO 2.1.8: TransformInfoHeader
- sal_uInt32 nLength
- = sTransformId.getLength() * 2 + ((4 - (sTransformId.getLength() & 3)) & 3) + 10;
- aTransformInfoStream.WriteInt32(nLength); // TransformLength, will be written later
- aTransformInfoStream.WriteInt32(1); // TransformType
-
- // TransformId
- aTransformInfoStream.WriteInt32(sTransformId.getLength() * 2);
- aTransformInfoStream.writeUnicodeArray(sTransformId);
- for (int i = 0; i < sTransformId.getLength() * 2 % 4; i++) // Padding
- {
- aTransformInfoStream.writeValue<sal_Char>(0);
- }
-
- // TransformName
- OUString sTransformInfoName("Microsoft.Metadata.DRMTransform");
- aTransformInfoStream.WriteInt32(sTransformInfoName.getLength() * 2);
- aTransformInfoStream.writeUnicodeArray(sTransformInfoName);
- for (int i = 0; i < sTransformInfoName.getLength() * 2 % 4; i++) // Padding
- {
- aTransformInfoStream.writeValue<sal_Char>(0);
- }
-
- aTransformInfoStream.WriteInt32(1); // ReaderVersion
- aTransformInfoStream.WriteInt32(1); // UpdateVersion
- aTransformInfoStream.WriteInt32(1); // WriterVersion
-
- aTransformInfoStream.WriteInt32(4); // Extensibility Header
-
- aTransformInfoStream.WriteInt32(mInfo.license.getLength() - 3); // LicenseLength - BOM
- aTransformInfoStream.writeArray<sal_Char>(mInfo.license.getStr() + 3,
- mInfo.license.getLength() - 3);
- aTransformInfoStream.writeValue<sal_Char>(0);
-
- aTransformInfoStream.close();
- xTransformInfo->flush();
-
- // Store all streams into sequence and return back
- comphelper::SequenceAsHashMap aStreams;
-
- Reference<XSequenceOutputStream> xDataSpaceMapSequence(xDataSpaceMap, UNO_QUERY);
- aStreams["\006DataSpaces/DataSpaceMap"] <<= xDataSpaceMapSequence->getWrittenBytes();
-
- Reference<XSequenceOutputStream> xVersionSequence(xVersion, UNO_QUERY);
- aStreams["\006DataSpaces/Version"] <<= xVersionSequence->getWrittenBytes();
-
- OUString sStreamName = "\006DataSpaces/DataSpaceInfo/" + sDataSpaceName;
- Reference<XSequenceOutputStream> xDataSpaceInfoSequence(xDataSpaceInfo, UNO_QUERY);
- aStreams[sStreamName] <<= xDataSpaceInfoSequence->getWrittenBytes();
-
- sStreamName = "\006DataSpaces/TransformInfo/" + sTransformName + "/\006Primary";
- Reference<XSequenceOutputStream> xTransformInfoSequence(xTransformInfo, UNO_QUERY);
- aStreams[sStreamName] <<= xTransformInfoSequence->getWrittenBytes();
-
- return aStreams.getAsConstNamedValueList();
-}
-
-void IRMEngine::encrypt(const Reference<XInputStream>& rxInputStream,
- Reference<XOutputStream>& rxOutputStream)
-{
- HRESULT hr = IpcInitialize();
-
- if (FAILED(hr) && hr != HRESULT_FROM_WIN32(ERROR_ALREADY_INITIALIZED))
- {
- // ERROR_ALREADY_INITIALIZED not an error
- // TODO: some reaction?
- }
-
- BinaryXInputStream aInputStream(rxInputStream, false);
- BinaryXOutputStream aOutputStream(rxOutputStream, false);
- aOutputStream.WriteInt64(aInputStream.size()); // Stream size
-
- // Get decryption key
- IPC_BUFFER licenseBuffer;
- IPC_KEY_HANDLE key;
- licenseBuffer.pvBuffer = (void*)mInfo.license.getStr();
- licenseBuffer.cbBuffer = mInfo.license.getLength();
- hr = IpcGetKey(&licenseBuffer, 0, NULL, NULL, &key);
- if (FAILED(hr))
- {
- // TODO: some reaction?
- }
-
- // Get size of encrypt block
- DWORD* blockSize;
- hr = IpcGetKeyProperty(key, IPC_KI_BLOCK_SIZE, nullptr, (LPVOID*)&blockSize);
- if (FAILED(hr))
- {
- // TODO: some reaction?
- }
-
- char* pEncryptedBuffer = new char[*blockSize];
- char* pDecryptedBuffer = new char[*blockSize];
- int blockNo = 0;
- bool lastBlock = false;
-
- do
- {
- sal_uInt32 readBytes = aInputStream.readArray(pDecryptedBuffer, *blockSize);
- lastBlock = readBytes != *blockSize;
- DWORD bytes = 0;
- hr = IpcEncrypt(key, blockNo, lastBlock, (PBYTE)pDecryptedBuffer, *blockSize,
- (PBYTE)pEncryptedBuffer, *blockSize, &bytes);
-
- if (FAILED(hr))
- {
- // TODO: some reaction?
- }
-
- aOutputStream.writeArray(pEncryptedBuffer, bytes);
-
- blockNo++;
- } while (!lastBlock);
-
- delete[] pEncryptedBuffer;
- delete[] pDecryptedBuffer;
-}
-
-sal_Bool IRMEngine::generateEncryptionKey(const OUString& /*password*/) { return true; }
-
-} // namespace core
-} // namespace oox
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/oox/util/oox.component b/oox/util/oox.component
index 0643a417bfa3..d7167545b2be 100644
--- a/oox/util/oox.component
+++ b/oox/util/oox.component
@@ -40,14 +40,6 @@
constructor="com_sun_star_comp_oox_ShapeContextHandler_get_implementation">
<service name="com.sun.star.xml.sax.FastShapeContextHandler"/>
</implementation>
- <implementation name="com.sun.star.comp.oox.crypto.DRMEncryptedDataSpace"
- constructor="com_sun_star_comp_oox_crypto_DRMEncryptedDataSpace_get_implementation">
- <service name="com.sun.star.packages.XPackageEncryption"/>
- </implementation>
- <implementation name="com.sun.star.comp.oox.crypto.DRMDataSpace"
- constructor="com_sun_star_comp_oox_crypto_DRMDataSpace_get_implementation">
- <service name="com.sun.star.packages.XPackageEncryption"/>
- </implementation>
<implementation name="com.sun.star.comp.oox.crypto.Standard2007Engine"
constructor="com_sun_star_comp_oox_crypto_Standard2007_get_implementation">
<service name="com.sun.star.packages.XPackageEncryption"/>
commit b4fc5d8c3adec8034144e50d422f51d1f8e6567f
Author: Vasily Melenchuk <vasily.melenchuk at cib.de>
AuthorDate: Fri Sep 27 11:56:00 2019 +0300
Commit: Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Wed Oct 16 02:16:43 2019 +0200
msdoc crypto: move crypto engines to service
New interface XPackageEncryption was created. All existing
crypto engines are refactored to be implmentations of this interface.
Change-Id: Id063aca1474f76a926a2e47eecd4c12ebe79650f
diff --git a/include/oox/crypto/AgileEngine.hxx b/include/oox/crypto/AgileEngine.hxx
index 60d19fed11db..3a8b49e21de8 100644
--- a/include/oox/crypto/AgileEngine.hxx
+++ b/include/oox/crypto/AgileEngine.hxx
@@ -15,9 +15,9 @@
#include <oox/dllapi.h>
#include <oox/crypto/CryptTools.hxx>
-#include <oox/crypto/CryptoEngine.hxx>
#include <rtl/ustring.hxx>
#include <sal/types.h>
+#include <com/sun/star/packages/XPackageEncryption.hpp>
namespace oox {
class BinaryXInputStream;
@@ -74,7 +74,7 @@ enum class AgileEncryptionPreset
AES_256_SHA512,
};
-class OOX_DLLPUBLIC AgileEngine : public CryptoEngine
+class OOX_DLLPUBLIC AgileEngine : public cppu::WeakImplHelper<css::packages::XPackageEncryption>
{
private:
std::vector<sal_uInt8> mKey;
@@ -82,7 +82,7 @@ private:
AgileEncryptionPreset meEncryptionPreset;
css::uno::Reference< css::uno::XComponentContext > mxContext;
- css::uno::Reference<css::io::XInputStream> getStream(css::uno::Sequence<css::beans::NamedValue> & rStreams, const OUString sStreamName);
+ css::uno::Reference<css::io::XInputStream> getStream(const css::uno::Sequence<css::beans::NamedValue> & rStreams, const OUString sStreamName);
void calculateHashFinal(const OUString& rPassword, std::vector<sal_uInt8>& aHashFinal);
@@ -131,24 +131,24 @@ public:
// Decryption
- bool generateEncryptionKey(OUString const & rPassword) override;
- bool readEncryptionInfo(css::uno::Sequence<css::beans::NamedValue> aStreams) override;
- bool decrypt(BinaryXInputStream& aInputStream,
- BinaryXOutputStream& aOutputStream) override;
+ sal_Bool generateEncryptionKey(const OUString & rPassword) override;
+ sal_Bool readEncryptionInfo(const css::uno::Sequence<css::beans::NamedValue>& aStreams) override;
+ sal_Bool decrypt(const css::uno::Reference<css::io::XInputStream>& rxInputStream,
+ css::uno::Reference<css::io::XOutputStream>& rxOutputStream) override;
- bool checkDataIntegrity() override;
+
+ sal_Bool checkDataIntegrity() override;
// Encryption
- void writeEncryptionInfo(oox::ole::OleStorage& rOleStorage) override;
+ css::uno::Sequence<css::beans::NamedValue> writeEncryptionInfo() override;
- void encrypt(css::uno::Reference<css::io::XInputStream>& rxInputStream,
- css::uno::Reference<css::io::XOutputStream>& rxOutputStream,
- sal_uInt32 nSize) override;
+ void encrypt(const css::uno::Reference<css::io::XInputStream>& rxInputStream,
+ css::uno::Reference<css::io::XOutputStream>& rxOutputStream) override;
- bool setupEncryption(css::uno::Sequence<css::beans::NamedValue>& rMediaEncData) override;
+ sal_Bool setupEncryption(const css::uno::Sequence<css::beans::NamedValue>& rMediaEncData) override;
- virtual void createEncryptionData(comphelper::SequenceAsHashMap & aEncryptionData, const OUString rPassword) override;
+ css::uno::Sequence<css::beans::NamedValue> createEncryptionData(const OUString& rPassword) override;
};
} // namespace core
diff --git a/include/oox/crypto/CryptoEngine.hxx b/include/oox/crypto/CryptoEngine.hxx
deleted file mode 100644
index f985f2d7fb45..000000000000
--- a/include/oox/crypto/CryptoEngine.hxx
+++ /dev/null
@@ -1,68 +0,0 @@
-/* -*- 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_OOX_CRYPTO_CRYPTOENGINE_HXX
-#define INCLUDED_OOX_CRYPTO_CRYPTOENGINE_HXX
-
-#include <vector>
-
-#include <rtl/ustring.hxx>
-#include <sal/types.h>
-
-#include <com/sun/star/io/XInputStream.hpp>
-#include <com/sun/star/io/XOutputStream.hpp>
-#include <com/sun/star/uno/Sequence.hxx>
-
-namespace oox {
- class BinaryXInputStream;
- class BinaryXOutputStream;
-}
-
-namespace oox {
-namespace core {
-
-class CryptoEngine
-{
-public:
- CryptoEngine()
- {}
-
- virtual ~CryptoEngine()
- {}
-
- // Decryption
- virtual bool readEncryptionInfo(css::uno::Sequence<css::beans::NamedValue> aStreams) = 0;
-
- virtual bool generateEncryptionKey(const OUString& rPassword) = 0;
-
- virtual bool decrypt(
- BinaryXInputStream& aInputStream,
- BinaryXOutputStream& aOutputStream) = 0;
-
- // Encryption
- virtual void writeEncryptionInfo(oox::ole::OleStorage& rOleStorage) = 0;
-
- virtual void createEncryptionData(comphelper::SequenceAsHashMap & aEncryptionData, const OUString rPassword) = 0;
-
- virtual bool setupEncryption(css::uno::Sequence<css::beans::NamedValue>& rMediaEncData) = 0;
-
- virtual void encrypt(css::uno::Reference<css::io::XInputStream> & rxInputStream,
- css::uno::Reference<css::io::XOutputStream> & rxOutputStream,
- sal_uInt32 nSize) = 0;
-
- virtual bool checkDataIntegrity() = 0;
-};
-
-} // namespace core
-} // namespace oox
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/crypto/DocumentDecryption.hxx b/include/oox/crypto/DocumentDecryption.hxx
index 248f33f61734..fdea2c25f9f7 100644
--- a/include/oox/crypto/DocumentDecryption.hxx
+++ b/include/oox/crypto/DocumentDecryption.hxx
@@ -17,7 +17,6 @@
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/uno/Sequence.hxx>
-#include <oox/crypto/CryptoEngine.hxx>
#include <rtl/ustring.hxx>
namespace com { namespace sun { namespace star {
@@ -25,6 +24,7 @@ namespace com { namespace sun { namespace star {
namespace io { class XInputStream; }
namespace io { class XStream; }
namespace uno { class XComponentContext; }
+ namespace packages { class XPackageEncryption; }
} } }
namespace oox { namespace ole { class OleStorage; } }
@@ -37,8 +37,7 @@ class OOX_DLLPUBLIC DocumentDecryption
private:
oox::ole::OleStorage& mrOleStorage;
css::uno::Sequence<css::beans::NamedValue> maStreamsSequence;
- std::unique_ptr<CryptoEngine> mEngine;
- OUString msEngineName;
+ css::uno::Reference< css::packages::XPackageEncryption > mxPackageEncryption;
css::uno::Reference< css::uno::XComponentContext > mxContext;
void readStrongEncryptionInfo();
diff --git a/include/oox/crypto/DocumentEncryption.hxx b/include/oox/crypto/DocumentEncryption.hxx
index 9e9c013456ca..d33450a3b791 100644
--- a/include/oox/crypto/DocumentEncryption.hxx
+++ b/include/oox/crypto/DocumentEncryption.hxx
@@ -15,11 +15,11 @@
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/uno/Sequence.hxx>
-#include <oox/crypto/CryptoEngine.hxx>
#include <rtl/ustring.hxx>
namespace com { namespace sun { namespace star {
namespace io { class XStream; }
+ namespace packages { class XPackageEncryption; }
} } }
namespace oox { namespace ole { class OleStorage; } }
@@ -32,7 +32,7 @@ class OOX_DLLPUBLIC DocumentEncryption
private:
css::uno::Reference< css::io::XStream > mxDocumentStream;
oox::ole::OleStorage& mrOleStorage;
- std::unique_ptr<CryptoEngine> mEngine;
+ css::uno::Reference< css::packages::XPackageEncryption > mxPackageEncryption;
css::uno::Sequence< css::beans::NamedValue >& mMediaEncData;
css::uno::Reference< css::uno::XComponentContext > mxContext;
diff --git a/include/oox/crypto/IRMEngine.hxx b/include/oox/crypto/IRMEngine.hxx
index 9bf610904a9d..c8ae7b125d86 100644
--- a/include/oox/crypto/IRMEngine.hxx
+++ b/include/oox/crypto/IRMEngine.hxx
@@ -12,19 +12,12 @@
#define INCLUDED_OOX_CRYPTO_IRMENGINE_HXX
#include <oox/dllapi.h>
-#include <oox/crypto/CryptoEngine.hxx>
-#include <filter/msfilter/mscodec.hxx>
+#include <com/sun/star/packages/XPackageEncryption.hpp>
#include <rtl/ustring.hxx>
#include <sal/types.h>
namespace oox
{
-class BinaryXInputStream;
-class BinaryXOutputStream;
-}
-
-namespace oox
-{
namespace core
{
struct OOX_DLLPUBLIC IRMEncryptionInfo
@@ -33,37 +26,40 @@ struct OOX_DLLPUBLIC IRMEncryptionInfo
bool bCanRead;
};
-class OOX_DLLPUBLIC IRMEngine : public CryptoEngine
+class OOX_DLLPUBLIC IRMEngine : public cppu::WeakImplHelper<css::packages::XPackageEncryption>
{
IRMEncryptionInfo mInfo;
css::uno::Reference<css::uno::XComponentContext> mxContext;
css::uno::Reference<css::io::XInputStream>
- getStream(css::uno::Sequence<css::beans::NamedValue>& rStreams, const OUString sStreamName);
+ getStream(const css::uno::Sequence<css::beans::NamedValue>& rStreams,
+ const OUString sStreamName);
public:
IRMEngine(const css::uno::Reference<css::uno::XComponentContext>& rxContext);
- bool readEncryptionInfo(css::uno::Sequence<css::beans::NamedValue> aStreams) override;
+ // Decryption
- virtual bool generateEncryptionKey(OUString const& rPassword) override;
+ sal_Bool generateEncryptionKey(const OUString& rPassword) override;
+ sal_Bool
+ readEncryptionInfo(const css::uno::Sequence<css::beans::NamedValue>& aStreams) override;
+ sal_Bool decrypt(const css::uno::Reference<css::io::XInputStream>& rxInputStream,
+ css::uno::Reference<css::io::XOutputStream>& rxOutputStream) override;
- virtual bool decrypt(BinaryXInputStream& aInputStream,
- BinaryXOutputStream& aOutputStream) override;
+ sal_Bool checkDataIntegrity() override;
- bool checkDataIntegrity() override;
+ // Encryption
- void encrypt(css::uno::Reference<css::io::XInputStream>& rxInputStream,
- css::uno::Reference<css::io::XOutputStream>& rxOutputStream,
- sal_uInt32 nSize) override;
+ css::uno::Sequence<css::beans::NamedValue> writeEncryptionInfo() override;
- virtual void writeEncryptionInfo(oox::ole::OleStorage& rOleStorage) override;
+ void encrypt(const css::uno::Reference<css::io::XInputStream>& rxInputStream,
+ css::uno::Reference<css::io::XOutputStream>& rxOutputStream) override;
- virtual void createEncryptionData(comphelper::SequenceAsHashMap& aEncryptionData,
- const OUString rPassword) override;
+ sal_Bool
+ setupEncryption(const css::uno::Sequence<css::beans::NamedValue>& rMediaEncData) override;
- virtual bool
- setupEncryption(css::uno::Sequence<css::beans::NamedValue>& rMediaEncData) override;
+ css::uno::Sequence<css::beans::NamedValue>
+ createEncryptionData(const OUString& rPassword) override;
};
} // namespace core
diff --git a/include/oox/crypto/Standard2007Engine.hxx b/include/oox/crypto/Standard2007Engine.hxx
index e0ed99b79e33..d853f4e1a1af 100644
--- a/include/oox/crypto/Standard2007Engine.hxx
+++ b/include/oox/crypto/Standard2007Engine.hxx
@@ -12,7 +12,7 @@
#define INCLUDED_OOX_CRYPTO_STANDARD2007ENGINE_HXX
#include <oox/dllapi.h>
-#include <oox/crypto/CryptoEngine.hxx>
+#include <com/sun/star/packages/XPackageEncryption.hpp>
#include <filter/msfilter/mscodec.hxx>
#include <rtl/ustring.hxx>
#include <sal/types.h>
@@ -25,7 +25,7 @@ namespace oox {
namespace oox {
namespace core {
-class OOX_DLLPUBLIC Standard2007Engine : public CryptoEngine
+class OOX_DLLPUBLIC Standard2007Engine : public cppu::WeakImplHelper<css::packages::XPackageEncryption>
{
msfilter::StandardEncryptionInfo mInfo;
std::vector<sal_uInt8> mKey;
@@ -34,31 +34,31 @@ class OOX_DLLPUBLIC Standard2007Engine : public CryptoEngine
bool generateVerifier();
bool calculateEncryptionKey(const OUString& rPassword);
- css::uno::Reference<css::io::XInputStream> getStream(css::uno::Sequence<css::beans::NamedValue> & rStreams, const OUString sStreamName);
+ css::uno::Reference<css::io::XInputStream> getStream(const css::uno::Sequence<css::beans::NamedValue> & rStreams, const OUString sStreamName);
public:
Standard2007Engine(const css::uno::Reference<css::uno::XComponentContext>& rxContext);
- bool readEncryptionInfo(css::uno::Sequence<css::beans::NamedValue> aStreams) override;
+ // Decryption
- virtual bool generateEncryptionKey(OUString const & rPassword) override;
+ sal_Bool generateEncryptionKey(const OUString & rPassword) override;
+ sal_Bool readEncryptionInfo(const css::uno::Sequence<css::beans::NamedValue>& aStreams) override;
+ sal_Bool decrypt(const css::uno::Reference<css::io::XInputStream>& rxInputStream,
+ css::uno::Reference<css::io::XOutputStream>& rxOutputStream) override;
- virtual bool decrypt(
- BinaryXInputStream& aInputStream,
- BinaryXOutputStream& aOutputStream) override;
- bool checkDataIntegrity() override;
+ sal_Bool checkDataIntegrity() override;
- void encrypt(css::uno::Reference<css::io::XInputStream>& rxInputStream,
- css::uno::Reference<css::io::XOutputStream>& rxOutputStream,
- sal_uInt32 nSize) override;
+ // Encryption
- virtual void writeEncryptionInfo(oox::ole::OleStorage& rOleStorage) override;
+ css::uno::Sequence<css::beans::NamedValue> writeEncryptionInfo() override;
- virtual void createEncryptionData(comphelper::SequenceAsHashMap & aEncryptionData, const OUString rPassword) override;
+ void encrypt(const css::uno::Reference<css::io::XInputStream>& rxInputStream,
+ css::uno::Reference<css::io::XOutputStream>& rxOutputStream) override;
- virtual bool setupEncryption(css::uno::Sequence<css::beans::NamedValue>& rMediaEncData) override;
+ sal_Bool setupEncryption(const css::uno::Sequence<css::beans::NamedValue>& rMediaEncData) override;
+ css::uno::Sequence<css::beans::NamedValue> createEncryptionData(const OUString& rPassword) override;
};
} // namespace core
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 4e36995a7d53..a2d0b1fda5f6 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -2929,6 +2929,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/packages,\
NoRawFormatException \
WrongPasswordException \
XDataSinkEncrSupport \
+ XPackageEncryption \
))
$(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/packages/manifest,\
XManifestReader \
diff --git a/offapi/com/sun/star/packages/XPackageEncryption.idl b/offapi/com/sun/star/packages/XPackageEncryption.idl
new file mode 100644
index 000000000000..298a089af6c7
--- /dev/null
+++ b/offapi/com/sun/star/packages/XPackageEncryption.idl
@@ -0,0 +1,84 @@
+/* -*- 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 __com_sun_star_packages_XPackageEncryption_idl__
+#define __com_sun_star_packages_XPackageEncryption_idl__
+
+#include <com/sun/star/uno/XInterface.idl>
+
+#include <com/sun/star/io/XInputStream.idl>
+#include <com/sun/star/io/XOutputStream.idl>
+
+
+module com { module sun { module star { module packages {
+
+
+/**
+ TODO
+ */
+interface XPackageEncryption: com::sun::star::uno::XInterface
+{
+ /**
+ TODO
+ */
+ boolean readEncryptionInfo([in] sequence < com::sun::star::beans::NamedValue > rOleStreams);
+
+ /**
+ TODO
+ */
+ boolean generateEncryptionKey([in] string rPassword);
+
+ /**
+ TODO
+ */
+ boolean decrypt([in] com::sun::star::io::XInputStream rxInputStream,
+ [out] com::sun::star::io::XOutputStream rxOutputStream);
+
+ /**
+ TODO
+ */
+ sequence<com::sun::star::beans::NamedValue> writeEncryptionInfo();
+
+ /**
+ TODO
+ */
+ sequence<com::sun::star::beans::NamedValue> createEncryptionData([in] string rPassword);
+
+ /**
+ TODO
+ */
+ boolean setupEncryption([in] sequence<com::sun::star::beans::NamedValue> rMediaEncData);
+
+ /**
+ TODO
+ */
+ void encrypt([in] com::sun::star::io::XInputStream rxInputStream,
+ [out] com::sun::star::io::XOutputStream rxOutputStream);
+
+ /**
+ TODO
+ */
+ boolean checkDataIntegrity();
+};
+
+
+}; }; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/oox/source/crypto/AgileEngine.cxx b/oox/source/crypto/AgileEngine.cxx
index c3bd6e16378d..35104903d918 100644
--- a/oox/source/crypto/AgileEngine.cxx
+++ b/oox/source/crypto/AgileEngine.cxx
@@ -30,6 +30,7 @@
#include <com/sun/star/io/XSeekable.hpp>
#include <com/sun/star/io/XStream.hpp>
#include <com/sun/star/io/SequenceInputStream.hpp>
+#include <com/sun/star/io/XSequenceOutputStream.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/xml/sax/XFastParser.hpp>
#include <com/sun/star/xml/sax/XFastTokenHandler.hpp>
@@ -47,6 +48,14 @@ using namespace css::xml;
namespace oox {
namespace core {
+extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface*
+ com_sun_star_comp_oox_crypto_Agile_get_implementation(
+ XComponentContext* pCtx, Sequence<Any> const& /*arguments*/)
+{
+ return cppu::acquire(new AgileEngine(pCtx/*, arguments*/));
+}
+
+
namespace {
OUString stripNamespacePrefix(OUString const & rsInputName)
@@ -350,7 +359,7 @@ void AgileEngine::decryptEncryptionKey(OUString const & rPassword)
}
// TODO: Rename
-bool AgileEngine::generateEncryptionKey(OUString const & rPassword)
+sal_Bool AgileEngine::generateEncryptionKey(OUString const & rPassword)
{
bool bResult = decryptAndCheckVerifierHash(rPassword);
@@ -414,7 +423,7 @@ bool AgileEngine::decryptHmacValue()
return true;
}
-bool AgileEngine::checkDataIntegrity()
+sal_Bool AgileEngine::checkDataIntegrity()
{
bool bResult = (mInfo.hmacHash.size() == mInfo.hmacCalculatedHash.size() &&
std::equal(mInfo.hmacHash.begin(), mInfo.hmacHash.end(), mInfo.hmacCalculatedHash.begin()));
@@ -422,11 +431,14 @@ bool AgileEngine::checkDataIntegrity()
return bResult;
}
-bool AgileEngine::decrypt(BinaryXInputStream& aInputStream,
- BinaryXOutputStream& aOutputStream)
+sal_Bool AgileEngine::decrypt(const css::uno::Reference<css::io::XInputStream>& rxInputStream,
+ css::uno::Reference<css::io::XOutputStream>& rxOutputStream)
{
CryptoHash aCryptoHash(mInfo.hmacKey, cryptoHashTypeFromString(mInfo.hashAlgorithm));
+ BinaryXInputStream aInputStream(rxInputStream, true);
+ BinaryXOutputStream aOutputStream(rxOutputStream, true);
+
sal_uInt32 totalSize = aInputStream.readuInt32(); // Document unencrypted size - 4 bytes
// account for size in HMAC
std::vector<sal_uInt8> aSizeBytes(sizeof(sal_uInt32));
@@ -484,10 +496,12 @@ bool AgileEngine::decrypt(BinaryXInputStream& aInputStream,
mInfo.hmacCalculatedHash = aCryptoHash.finalize();
+ rxOutputStream->flush();
+
return true;
}
-uno::Reference<io::XInputStream> AgileEngine::getStream(Sequence<NamedValue> & rStreams, const OUString sStreamName)
+uno::Reference<io::XInputStream> AgileEngine::getStream(const Sequence<NamedValue> & rStreams, const OUString sStreamName)
{
for (const auto & aStream : rStreams)
{
@@ -502,7 +516,7 @@ uno::Reference<io::XInputStream> AgileEngine::getStream(Sequence<NamedValue> & r
return nullptr;
}
-bool AgileEngine::readEncryptionInfo(Sequence<NamedValue> aStreams)
+sal_Bool AgileEngine::readEncryptionInfo(const Sequence<NamedValue>& aStreams)
{
uno::Reference<io::XInputStream> xEncryptionInfo = getStream(aStreams, "EncryptionInfo");
@@ -682,7 +696,7 @@ bool AgileEngine::encryptEncryptionKey(OUString const & rPassword)
return true;
}
-bool AgileEngine::setupEncryption(css::uno::Sequence<css::beans::NamedValue>& rMediaEncData)
+sal_Bool AgileEngine::setupEncryption(const css::uno::Sequence<css::beans::NamedValue>& rMediaEncData)
{
if (meEncryptionPreset == AgileEncryptionPreset::AES_128_SHA1)
setupEncryptionParameters({ 100000, 16, 128, 20, 16, OUString("AES"), OUString("ChainingModeCBC"), OUString("SHA1") });
@@ -692,7 +706,7 @@ bool AgileEngine::setupEncryption(css::uno::Sequence<css::beans::NamedValue>& rM
OUString sPassword;
for (int i = 0; i < rMediaEncData.getLength(); i++)
{
- if (rMediaEncData[i].Name == "Password")
+ if (rMediaEncData[i].Name == "OOXPassword")
{
OUString sCryptoType;
rMediaEncData[i].Value >>= sPassword;
@@ -702,9 +716,13 @@ bool AgileEngine::setupEncryption(css::uno::Sequence<css::beans::NamedValue>& rM
return setupEncryptionKey(sPassword);
}
-void AgileEngine::createEncryptionData(comphelper::SequenceAsHashMap & aEncryptionData, const OUString rPassword)
+uno::Sequence<beans::NamedValue> AgileEngine::createEncryptionData(const OUString & rPassword)
{
+ comphelper::SequenceAsHashMap aEncryptionData;
aEncryptionData["OOXPassword"] <<= rPassword;
+ aEncryptionData["CryptoType"] <<= OUString("AgileEngine");
+
+ return aEncryptionData.getAsConstNamedValueList();
}
void AgileEngine::setupEncryptionParameters(AgileEncryptionParameters const & rAgileEncryptionParameters)
@@ -738,10 +756,12 @@ bool AgileEngine::setupEncryptionKey(OUString const & rPassword)
return true;
}
-void AgileEngine::writeEncryptionInfo(oox::ole::OleStorage& rOleStorage)
+css::uno::Sequence<css::beans::NamedValue> AgileEngine::writeEncryptionInfo()
{
- Reference<XOutputStream> xEncryptionInfo(rOleStorage.openOutputStream("EncryptionInfo"), UNO_SET_THROW);
- BinaryXOutputStream rStream(xEncryptionInfo, false);
+ Reference<XOutputStream> aEncryptionInfoStream(
+ mxContext->getServiceManager()->createInstanceWithContext("com.sun.star.io.SequenceOutputStream", mxContext),
+ UNO_QUERY);
+ BinaryXOutputStream rStream(aEncryptionInfoStream, false);
rStream.WriteUInt32(msfilter::VERSION_INFO_AGILE);
rStream.WriteUInt32(msfilter::AGILE_ENCRYPTION_RESERVED);
@@ -798,21 +818,28 @@ void AgileEngine::writeEncryptionInfo(oox::ole::OleStorage& rOleStorage)
rStream.writeMemory(aMemStream.GetData(), aMemStream.GetSize());
rStream.close();
- xEncryptionInfo->flush();
- xEncryptionInfo->closeOutput();
+ aEncryptionInfoStream->flush();
+
+ // Store all streams into sequence and return back
+ comphelper::SequenceAsHashMap aStreams;
+
+ Reference<XSequenceOutputStream> aEncryptionInfoSequenceStream(aEncryptionInfoStream, UNO_QUERY);
+ aStreams["EncryptionInfo"] <<= aEncryptionInfoSequenceStream->getWrittenBytes();
+ return aStreams.getAsConstNamedValueList();
}
-void AgileEngine::encrypt(css::uno::Reference<css::io::XInputStream> & rxInputStream,
- css::uno::Reference<css::io::XOutputStream> & rxOutputStream,
- sal_uInt32 nSize)
+void AgileEngine::encrypt(const css::uno::Reference<css::io::XInputStream> & rxInputStream,
+ css::uno::Reference<css::io::XOutputStream> & rxOutputStream)
{
CryptoHash aCryptoHash(mInfo.hmacKey, cryptoHashTypeFromString(mInfo.hashAlgorithm));
BinaryXOutputStream aBinaryOutputStream(rxOutputStream, false);
BinaryXInputStream aBinaryInputStream(rxInputStream, false);
+ Reference<XSeekable> xSeekable(rxInputStream, UNO_QUERY);
+ sal_uInt32 nLength = xSeekable->getLength();
std::vector<sal_uInt8> aSizeBytes(sizeof(sal_uInt32));
- ByteOrderConverter::writeLittleEndian(aSizeBytes.data(), nSize);
+ ByteOrderConverter::writeLittleEndian(aSizeBytes.data(), nLength);
aBinaryOutputStream.writeMemory(aSizeBytes.data(), aSizeBytes.size()); // size
aCryptoHash.update(aSizeBytes, aSizeBytes.size());
diff --git a/oox/source/crypto/DocumentDecryption.cxx b/oox/source/crypto/DocumentDecryption.cxx
index 7d9427a5bb41..ea3ed1123532 100644
--- a/oox/source/crypto/DocumentDecryption.cxx
+++ b/oox/source/crypto/DocumentDecryption.cxx
@@ -14,14 +14,12 @@
#include <cppuhelper/implbase.hxx>
#include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/io/XSeekable.hpp>
#include <com/sun/star/io/XStream.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
-#include <oox/crypto/AgileEngine.hxx>
-#include <oox/crypto/Standard2007Engine.hxx>
-#include <oox/crypto/IRMEngine.hxx>
-#include <oox/helper/binaryinputstream.hxx>
-#include <oox/helper/binaryoutputstream.hxx>
+#include <com/sun/star/packages/XPackageEncryption.hpp>
#include <oox/ole/olestorage.hxx>
+#include <filter/msfilter/mscodec.hxx>
namespace {
@@ -81,8 +79,8 @@ DocumentDecryption::DocumentDecryption(const css::uno::Reference< css::uno::XCom
bool DocumentDecryption::generateEncryptionKey(const OUString& rPassword)
{
- if (mEngine)
- return mEngine->generateEncryptionKey(rPassword);
+ if (mxPackageEncryption.is())
+ return mxPackageEncryption->generateEncryptionKey(rPassword);
return false;
}
@@ -93,16 +91,20 @@ void DocumentDecryption::readStrongEncryptionInfo()
BinaryXInputStream aBinaryInputStream(xEncryptionInfo, true);
sal_uInt32 aVersion = aBinaryInputStream.readuInt32();
+ uno::Sequence< uno::Any > aArguments;
+
switch (aVersion)
{
case msfilter::VERSION_INFO_2007_FORMAT:
case msfilter::VERSION_INFO_2007_FORMAT_SP2:
- msEngineName = "Standard"; // Set encryption info format
- mEngine.reset(new Standard2007Engine(mxContext));
+ mxPackageEncryption.set(
+ mxContext->getServiceManager()->createInstanceWithArgumentsAndContext(
+ "com.sun.star.comp.oox.crypto.Standard2007Engine", aArguments, mxContext), css::uno::UNO_QUERY);
break;
case msfilter::VERSION_INFO_AGILE:
- msEngineName = "Agile"; // Set encryption info format
- mEngine.reset(new AgileEngine(mxContext));
+ mxPackageEncryption.set(
+ mxContext->getServiceManager()->createInstanceWithArgumentsAndContext(
+ "com.sun.star.comp.oox.crypto.AgileEngine", aArguments, mxContext), css::uno::UNO_QUERY);
break;
default:
break;
@@ -146,23 +148,15 @@ bool DocumentDecryption::readEncryptionInfo()
aDataSpaceStream.skip((4 - (aDataSpaceNameLength & 3)) & 3); // Skip padding
}
- if (sDataSpaceName == "DRMEncryptedDataSpace")
- {
- msEngineName = "IRM"; // Set encryption info format
- mEngine.reset(new IRMEngine(mxContext));
- }
- else if (sDataSpaceName == "\011DRMDataSpace") // 0x09DRMDataSpace
- {
- // TODO: IRM binary file
- }
- else if (sDataSpaceName == "StrongEncryptionDataSpace")
+ uno::Sequence< uno::Any > aArguments;
+ mxPackageEncryption.set(
+ mxContext->getServiceManager()->createInstanceWithArgumentsAndContext(
+ "com.sun.star.comp.oox.crypto." + sDataSpaceName, aArguments, mxContext), css::uno::UNO_QUERY);
+
+ if (!mxPackageEncryption.is() && sDataSpaceName == "StrongEncryptionDataSpace")
{
readStrongEncryptionInfo();
}
- else
- {
- SAL_WARN("oox", "Unknown dataspace - document will be not decrypted!");
- }
}
else
{
@@ -172,20 +166,21 @@ bool DocumentDecryption::readEncryptionInfo()
readStrongEncryptionInfo();
}
- if (!mEngine)
+ if (!mxPackageEncryption.is())
+ {
+ // we do not know how to decrypt this document
return false;
+ }
- return mEngine->readEncryptionInfo(maStreamsSequence);
+ return mxPackageEncryption->readEncryptionInfo(maStreamsSequence);
}
uno::Sequence<beans::NamedValue> DocumentDecryption::createEncryptionData(const OUString& rPassword)
{
- comphelper::SequenceAsHashMap aEncryptionData;
+ if (!mxPackageEncryption.is())
+ return uno::Sequence<beans::NamedValue>();
- aEncryptionData["CryptoType"] <<= msEngineName;
- mEngine->createEncryptionData(aEncryptionData, rPassword);
-
- return aEncryptionData.getAsConstNamedValueList();
+ return mxPackageEncryption->createEncryptionData(rPassword);
}
bool DocumentDecryption::decrypt(const uno::Reference<io::XStream>& xDocumentStream)
@@ -195,21 +190,22 @@ bool DocumentDecryption::decrypt(const uno::Reference<io::XStream>& xDocumentStr
if (!mrOleStorage.isStorage())
return false;
+ if (!mxPackageEncryption.is())
+ return false;
+
// open the required input streams in the encrypted package
uno::Reference<io::XInputStream> xEncryptedPackage = mrOleStorage.openInputStream("EncryptedPackage");
// create temporary file for unencrypted package
uno::Reference<io::XOutputStream> xDecryptedPackage = xDocumentStream->getOutputStream();
- BinaryXOutputStream aDecryptedPackage(xDecryptedPackage, true);
- BinaryXInputStream aEncryptedPackage(xEncryptedPackage, true);
- bResult = mEngine->decrypt(aEncryptedPackage, aDecryptedPackage);
+ bResult = mxPackageEncryption->decrypt(xEncryptedPackage, xDecryptedPackage);
- xDecryptedPackage->flush();
- aDecryptedPackage.seekToStart();
+ css::uno::Reference<io::XSeekable> xSeekable(xDecryptedPackage, css::uno::UNO_QUERY);
+ xSeekable->seek(0);
if (bResult)
- return mEngine->checkDataIntegrity();
+ return mxPackageEncryption->checkDataIntegrity();
return bResult;
}
diff --git a/oox/source/crypto/DocumentEncryption.cxx b/oox/source/crypto/DocumentEncryption.cxx
index 8aac457c67d2..2dba0f035df5 100644
--- a/oox/source/crypto/DocumentEncryption.cxx
+++ b/oox/source/crypto/DocumentEncryption.cxx
@@ -9,16 +9,13 @@
*/
#include <oox/crypto/DocumentEncryption.hxx>
-#include <oox/crypto/Standard2007Engine.hxx>
-#include <oox/crypto/IRMEngine.hxx>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/io/XStream.hpp>
#include <com/sun/star/io/XSeekable.hpp>
+#include <com/sun/star/packages/XPackageEncryption.hpp>
-#include <oox/helper/binaryinputstream.hxx>
-#include <oox/helper/binaryoutputstream.hxx>
#include <oox/ole/olestorage.hxx>
namespace oox {
@@ -26,11 +23,12 @@ namespace core {
using namespace css::io;
using namespace css::uno;
+using namespace css::beans;
-DocumentEncryption::DocumentEncryption(const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+DocumentEncryption::DocumentEncryption(const Reference< XComponentContext >& rxContext,
Reference<XStream> const & xDocumentStream,
oox::ole::OleStorage& rOleStorage,
- Sequence<css::beans::NamedValue>& rMediaEncData)
+ Sequence<NamedValue>& rMediaEncData)
: mxContext(rxContext)
, mxDocumentStream(xDocumentStream)
, mrOleStorage(rOleStorage)
@@ -43,25 +41,28 @@ DocumentEncryption::DocumentEncryption(const css::uno::Reference< css::uno::XCom
{
OUString sCryptoType;
rMediaEncData[i].Value >>= sCryptoType;
- if (sCryptoType == "IRM")
- {
- mEngine.reset(new IRMEngine(mxContext));
- }
- else if (sCryptoType == "Standard" || sCryptoType == "Agile")
- {
- mEngine.reset(new Standard2007Engine(mxContext));
- }
- else
+
+ if (sCryptoType == "Standard")
+ sCryptoType = "Standard2007Engine";
+
+ Sequence<Any> aArguments;
+ mxPackageEncryption.set(
+ mxContext->getServiceManager()->createInstanceWithArgumentsAndContext(
+ "com.sun.star.comp.oox.crypto." + sCryptoType, aArguments, mxContext), css::uno::UNO_QUERY);
+
+ if (!mxPackageEncryption.is())
{
SAL_WARN("oox", "Requested encryption method \"" << sCryptoType << "\" is not supported");
}
+
+ break;
}
}
}
bool DocumentEncryption::encrypt()
{
- if (!mEngine)
+ if (!mxPackageEncryption.is())
return false;
Reference<XInputStream> xInputStream (mxDocumentStream->getInputStream(), UNO_SET_THROW);
@@ -70,20 +71,32 @@ bool DocumentEncryption::encrypt()
if (!xSeekable.is())
return false;
- sal_uInt32 aLength = xSeekable->getLength(); // check length of the stream
xSeekable->seek(0); // seek to begin of the document stream
if (!mrOleStorage.isStorage())
return false;
- mEngine->setupEncryption(mMediaEncData);
+ mxPackageEncryption->setupEncryption(mMediaEncData);
Reference<XOutputStream> xOutputStream(mrOleStorage.openOutputStream("EncryptedPackage"), UNO_SET_THROW);
- mEngine->encrypt(xInputStream, xOutputStream, aLength);
+ mxPackageEncryption->encrypt(xInputStream, xOutputStream);
xOutputStream->flush();
xOutputStream->closeOutput();
- mEngine->writeEncryptionInfo(mrOleStorage);
+ Sequence<NamedValue> aStreams = mxPackageEncryption->writeEncryptionInfo();
+
+ for (const NamedValue & aStream : aStreams)
+ {
+ Reference<XOutputStream> xOutputStream(mrOleStorage.openOutputStream(aStream.Name), UNO_SET_THROW);
+ BinaryXOutputStream aBinaryOutputStream(xOutputStream, true);
+
+ css::uno::Sequence<sal_Int8> aStreamSequence;
+ aStream.Value >>= aStreamSequence;
+
+ aBinaryOutputStream.writeData(aStreamSequence);
+
+ aBinaryOutputStream.close();
+ }
return true;
}
diff --git a/oox/source/crypto/IRMEngine.cxx b/oox/source/crypto/IRMEngine.cxx
index 1301a3b51279..95135722ee08 100644
--- a/oox/source/crypto/IRMEngine.cxx
+++ b/oox/source/crypto/IRMEngine.cxx
@@ -30,6 +30,7 @@
#include <com/sun/star/io/XSeekable.hpp>
#include <com/sun/star/io/XStream.hpp>
#include <com/sun/star/io/SequenceInputStream.hpp>
+#include <com/sun/star/io/XSequenceOutputStream.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/xml/sax/XFastParser.hpp>
#include <com/sun/star/xml/sax/XFastTokenHandler.hpp>
@@ -50,15 +51,26 @@ namespace oox
{
namespace core
{
+extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface*
+com_sun_star_comp_oox_crypto_DRMEncryptedDataSpace_get_implementation(
+ XComponentContext* pCtx, Sequence<Any> const& /*arguments*/)
+{
+ return cppu::acquire(new IRMEngine(pCtx /*, arguments*/));
+}
+
IRMEngine::IRMEngine(const Reference<XComponentContext>& rxContext)
: mxContext(rxContext)
{
}
-bool IRMEngine::checkDataIntegrity() { return true; }
+sal_Bool IRMEngine::checkDataIntegrity() { return true; }
-bool IRMEngine::decrypt(BinaryXInputStream& aInputStream, BinaryXOutputStream& aOutputStream)
+sal_Bool IRMEngine::decrypt(const Reference<XInputStream>& rxInputStream,
+ Reference<XOutputStream>& rxOutputStream)
{
+ BinaryXInputStream aInputStream(rxInputStream, true);
+ BinaryXOutputStream aOutputStream(rxOutputStream, true);
+
aInputStream.readInt64(); // Skip stream size
HRESULT hr = IpcInitialize();
@@ -66,6 +78,7 @@ bool IRMEngine::decrypt(BinaryXInputStream& aInputStream, BinaryXOutputStream& a
{
// ERROR_ALREADY_INITIALIZED not an error
// TODO: some reaction?
+ return false;
}
// Get decryption key
@@ -77,6 +90,7 @@ bool IRMEngine::decrypt(BinaryXInputStream& aInputStream, BinaryXOutputStream& a
if (FAILED(hr))
{
// TODO: some reaction?
+ return false;
}
// Read rights
@@ -85,6 +99,7 @@ bool IRMEngine::decrypt(BinaryXInputStream& aInputStream, BinaryXOutputStream& a
if (FAILED(hr))
{
// TODO: some reaction?
+ return false;
}
mInfo.bCanRead = value;
@@ -94,6 +109,7 @@ bool IRMEngine::decrypt(BinaryXInputStream& aInputStream, BinaryXOutputStream& a
if (FAILED(hr))
{
// TODO: some reaction?
+ return false;
}
char* pEncryptedBuffer = new char[*blockSize];
@@ -112,6 +128,7 @@ bool IRMEngine::decrypt(BinaryXInputStream& aInputStream, BinaryXOutputStream& a
if (FAILED(hr))
{
// TODO: some reaction?
+ return false;
}
aOutputStream.writeArray(pDecryptedBuffer, bytes);
@@ -122,22 +139,26 @@ bool IRMEngine::decrypt(BinaryXInputStream& aInputStream, BinaryXOutputStream& a
delete[] pEncryptedBuffer;
delete[] pDecryptedBuffer;
+ rxOutputStream->flush();
+
return true;
}
-void IRMEngine::createEncryptionData(comphelper::SequenceAsHashMap& aEncryptionData,
- const OUString rPassword)
+uno::Sequence<beans::NamedValue> IRMEngine::createEncryptionData(const OUString& /*rPassword*/)
{
- aEncryptionData["OOXPassword"] <<= rPassword;
-
css::uno::Sequence<sal_uInt8> seq;
seq.realloc(mInfo.license.getLength());
memcpy(seq.getArray(), mInfo.license.getStr(), mInfo.license.getLength());
- aEncryptionData["license"] <<= seq;
+ comphelper::SequenceAsHashMap aEncryptionData;
+ aEncryptionData["LicenseKey"] <<= seq;
+ aEncryptionData["CryptoType"] <<= OUString("DRMEncryptedDataSpace");
+ aEncryptionData["OOXPassword"] <<= OUString("1");
+
+ return aEncryptionData.getAsConstNamedValueList();
}
-uno::Reference<io::XInputStream> IRMEngine::getStream(Sequence<NamedValue>& rStreams,
+uno::Reference<io::XInputStream> IRMEngine::getStream(const Sequence<NamedValue>& rStreams,
const OUString sStreamName)
{
for (const auto& aStream : rStreams)
@@ -155,7 +176,7 @@ uno::Reference<io::XInputStream> IRMEngine::getStream(Sequence<NamedValue>& rStr
return nullptr;
}
-bool IRMEngine::readEncryptionInfo(uno::Sequence<beans::NamedValue> aStreams)
+sal_Bool IRMEngine::readEncryptionInfo(const uno::Sequence<beans::NamedValue>& aStreams)
{
// Read TransformInfo storage for IRM ECMA documents (MS-OFFCRYPTO 2.2.4)
uno::Reference<io::XInputStream> xTransformInfoStream
@@ -198,11 +219,11 @@ bool IRMEngine::readEncryptionInfo(uno::Sequence<beans::NamedValue> aStreams)
return true;
}
-bool IRMEngine::setupEncryption(css::uno::Sequence<css::beans::NamedValue>& rMediaEncData)
+sal_Bool IRMEngine::setupEncryption(const Sequence<NamedValue>& rMediaEncData)
{
for (int i = 0; i < rMediaEncData.getLength(); i++)
{
- if (rMediaEncData[i].Name == "license")
+ if (rMediaEncData[i].Name == "LicenseKey")
{
css::uno::Sequence<sal_uInt8> seq;
rMediaEncData[i].Value >>= seq;
@@ -213,11 +234,13 @@ bool IRMEngine::setupEncryption(css::uno::Sequence<css::beans::NamedValue>& rMed
return true;
}
-void IRMEngine::writeEncryptionInfo(oox::ole::OleStorage& rOleStorage)
+Sequence<NamedValue> IRMEngine::writeEncryptionInfo()
{
// Write 0x6DataSpaces/DataSpaceMap
Reference<XOutputStream> xDataSpaceMap(
- rOleStorage.openOutputStream("\006DataSpaces/DataSpaceMap"), UNO_SET_THROW);
+ mxContext->getServiceManager()->createInstanceWithContext(
+ "com.sun.star.io.SequenceOutputStream", mxContext),
+ UNO_QUERY);
BinaryXOutputStream aDataSpaceMapStream(xDataSpaceMap, false);
aDataSpaceMapStream.WriteInt32(8); // Header length
@@ -227,42 +250,37 @@ void IRMEngine::writeEncryptionInfo(oox::ole::OleStorage& rOleStorage)
OUString sDataSpaceName("DRMEncryptedDataSpace");
OUString sReferenceComponent("EncryptedPackage");
- aDataSpaceMapStream.WriteInt32(0x58); // Length
+ aDataSpaceMapStream.WriteInt32(0x60); // Length
aDataSpaceMapStream.WriteInt32(1); // References count
aDataSpaceMapStream.WriteInt32(0); // References component type
aDataSpaceMapStream.WriteInt32(sReferenceComponent.getLength() * 2);
aDataSpaceMapStream.writeUnicodeArray(sReferenceComponent);
- while (aDataSpaceMapStream.tell() % 4) // Padding
+ for (int i = 0; i < sReferenceComponent.getLength() * 2 % 4; i++) // Padding
{
aDataSpaceMapStream.writeValue<sal_Char>(0);
}
aDataSpaceMapStream.WriteInt32(sDataSpaceName.getLength() * 2);
aDataSpaceMapStream.writeUnicodeArray(sDataSpaceName);
- while (aDataSpaceMapStream.tell() % 4) // Padding
+ for (int i = 0; i < sDataSpaceName.getLength() * 2 % 4; i++) // Padding
{
aDataSpaceMapStream.writeValue<sal_Char>(0);
}
- // Write length
- sal_uInt32 nLength = aDataSpaceMapStream.tell() - 8;
- aDataSpaceMapStream.seek(8);
- aDataSpaceMapStream.WriteInt32(nLength);
-
aDataSpaceMapStream.close();
xDataSpaceMap->flush();
- xDataSpaceMap->closeOutput();
// Write 0x6DataSpaces/Version
- Reference<XOutputStream> xVersion(rOleStorage.openOutputStream("\006DataSpaces/Version"),
- UNO_SET_THROW);
+ Reference<XOutputStream> xVersion(mxContext->getServiceManager()->createInstanceWithContext(
+ "com.sun.star.io.SequenceOutputStream", mxContext),
+ UNO_QUERY);
BinaryXOutputStream aVersionStream(xVersion, false);
OUString sFeatureIdentifier("Microsoft.Container.DataSpaces");
aVersionStream.WriteInt32(sFeatureIdentifier.getLength() * 2);
aVersionStream.writeUnicodeArray(sFeatureIdentifier);
- while (aVersionStream.tell() % 4) // Padding
+ for (int i = 0; i < sFeatureIdentifier.getLength() * 2 % 4; i++) // Padding
{
aVersionStream.writeValue<sal_Char>(0);
}
@@ -273,59 +291,55 @@ void IRMEngine::writeEncryptionInfo(oox::ole::OleStorage& rOleStorage)
aVersionStream.close();
xVersion->flush();
- xVersion->closeOutput();
// Write 0x6DataSpaces/DataSpaceInfo/[dataspacename]
- OUString sStreamName = "\006DataSpaces/DataSpaceInfo/" + sDataSpaceName;
- Reference<XOutputStream> xDataSpaceInfo(rOleStorage.openOutputStream(sStreamName),
- UNO_SET_THROW);
+ Reference<XOutputStream> xDataSpaceInfo(
+ mxContext->getServiceManager()->createInstanceWithContext(
+ "com.sun.star.io.SequenceOutputStream", mxContext),
+ UNO_QUERY);
BinaryXOutputStream aDataSpaceInfoStream(xDataSpaceInfo, false);
- aDataSpaceInfoStream.WriteInt32(8); // Header length
+ aDataSpaceInfoStream.WriteInt32(0x08); // Header length
aDataSpaceInfoStream.WriteInt32(1); // Entries count
OUString sTransformName("DRMEncryptedTransform");
aDataSpaceInfoStream.WriteInt32(sTransformName.getLength() * 2);
aDataSpaceInfoStream.writeUnicodeArray(sTransformName);
- while (aDataSpaceInfoStream.tell() % 4) // Padding
+ for (int i = 0; i < sTransformName.getLength() * 2 % 4; i++) // Padding
{
aDataSpaceInfoStream.writeValue<sal_Char>(0);
}
aDataSpaceInfoStream.close();
xDataSpaceInfo->flush();
- xDataSpaceInfo->closeOutput();
// Write 0x6DataSpaces/TransformInfo/[transformname]
- sStreamName = "\006DataSpaces/TransformInfo/" + sTransformName + "/\006Primary";
- Reference<XOutputStream> xTransformInfo(rOleStorage.openOutputStream(sStreamName),
- UNO_SET_THROW);
+ Reference<XOutputStream> xTransformInfo(
+ mxContext->getServiceManager()->createInstanceWithContext(
+ "com.sun.star.io.SequenceOutputStream", mxContext),
+ UNO_QUERY);
BinaryXOutputStream aTransformInfoStream(xTransformInfo, false);
+ OUString sTransformId("{C73DFACD-061F-43B0-8B64-0C620D2A8B50}");
// MS-OFFCRYPTO 2.1.8: TransformInfoHeader
- aTransformInfoStream.WriteInt32(0); // TransformLength, will be written later
+ sal_uInt32 nLength
+ = sTransformId.getLength() * 2 + ((4 - (sTransformId.getLength() & 3)) & 3) + 10;
+ aTransformInfoStream.WriteInt32(nLength); // TransformLength, will be written later
aTransformInfoStream.WriteInt32(1); // TransformType
// TransformId
- OUString sTransformId("{C73DFACD-061F-43B0-8B64-0C620D2A8B50}");
aTransformInfoStream.WriteInt32(sTransformId.getLength() * 2);
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list