[Libreoffice-commits] .: 100 commits - basctl/inc basctl/source cui/source extensions/prj extensions/source forms/source package/inc package/qa package/source setup_native/prj setup_native/source wizards/com xmlsecurity/inc xmlsecurity/prj xmlsecurity/qa xmlsecurity/source xmlsecurity/test_docs xmlsecurity/util
Jan Holesovsky
kendy at kemper.freedesktop.org
Fri May 27 12:15:29 PDT 2011
basctl/inc/basidesh.hrc | 1
basctl/source/basicide/baside2.hxx | 1
basctl/source/basicide/baside2b.cxx | 19
basctl/source/basicide/basidesh.src | 5
cui/source/customize/macropg.cxx | 2
extensions/prj/build.lst | 3
extensions/source/ole/oleobjw.cxx | 11
extensions/source/ole/oleobjw.hxx | 4
extensions/source/propctrlr/eventhandler.cxx | 3
extensions/source/svg/makefile.mk | 67
extensions/source/svg/svgaction.cxx | 1461 ----------
extensions/source/svg/svgaction.hxx | 167 -
extensions/source/svg/svgcom.hxx | 76
extensions/source/svg/svgprinter.cxx | 331 --
extensions/source/svg/svgprinter.hxx | 70
extensions/source/svg/svguno.cxx | 101
extensions/source/svg/svgwriter.cxx | 174 -
extensions/source/svg/svgwriter.hxx | 63
forms/source/component/Columns.cxx | 9
forms/source/component/DatabaseForm.cxx | 2
forms/source/component/Edit.cxx | 58
forms/source/component/Edit.hxx | 1
forms/source/component/Filter.cxx | 34
forms/source/component/FormattedField.cxx | 4
package/inc/EncryptedDataHeader.hxx | 32
package/inc/EncryptionData.hxx | 52
package/inc/PackageConstants.hxx | 36
package/inc/ZipFile.hxx | 52
package/inc/ZipOutputStream.hxx | 33
package/inc/ZipPackage.hxx | 44
package/inc/ZipPackageEntry.hxx | 106
package/inc/ZipPackageFolder.hxx | 4
package/inc/ZipPackageStream.hxx | 218 +
package/qa/storages/TestHelper.java | 16
package/source/manifest/Base64Codec.cxx | 8
package/source/manifest/Base64Codec.hxx | 4
package/source/manifest/ManifestDefines.hxx | 21
package/source/manifest/ManifestExport.cxx | 285 +
package/source/manifest/ManifestImport.cxx | 169 -
package/source/manifest/ManifestImport.hxx | 28
package/source/manifest/UnoRegister.cxx | 5
package/source/xstor/owriteablestream.cxx | 188 -
package/source/xstor/xstorage.cxx | 212 +
package/source/xstor/xstorage.hxx | 11
package/source/zipapi/Deflater.cxx | 8
package/source/zipapi/EntryInputStream.cxx | 205 -
package/source/zipapi/EntryInputStream.hxx | 85
package/source/zipapi/Inflater.cxx | 4
package/source/zipapi/MemoryByteGrabber.hxx | 2
package/source/zipapi/XFileStream.cxx | 230 -
package/source/zipapi/XFileStream.hxx | 95
package/source/zipapi/XMemoryStream.cxx | 55
package/source/zipapi/XMemoryStream.hxx | 45
package/source/zipapi/XUnbufferedStream.cxx | 100
package/source/zipapi/XUnbufferedStream.hxx | 17
package/source/zipapi/ZipFile.cxx | 512 +--
package/source/zipapi/ZipOutputStream.cxx | 124
package/source/zipapi/blowfishcontext.cxx | 122
package/source/zipapi/blowfishcontext.hxx | 58
package/source/zipapi/makefile.mk | 2
package/source/zipapi/sha1context.cxx | 97
package/source/zipapi/sha1context.hxx | 59
package/source/zippackage/ZipPackage.cxx | 575 ++-
package/source/zippackage/ZipPackageEntry.cxx | 24
package/source/zippackage/ZipPackageEntry.hxx | 106
package/source/zippackage/ZipPackageFolder.cxx | 197 -
package/source/zippackage/ZipPackageStream.cxx | 406 +-
package/source/zippackage/ZipPackageStream.hxx | 196 -
package/source/zippackage/zipfileaccess.cxx | 5
setup_native/prj/build.lst | 1
setup_native/source/packinfo/shellscripts_extensions.txt | 24
setup_native/source/win32/customactions/rebase/rebase.cxx | 85
setup_native/source/win32/customactions/relnotes/exports.dxp | 3
setup_native/source/win32/customactions/relnotes/makefile.mk | 76
setup_native/source/win32/customactions/relnotes/relnotes.cxx | 188 -
setup_native/source/win32/customactions/shellextensions/registerextensions.cxx | 23
setup_native/source/win32/msi-encodinglist.txt | 2
wizards/com/sun/star/wizards/agenda/AgendaTemplate.java | 135
wizards/com/sun/star/wizards/agenda/AgendaWizardDialog.java | 112
wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.java | 31
wizards/com/sun/star/wizards/agenda/CGAgenda.java | 5
wizards/com/sun/star/wizards/agenda/CGTopic.java | 3
wizards/com/sun/star/wizards/agenda/CallWizard.java | 5
wizards/com/sun/star/wizards/agenda/TopicsControl.java | 52
wizards/com/sun/star/wizards/common/ConfigSet.java | 4
wizards/com/sun/star/wizards/common/Configuration.java | 45
wizards/com/sun/star/wizards/common/Desktop.java | 80
wizards/com/sun/star/wizards/common/FileAccess.java | 180 -
wizards/com/sun/star/wizards/common/HelpIds.java | 726 ++--
wizards/com/sun/star/wizards/common/Helper.java | 49
wizards/com/sun/star/wizards/common/JavaTools.java | 59
wizards/com/sun/star/wizards/common/NamedValueCollection.java | 2
wizards/com/sun/star/wizards/common/NumberFormatter.java | 14
wizards/com/sun/star/wizards/common/NumericalHelper.java | 45
wizards/com/sun/star/wizards/common/PropertyNames.java | 19
wizards/com/sun/star/wizards/common/PropertySetHelper.java | 6
wizards/com/sun/star/wizards/common/Resource.java | 8
wizards/com/sun/star/wizards/common/SystemDialog.java | 35
wizards/com/sun/star/wizards/common/UCB.java | 24
wizards/com/sun/star/wizards/common/XMLHelper.java | 2
wizards/com/sun/star/wizards/db/BlindtextCreator.java | 10
wizards/com/sun/star/wizards/db/ColumnPropertySet.java | 8
wizards/com/sun/star/wizards/db/CommandMetaData.java | 938 +++---
wizards/com/sun/star/wizards/db/CommandName.java | 45
wizards/com/sun/star/wizards/db/DBMetaData.java | 93
wizards/com/sun/star/wizards/db/FieldColumn.java | 39
wizards/com/sun/star/wizards/db/QueryMetaData.java | 33
wizards/com/sun/star/wizards/db/RecordParser.java | 23
wizards/com/sun/star/wizards/db/RelationController.java | 7
wizards/com/sun/star/wizards/db/SQLQueryComposer.java | 161 -
wizards/com/sun/star/wizards/db/TableDescriptor.java | 42
wizards/com/sun/star/wizards/db/TypeInspector.java | 34
wizards/com/sun/star/wizards/document/Control.java | 12
wizards/com/sun/star/wizards/document/DatabaseControl.java | 12
wizards/com/sun/star/wizards/document/FormHandler.java | 137
wizards/com/sun/star/wizards/document/GridControl.java | 2
wizards/com/sun/star/wizards/document/OfficeDocument.java | 72
wizards/com/sun/star/wizards/document/Shape.java | 10
wizards/com/sun/star/wizards/document/TimeStampControl.java | 11
wizards/com/sun/star/wizards/fax/CallWizard.java | 5
wizards/com/sun/star/wizards/fax/FaxDocument.java | 27
wizards/com/sun/star/wizards/fax/FaxWizardDialog.java | 128
wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.java | 79
wizards/com/sun/star/wizards/form/CallFormWizard.java | 5
wizards/com/sun/star/wizards/form/DataEntrySetter.java | 26
wizards/com/sun/star/wizards/form/FieldLinker.java | 81
wizards/com/sun/star/wizards/form/Finalizer.java | 12
wizards/com/sun/star/wizards/form/FormConfiguration.java | 28
wizards/com/sun/star/wizards/form/FormControlArranger.java | 395 +-
wizards/com/sun/star/wizards/form/FormDocument.java | 40
wizards/com/sun/star/wizards/form/FormWizard.java | 72
wizards/com/sun/star/wizards/form/StyleApplier.java | 46
wizards/com/sun/star/wizards/form/UIControlArranger.java | 51
wizards/com/sun/star/wizards/letter/CallWizard.java | 5
wizards/com/sun/star/wizards/letter/LetterDocument.java | 43
wizards/com/sun/star/wizards/letter/LetterWizardDialog.java | 184 -
wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java | 139
wizards/com/sun/star/wizards/query/CallQueryWizard.java | 12
wizards/com/sun/star/wizards/query/Finalizer.java | 25
wizards/com/sun/star/wizards/query/QuerySummary.java | 81
wizards/com/sun/star/wizards/query/QueryWizard.java | 88
wizards/com/sun/star/wizards/report/CallReportWizard.java | 22
wizards/com/sun/star/wizards/report/DBColumn.java | 30
wizards/com/sun/star/wizards/report/Dataimport.java | 35
wizards/com/sun/star/wizards/report/GroupFieldHandler.java | 12
wizards/com/sun/star/wizards/report/IReportBuilderLayouter.java | 8
wizards/com/sun/star/wizards/report/RecordTable.java | 12
wizards/com/sun/star/wizards/report/ReportFinalizer.java | 36
wizards/com/sun/star/wizards/report/ReportLayouter.java | 40
wizards/com/sun/star/wizards/report/ReportTextDocument.java | 190 -
wizards/com/sun/star/wizards/report/ReportTextImplementation.java | 75
wizards/com/sun/star/wizards/report/ReportWizard.java | 87
wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java | 119
wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarSingleColumn.java | 6
wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarThreeColumns.java | 3
wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarTwoColumns.java | 6
wizards/com/sun/star/wizards/reportbuilder/layout/DesignTemplate.java | 17
wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsAbove.java | 6
wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsLeft.java | 6
wizards/com/sun/star/wizards/reportbuilder/layout/ReportBuilderLayouter.java | 372 +-
wizards/com/sun/star/wizards/reportbuilder/layout/SectionEmptyObject.java | 3
wizards/com/sun/star/wizards/reportbuilder/layout/SectionLabel.java | 3
wizards/com/sun/star/wizards/reportbuilder/layout/SectionObject.java | 6
wizards/com/sun/star/wizards/reportbuilder/layout/SectionTextField.java | 3
wizards/com/sun/star/wizards/reportbuilder/layout/Tabular.java | 44
wizards/com/sun/star/wizards/table/CGCategory.java | 5
wizards/com/sun/star/wizards/table/CallTableWizard.java | 9
wizards/com/sun/star/wizards/table/FieldDescription.java | 14
wizards/com/sun/star/wizards/table/FieldFormatter.java | 83
wizards/com/sun/star/wizards/table/Finalizer.java | 42
wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java | 50
wizards/com/sun/star/wizards/table/ScenarioSelector.java | 32
wizards/com/sun/star/wizards/table/TableWizard.java | 20
wizards/com/sun/star/wizards/text/TextDocument.java | 102
wizards/com/sun/star/wizards/text/TextFieldHandler.java | 39
wizards/com/sun/star/wizards/text/TextFrameHandler.java | 5
wizards/com/sun/star/wizards/text/TextSectionHandler.java | 37
wizards/com/sun/star/wizards/text/TextStyleHandler.java | 15
wizards/com/sun/star/wizards/text/TextTableHandler.java | 29
wizards/com/sun/star/wizards/text/ViewHandler.java | 18
wizards/com/sun/star/wizards/ui/AggregateComponent.java | 47
wizards/com/sun/star/wizards/ui/ButtonList.java | 38
wizards/com/sun/star/wizards/ui/CommandFieldSelection.java | 52
wizards/com/sun/star/wizards/ui/ControlScroller.java | 30
wizards/com/sun/star/wizards/ui/DBLimitedFieldSelection.java | 18
wizards/com/sun/star/wizards/ui/DocumentPreview.java | 17
wizards/com/sun/star/wizards/ui/FieldSelection.java | 58
wizards/com/sun/star/wizards/ui/FilterComponent.java | 131
wizards/com/sun/star/wizards/ui/ImageList.java | 42
wizards/com/sun/star/wizards/ui/PathSelection.java | 14
wizards/com/sun/star/wizards/ui/PeerConfig.java | 10
wizards/com/sun/star/wizards/ui/SortingComponent.java | 59
wizards/com/sun/star/wizards/ui/TitlesComponent.java | 8
wizards/com/sun/star/wizards/ui/UIConsts.java | 16
wizards/com/sun/star/wizards/ui/UnoDialog.java | 195 -
wizards/com/sun/star/wizards/ui/UnoDialog2.java | 24
wizards/com/sun/star/wizards/ui/WizardDialog.java | 53
wizards/com/sun/star/wizards/ui/event/AbstractListener.java | 2
wizards/com/sun/star/wizards/ui/event/DataAware.java | 6
wizards/com/sun/star/wizards/ui/event/DataAwareFields.java | 14
wizards/com/sun/star/wizards/ui/event/ListModelBinder.java | 19
wizards/com/sun/star/wizards/ui/event/MethodInvocation.java | 7
wizards/com/sun/star/wizards/ui/event/RadioDataAware.java | 4
wizards/com/sun/star/wizards/ui/event/SimpleDataAware.java | 2
wizards/com/sun/star/wizards/ui/event/UnoDataAware.java | 20
wizards/com/sun/star/wizards/web/BackgroundsDialog.java | 5
wizards/com/sun/star/wizards/web/CallWizard.java | 7
wizards/com/sun/star/wizards/web/FTPDialog.java | 69
wizards/com/sun/star/wizards/web/IconsDialog.java | 5
wizards/com/sun/star/wizards/web/ImageListDialog.java | 22
wizards/com/sun/star/wizards/web/LogTaskListener.java | 3
wizards/com/sun/star/wizards/web/Process.java | 19
wizards/com/sun/star/wizards/web/StatusDialog.java | 14
wizards/com/sun/star/wizards/web/StylePreview.java | 5
wizards/com/sun/star/wizards/web/TOCPreview.java | 5
wizards/com/sun/star/wizards/web/WWD_Events.java | 50
wizards/com/sun/star/wizards/web/WWD_General.java | 6
wizards/com/sun/star/wizards/web/WWD_Startup.java | 28
wizards/com/sun/star/wizards/web/WebWizardDialog.java | 204 -
wizards/com/sun/star/wizards/web/data/CGDesign.java | 2
wizards/com/sun/star/wizards/web/data/CGDocument.java | 80
wizards/com/sun/star/wizards/web/data/CGExporter.java | 5
wizards/com/sun/star/wizards/web/data/CGPublish.java | 5
wizards/com/sun/star/wizards/web/data/CGSettings.java | 10
wizards/com/sun/star/wizards/web/data/CGStyle.java | 4
wizards/com/sun/star/wizards/web/export/AbstractExporter.java | 6
wizards/com/sun/star/wizards/web/export/ImpressHTMLExporter.java | 6
xmlsecurity/inc/xmlsecurity/digitalsignaturesdialog.hxx | 4
xmlsecurity/inc/xmlsecurity/xmlsignaturehelper.hxx | 7
xmlsecurity/prj/build.lst | 3
xmlsecurity/qa/certext/SanCertExt.cxx | 281 +
xmlsecurity/qa/certext/User_35_Root_11.crt | 64
xmlsecurity/qa/certext/export.map | 34
xmlsecurity/qa/certext/makefile.mk | 71
xmlsecurity/source/component/documentdigitalsignatures.cxx | 8
xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx | 4
xmlsecurity/source/helper/xmlsignaturehelper.cxx | 7
xmlsecurity/source/helper/xmlsignaturehelper2.cxx | 1
xmlsecurity/source/xmlsec/makefile.mk | 6
xmlsecurity/source/xmlsec/mscrypt/makefile.mk | 3
xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.cxx | 182 +
xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.hxx | 84
xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx | 3
xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx | 9
xmlsecurity/source/xmlsec/nss/ciphercontext.cxx | 276 +
xmlsecurity/source/xmlsec/nss/ciphercontext.hxx | 89
xmlsecurity/source/xmlsec/nss/digestcontext.cxx | 101
xmlsecurity/source/xmlsec/nss/digestcontext.hxx | 68
xmlsecurity/source/xmlsec/nss/makefile.mk | 27
xmlsecurity/source/xmlsec/nss/nssinitializer.cxx | 521 +++
xmlsecurity/source/xmlsec/nss/nssinitializer.hxx | 90
xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx | 244 +
xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.hxx | 77
xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx | 38
xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx | 365 --
xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.hxx | 74
xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx | 57
xmlsecurity/source/xmlsec/nss/xsec_nss.cxx | 34
xmlsecurity/source/xmlsec/xsec_xmlsec.cxx | 4
xmlsecurity/test_docs/CAs/Root_11/demoCA/index.txt | 1
xmlsecurity/test_docs/CAs/Root_11/demoCA/newcerts/1022.pem | 64
xmlsecurity/test_docs/CAs/Root_11/demoCA/serial | 2
xmlsecurity/test_docs/CAs/Root_11/openssl.cfg | 17
xmlsecurity/test_docs/certs/end_certs/User_35_Root_11.crt | 64
xmlsecurity/util/makefile.mk | 11
xmlsecurity/util/xsec_xmlsec.component | 1
xmlsecurity/util/xsec_xmlsec.windows.component | 3
267 files changed, 9336 insertions(+), 9574 deletions(-)
New commits:
commit bbf1ec8529d43218a4633cbc06908d795bdd22b1
Merge: 4ce1e4e... 121fae3...
Author: Jan Holesovsky <kendy at suse.cz>
Date: Fri May 27 20:49:27 2011 +0200
Merge branch 'master' of git://anongit.freedesktop.org/libreoffice/components
commit 4ce1e4e639490d620f3dcd8a5cf5bcbbc9c14bb2
Merge: 19ed365... 574d1f2...
Author: Jan Holesovsky <kendy at suse.cz>
Date: Fri May 27 20:39:30 2011 +0200
Merge remote-tracking branch 'origin/integration/dev300_m106'
Conflicts:
extensions/source/svg/svgaction.cxx
extensions/source/svg/svguno.cxx
package/source/xstor/owriteablestream.cxx
package/source/xstor/xstorage.cxx
package/source/zippackage/ZipPackageStream.cxx
setup_native/source/win32/customactions/shellextensions/registerextensions.cxx
wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java
diff --cc package/inc/ZipFile.hxx
index c64500c,9bbf7d1..7df06c3
--- a/package/inc/ZipFile.hxx
+++ b/package/inc/ZipFile.hxx
@@@ -76,13 -79,13 +79,13 @@@ protected
com::sun::star::uno::Reference < com::sun::star::io::XInputStream > createMemoryStream(
ZipEntry & rEntry,
- const rtl::Reference < EncryptionData > &rData,
- const ::rtl::Reference < EncryptionData > &rData,
++ const ::rtl::Reference < EncryptionData > &rData,
sal_Bool bRawStream,
sal_Bool bDecrypt );
com::sun::star::uno::Reference < com::sun::star::io::XInputStream > createFileStream(
ZipEntry & rEntry,
- const rtl::Reference < EncryptionData > &rData,
- const ::rtl::Reference < EncryptionData > &rData,
++ const ::rtl::Reference < EncryptionData > &rData,
sal_Bool bRawStream,
sal_Bool bDecrypt );
@@@ -90,7 -93,7 +93,7 @@@
com::sun::star::uno::Reference < com::sun::star::io::XInputStream > createUnbufferedStream(
SotMutexHolderRef aMutexHolder,
ZipEntry & rEntry,
- const rtl::Reference < EncryptionData > &rData,
- const ::rtl::Reference < EncryptionData > &rData,
++ const ::rtl::Reference < EncryptionData > &rData,
sal_Int8 nStreamMode,
sal_Bool bDecrypt,
::rtl::OUString aMediaType = ::rtl::OUString() );
diff --cc package/inc/ZipPackageEntry.hxx
index 0000000,eef9dd9..18adfdc
mode 000000,100644..100644
--- a/package/inc/ZipPackageEntry.hxx
+++ b/package/inc/ZipPackageEntry.hxx
@@@ -1,0 -1,106 +1,106 @@@
+ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+ /*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
++ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+ #ifndef _ZIP_PACKAGE_ENTRY_HXX
+ #define _ZIP_PACKAGE_ENTRY_HXX
+
+ #include <com/sun/star/container/XChild.hpp>
+ #include <com/sun/star/container/XNamed.hpp>
+ #include <com/sun/star/beans/XPropertySet.hpp>
+ #include <com/sun/star/lang/XUnoTunnel.hpp>
+ #include <com/sun/star/container/XNameContainer.hpp>
+ #include <com/sun/star/lang/XServiceInfo.hpp>
+ #include <ZipEntry.hxx>
+ #include <cppuhelper/implbase5.hxx>
+
+ class ZipPackageFolder;
+
-class ZipPackageEntry : public cppu::WeakImplHelper5
++class ZipPackageEntry : public cppu::WeakImplHelper5
+ <
+ com::sun::star::container::XNamed,
+ com::sun::star::container::XChild,
+ com::sun::star::lang::XUnoTunnel,
+ com::sun::star::beans::XPropertySet,
+ com::sun::star::lang::XServiceInfo
+ >
+ {
+ protected:
+ ::rtl::OUString msName;
+ bool mbIsFolder:1;
+ bool mbAllowRemoveOnInsert:1;
+ // com::sun::star::uno::Reference < com::sun::star::container::XNameContainer > xParent;
+ ::rtl::OUString sMediaType;
+ ZipPackageFolder * pParent;
+ public:
+ ZipEntry aEntry;
+ ZipPackageEntry ( bool bNewFolder = sal_False );
+ virtual ~ZipPackageEntry( void );
+
+ ::rtl::OUString & GetMediaType () { return sMediaType; }
+ void SetMediaType ( const ::rtl::OUString & sNewType) { sMediaType = sNewType; }
+ void doSetParent ( ZipPackageFolder * pNewParent, sal_Bool bInsert );
+ bool IsFolder ( ) { return mbIsFolder; }
+ ZipPackageFolder* GetParent ( ) { return pParent; }
+ void SetFolder ( bool bSetFolder ) { mbIsFolder = bSetFolder; }
+
+ void clearParent ( void )
+ {
+ // xParent.clear();
+ pParent = NULL;
+ }
+ // XNamed
- virtual ::rtl::OUString SAL_CALL getName( )
++ virtual ::rtl::OUString SAL_CALL getName( )
+ throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setName( const ::rtl::OUString& aName )
++ virtual void SAL_CALL setName( const ::rtl::OUString& aName )
+ throw(::com::sun::star::uno::RuntimeException);
+ // XChild
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getParent( )
++ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getParent( )
+ throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setParent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& Parent )
++ virtual void SAL_CALL setParent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& Parent )
+ throw(::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
+ // XUnoTunnel
- virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier )
++ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier )
+ throw(::com::sun::star::uno::RuntimeException) = 0;
+ // XPropertySet
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( )
++ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( )
+ throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue )
++ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) = 0;
- virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName )
++ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) = 0;
- virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener )
++ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener )
++ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener )
++ virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener )
++ virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ };
+ #endif
+
+ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --cc package/inc/ZipPackageStream.hxx
index 0000000,f52a965..7dacc81
mode 000000,100644..100644
--- a/package/inc/ZipPackageStream.hxx
+++ b/package/inc/ZipPackageStream.hxx
@@@ -1,0 -1,218 +1,218 @@@
+ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+ /*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
++ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+ #ifndef _ZIP_PACKAGE_STREAM_HXX
+ #define _ZIP_PACKAGE_STREAM_HXX
+
+ #include <com/sun/star/io/XActiveDataSink.hpp>
+ #include <com/sun/star/io/XSeekable.hpp>
+ #include <com/sun/star/beans/NamedValue.hpp>
+ #include <com/sun/star/packages/XDataSinkEncrSupport.hpp>
+ #include <ZipPackageEntry.hxx>
+ #include <rtl/ref.hxx>
+ #include <cppuhelper/implbase2.hxx>
+
+ #include <EncryptionData.hxx>
+ #include <mutexholder.hxx>
+
+ #define PACKAGE_STREAM_NOTSET 0
+ #define PACKAGE_STREAM_PACKAGEMEMBER 1
+ #define PACKAGE_STREAM_DETECT 2
+ #define PACKAGE_STREAM_DATA 3
+ #define PACKAGE_STREAM_RAW 4
+
+ class ZipPackage;
+ struct ZipEntry;
+ class ZipPackageStream : public cppu::ImplInheritanceHelper2
+ <
+ ZipPackageEntry,
+ ::com::sun::star::io::XActiveDataSink,
+ ::com::sun::star::packages::XDataSinkEncrSupport
+ >
+ {
+ protected:
+ com::sun::star::uno::Reference < com::sun::star::io::XInputStream > xStream;
+ const ::com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > m_xFactory;
+ ZipPackage &rZipPackage;
+ sal_Bool bToBeCompressed, bToBeEncrypted, bHaveOwnKey, bIsEncrypted;
+
+ ::rtl::Reference< BaseEncryptionData > m_xBaseEncryptionData;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > m_aStorageEncryptionKeys;
+ ::com::sun::star::uno::Sequence< sal_Int8 > m_aEncryptionKey;
+
+ sal_Int32 m_nImportedStartKeyAlgorithm;
+ sal_Int32 m_nImportedEncryptionAlgorithm;
+ sal_Int32 m_nImportedChecksumAlgorithm;
+ sal_Int32 m_nImportedDerivedKeySize;
+
+ sal_uInt8 m_nStreamMode;
+ sal_uInt32 m_nMagicalHackPos;
+ sal_uInt32 m_nMagicalHackSize;
+
+ sal_Bool m_bHasSeekable;
+
+ sal_Bool m_bCompressedIsSetFromOutside;
+
+ sal_Bool m_bFromManifest;
+
+ bool m_bUseWinEncoding;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > GetOwnSeekStream();
+
+ public:
+ sal_Bool HasOwnKey () const { return bHaveOwnKey;}
+ sal_Bool IsToBeCompressed () const { return bToBeCompressed;}
+ sal_Bool IsToBeEncrypted () const { return bToBeEncrypted;}
+ sal_Bool IsEncrypted () const { return bIsEncrypted;}
+ sal_Bool IsPackageMember () const { return m_nStreamMode == PACKAGE_STREAM_PACKAGEMEMBER;}
+
+ sal_Bool IsFromManifest() const { return m_bFromManifest; }
+ void SetFromManifest( sal_Bool bValue ) { m_bFromManifest = bValue; }
+
+ ::rtl::Reference< EncryptionData > GetEncryptionData( bool bWinEncoding = false );
+ void SetBaseEncryptionData( const ::rtl::Reference< BaseEncryptionData >& xData );
+
+ ::com::sun::star::uno::Sequence< sal_Int8 > GetEncryptionKey( bool bWinEncoding = false );
+
+ sal_Int32 GetStartKeyGenID();
+
+ const com::sun::star::uno::Sequence < sal_Int8 > getInitialisationVector () const
+ { return m_xBaseEncryptionData->m_aInitVector;}
+ const com::sun::star::uno::Sequence < sal_Int8 > getDigest () const
+ { return m_xBaseEncryptionData->m_aDigest;}
+ const com::sun::star::uno::Sequence < sal_Int8 > getSalt () const
+ { return m_xBaseEncryptionData->m_aSalt;}
+ sal_Int32 getIterationCount () const
+ { return m_xBaseEncryptionData->m_nIterationCount;}
+ sal_Int32 getSize () const
+ { return aEntry.nSize;}
+
+ sal_uInt8 GetStreamMode() const { return m_nStreamMode; }
+ sal_uInt32 GetMagicalHackPos() const { return m_nMagicalHackPos; }
+ sal_uInt32 GetMagicalHackSize() const { return m_nMagicalHackSize; }
+ sal_Int32 GetEncryptionAlgorithm() const;
+ sal_Int32 GetBlockSize() const;
+
+ void SetToBeCompressed (sal_Bool bNewValue) { bToBeCompressed = bNewValue;}
+ void SetIsEncrypted (sal_Bool bNewValue) { bIsEncrypted = bNewValue;}
+ void SetImportedStartKeyAlgorithm( sal_Int32 nAlgorithm ) { m_nImportedStartKeyAlgorithm = nAlgorithm; }
+ void SetImportedEncryptionAlgorithm( sal_Int32 nAlgorithm ) { m_nImportedEncryptionAlgorithm = nAlgorithm; }
+ void SetImportedChecksumAlgorithm( sal_Int32 nAlgorithm ) { m_nImportedChecksumAlgorithm = nAlgorithm; }
+ void SetImportedDerivedKeySize( sal_Int32 nSize ) { m_nImportedDerivedKeySize = nSize; }
- void SetToBeEncrypted (sal_Bool bNewValue)
- {
++ void SetToBeEncrypted (sal_Bool bNewValue)
++ {
+ bToBeEncrypted = bNewValue;
+ if ( bToBeEncrypted && !m_xBaseEncryptionData.is())
+ m_xBaseEncryptionData = new BaseEncryptionData;
+ else if ( !bToBeEncrypted && m_xBaseEncryptionData.is() )
+ m_xBaseEncryptionData.clear();
+ }
+ void SetPackageMember (sal_Bool bNewValue);
+
+ void setKey (const com::sun::star::uno::Sequence < sal_Int8 >& rNewKey )
+ { m_aEncryptionKey = rNewKey; m_aStorageEncryptionKeys.realloc( 0 ); }
+ void setInitialisationVector (const com::sun::star::uno::Sequence < sal_Int8 >& rNewVector )
+ { m_xBaseEncryptionData->m_aInitVector = rNewVector;}
+ void setSalt (const com::sun::star::uno::Sequence < sal_Int8 >& rNewSalt )
+ { m_xBaseEncryptionData->m_aSalt = rNewSalt;}
+ void setDigest (const com::sun::star::uno::Sequence < sal_Int8 >& rNewDigest )
+ { m_xBaseEncryptionData->m_aDigest = rNewDigest;}
+ void setIterationCount (const sal_Int32 nNewCount)
+ { m_xBaseEncryptionData->m_nIterationCount = nNewCount;}
+ void setSize (const sal_Int32 nNewSize);
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > GetOwnStreamNoWrap() { return xStream; }
+
+ void CloseOwnStreamIfAny();
+
+ ZipPackageStream ( ZipPackage & rNewPackage,
+ const ::com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& xFactory,
+ sal_Bool bAllowRemoveOnInsert );
+ virtual ~ZipPackageStream( void );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > GetRawEncrStreamNoHeaderCopy();
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > TryToGetRawFromDataStream(
+ sal_Bool bAddHeaderForEncr );
+
+ sal_Bool ParsePackageRawStream();
+
+ void setZipEntryOnLoading( const ZipEntry &rInEntry);
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getRawData()
+ throw(::com::sun::star::uno::RuntimeException);
-
++
+ static const ::com::sun::star::uno::Sequence < sal_Int8 >& static_getImplementationId();
+
+ // XActiveDataSink
- virtual void SAL_CALL setInputStream( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& aStream )
++ virtual void SAL_CALL setInputStream( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& aStream )
+ throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getInputStream( )
++ virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getInputStream( )
+ throw(::com::sun::star::uno::RuntimeException);
+
+ // XDataSinkEncrSupport
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getDataStream()
+ throw ( ::com::sun::star::packages::WrongPasswordException,
+ ::com::sun::star::io::IOException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getRawStream()
+ throw ( ::com::sun::star::packages::NoEncryptionException,
+ ::com::sun::star::io::IOException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL setDataStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& aStream )
+ throw ( ::com::sun::star::io::IOException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL setRawStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& aStream )
+ throw ( ::com::sun::star::packages::EncryptionNotAllowedException,
+ ::com::sun::star::packages::NoRawFormatException,
+ ::com::sun::star::io::IOException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getPlainRawStream()
+ throw ( ::com::sun::star::io::IOException,
+ ::com::sun::star::uno::RuntimeException );
+
+ // XUnoTunnel
- virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier )
++ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier )
+ throw(::com::sun::star::uno::RuntimeException);
+
+ // XPropertySet
- virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue )
++ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName )
++ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName( )
++ virtual ::rtl::OUString SAL_CALL getImplementationName( )
+ throw (::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
++ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
+ throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
++ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
+ throw (::com::sun::star::uno::RuntimeException);
+ };
+ #endif
+
+ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --cc package/source/manifest/ManifestExport.cxx
index dfdcf2f,66aed3c..0a8c1d0
--- a/package/source/manifest/ManifestExport.cxx
+++ b/package/source/manifest/ManifestExport.cxx
@@@ -134,22 -146,22 +146,22 @@@ ManifestExport::ManifestExport( uno::Re
sal_Bool bStoreStartKeyGeneration = sal_False;
if ( aDocMediaType.getLength() )
{
- if ( aDocMediaType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_TEXT_ASCII ) ) )
- || aDocMediaType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_TEXT_WEB_ASCII ) ) )
- || aDocMediaType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_TEXT_GLOBAL_ASCII ) ) )
- || aDocMediaType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_ASCII ) ) )
- || aDocMediaType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_ASCII ) ) )
- || aDocMediaType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_ASCII ) ) )
- || aDocMediaType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_CHART_ASCII ) ) )
- || aDocMediaType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_DATABASE_ASCII ) ) )
- || aDocMediaType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_FORMULA_ASCII ) ) )
-
- || aDocMediaType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_TEXT_TEMPLATE_ASCII ) ) )
- || aDocMediaType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_TEMPLATE_ASCII ) ) )
- || aDocMediaType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_TEMPLATE_ASCII ) ) )
- || aDocMediaType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_TEMPLATE_ASCII ) ) )
- || aDocMediaType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_CHART_TEMPLATE_ASCII ) ) )
- || aDocMediaType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_FORMULA_TEMPLATE_ASCII ) ) ) )
+ if ( aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_TEXT_ASCII ) ) )
+ || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_TEXT_WEB_ASCII ) ) )
+ || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_TEXT_GLOBAL_ASCII ) ) )
+ || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_ASCII ) ) )
+ || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_ASCII ) ) )
+ || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_ASCII ) ) )
+ || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_CHART_ASCII ) ) )
- || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_DATABASE_ASCII ) ) )
++ || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_DATABASE_ASCII ) ) )
+ || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_FORMULA_ASCII ) ) )
+
+ || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_TEXT_TEMPLATE_ASCII ) ) )
+ || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_TEMPLATE_ASCII ) ) )
+ || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_TEMPLATE_ASCII ) ) )
+ || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_TEMPLATE_ASCII ) ) )
+ || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_CHART_TEMPLATE_ASCII ) ) )
+ || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_FORMULA_TEMPLATE_ASCII ) ) ) )
{
// oasis format
diff --cc package/source/xstor/owriteablestream.cxx
index 927a796,fe970a1..2c94e3c
--- a/package/source/xstor/owriteablestream.cxx
+++ b/package/source/xstor/owriteablestream.cxx
@@@ -117,13 -119,12 +119,12 @@@ void SetEncryptionKeyProperty_Impl( con
if ( !xPropertySet.is() )
throw uno::RuntimeException();
- ::rtl::OUString aString_EncryptionKey (RTL_CONSTASCII_USTRINGPARAM("EncryptionKey") );
try {
- xPropertySet->setPropertyValue( aString_EncryptionKey, uno::makeAny( aKey ) );
+ xPropertySet->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( STORAGE_ENCRYPTION_KEYS_PROPERTY ) ), uno::makeAny( aKey ) );
}
- catch ( uno::Exception& aException )
+ catch ( const uno::Exception& rException )
{
- ::package::StaticAddLog( aException.Message );
+ ::package::StaticAddLog( rException.Message );
::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can't set encryption") ) );
OSL_FAIL( "Can't write encryption related properties!\n" );
throw io::IOException(); // TODO
@@@ -137,13 -138,12 +138,12 @@@ uno::Any GetEncryptionKeyProperty_Impl
if ( !xPropertySet.is() )
throw uno::RuntimeException();
- ::rtl::OUString aString_EncryptionKey (RTL_CONSTASCII_USTRINGPARAM("EncryptionKey") );
try {
- return xPropertySet->getPropertyValue( aString_EncryptionKey );
+ return xPropertySet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( STORAGE_ENCRYPTION_KEYS_PROPERTY ) ) );
}
- catch ( uno::Exception& aException )
+ catch ( const uno::Exception& rException )
{
- ::package::StaticAddLog( aException.Message );
+ ::package::StaticAddLog( rException.Message );
::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can't get encryption property" ) ) );
OSL_FAIL( "Can't get encryption related properties!\n" );
@@@ -1274,55 -1323,22 +1323,22 @@@ uno::Reference< io::XStream > OWriteStr
m_bHasCachedEncryptionData = sal_True;
m_aEncryptionData = aEncryptionData;
}
- catch( const packages::WrongPasswordException& )
- {
- // retry with different encoding
- SetEncryptionKeyProperty_Impl( xPropertySet, aEncryptionData.getUnpackedValueOrDefault( PACKAGE_ENCRYPTIONDATA_SHA1MS1252, uno::Sequence< sal_Int8 >() ) );
- try {
- // the stream must be cashed to be resaved
- xResultStream = GetStream_Impl( nStreamMode | embed::ElementModes::SEEKABLE, bHierarchyAccess );
-
- m_bUseCommonEncryption = sal_False; // very important to set it to false
- m_bHasCachedEncryptionData = sal_True;
- m_aEncryptionData = aEncryptionData;
-
- // the stream must be resaved with new password encryption
- if ( nStreamMode & embed::ElementModes::WRITE )
- {
- FillTempGetFileName();
- m_bHasDataToFlush = sal_True;
-
- // TODO/LATER: should the notification be done?
- if ( m_pParent )
- m_pParent->m_bIsModified = sal_True;
- }
- }
- catch( const packages::WrongPasswordException& rWrongPasswordException )
- {
- SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< sal_Int8 >() );
- AddLog( rWrongPasswordException.Message );
- AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
- throw;
- }
- catch ( const uno::Exception& rException )
- {
- AddLog( rException.Message );
- AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Quiet exception" ) ) );
-
- OSL_FAIL( "Can't write encryption related properties!\n" );
- SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< sal_Int8 >() );
- throw io::IOException(); // TODO:
- }
- }
- catch( const uno::Exception& rException )
- catch( packages::WrongPasswordException& aWrongPasswordException )
++ catch( const packages::WrongPasswordException& rWrongPasswordException )
{
- SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< sal_Int8 >() );
-
- AddLog( rException.Message );
+ SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< beans::NamedValue >() );
- AddLog( aWrongPasswordException.Message );
++ AddLog( rWrongPasswordException.Message );
AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
throw;
}
- catch ( uno::Exception& aException )
++ catch ( const uno::Exception& rException )
+ {
- AddLog( aException.Message );
++ AddLog( rException.Message );
+ AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Quiet exception" ) ) );
+ OSL_FAIL( "Can't write encryption related properties!\n" );
+ SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< beans::NamedValue >() );
+ throw io::IOException(); // TODO:
+ }
}
OSL_ENSURE( xResultStream.is(), "In case stream can not be retrieved an exception must be thrown!\n" );
@@@ -1656,37 -1671,14 +1671,14 @@@ void OWriteStream_Impl::GetCopyOfLastCo
if ( !xDataToCopy.is() )
{
OSL_FAIL( "Encrypted ZipStream must already have input stream inside!\n" );
- SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< sal_Int8 >() );
- }
- }
- catch( const packages::WrongPasswordException& rWrongPasswordException )
- {
- SetEncryptionKeyProperty_Impl( xPropertySet, aEncryptionData.getUnpackedValueOrDefault( PACKAGE_ENCRYPTIONDATA_SHA1MS1252, uno::Sequence< sal_Int8 >() ) );
- try {
- xDataToCopy = m_xPackageStream->getDataStream();
-
- if ( !xDataToCopy.is() )
- {
- OSL_FAIL( "Encrypted ZipStream must already have input stream inside!\n" );
- SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< sal_Int8 >() );
- AddLog( rWrongPasswordException.Message );
- AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
- throw;
- }
- }
- catch( const uno::Exception& rException )
- {
- SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< sal_Int8 >() );
- AddLog( rException.Message );
- AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
- throw;
+ SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< beans::NamedValue >() );
}
}
- catch( uno::Exception& aException )
+ catch( const uno::Exception& rException )
{
OSL_FAIL( "Can't open encrypted stream!\n" );
- SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< sal_Int8 >() );
+ SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< beans::NamedValue >() );
- AddLog( aException.Message );
+ AddLog( rException.Message );
AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
throw;
}
diff --cc package/source/xstor/xstorage.cxx
index 51ef167,065215e..e05eac0
--- a/package/source/xstor/xstorage.cxx
+++ b/package/source/xstor/xstorage.cxx
@@@ -750,13 -751,21 +751,21 @@@ void OStorage_Impl::CopyToStorage( cons
{
try
{
- uno::Reference< embed::XEncryptionProtectedSource2 > xEncr( xDest, uno::UNO_QUERY );
+ uno::Reference< embed::XEncryptionProtectedStorage > xEncr( xDest, uno::UNO_QUERY );
if ( xEncr.is() )
+ {
xEncr->setEncryptionData( GetCommonRootEncryptionData().getAsConstNamedValueList() );
+
+ uno::Sequence< beans::NamedValue > aAlgorithms;
+ uno::Reference< beans::XPropertySet > xPackPropSet( m_xPackage, uno::UNO_QUERY_THROW );
+ xPackPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ENCRYPTION_ALGORITHMS_PROPERTY ) ) )
+ >>= aAlgorithms;
+ xEncr->setEncryptionAlgorithms( aAlgorithms );
+ }
}
- catch( packages::NoEncryptionException& aNoEncryptionException )
+ catch( const packages::NoEncryptionException& rNoEncryptionException )
{
- AddLog( aNoEncryptionException.Message );
+ AddLog( rNoEncryptionException.Message );
AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "No Encryption" ) ) );
}
}
@@@ -4709,9 -4719,17 +4719,17 @@@ void SAL_CALL OStorage::removeEncryptio
m_pImpl->m_bHasCommonEncryptionData = sal_False;
m_pImpl->m_aCommonEncryptionData.clear();
}
- catch( uno::RuntimeException& aRException )
++ catch( const uno::RuntimeException& rRException )
+ {
- m_pImpl->AddLog( aRException.Message );
++ m_pImpl->AddLog( rRException.Message );
+ m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
+
+ OSL_ENSURE( sal_False, "The call must not fail, it is pretty simple!" );
+ throw;
+ }
- catch( uno::Exception& aException )
+ catch( const uno::Exception& rException )
{
- m_pImpl->AddLog( aException.Message );
+ m_pImpl->AddLog( rException.Message );
m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
OSL_FAIL( "The call must not fail, it is pretty simple!" );
@@@ -4789,7 -4804,148 +4804,148 @@@ void SAL_CALL OStorage::setEncryptionDa
throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
}
+ }
+
+ //____________________________________________________________________________________________________
+ // XEncryptionProtectedStorage
+ //____________________________________________________________________________________________________
+
+ //-----------------------------------------------
+ void SAL_CALL OStorage::setEncryptionAlgorithms( const uno::Sequence< beans::NamedValue >& aAlgorithms )
+ throw (lang::IllegalArgumentException, uno::RuntimeException)
+ {
+ RTL_LOGFILE_CONTEXT( aLog, "package (mv76033) OStorage::setEncryptionAlgorithms" );
+
+ ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() );
+
+ if ( !m_pImpl )
+ {
+ ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) );
+ throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
+ }
+
+ if ( m_pData->m_nStorageType != embed::StorageFormats::PACKAGE )
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // the interface must be visible only for package storage
+
+ if ( !aAlgorithms.getLength() )
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected empty encryption algorithms list!") ), uno::Reference< uno::XInterface >() );
+
+ OSL_ENSURE( m_pData->m_bIsRoot, "setEncryptionAlgorithms() method is not available for nonroot storages!\n" );
+ if ( m_pData->m_bIsRoot )
+ {
+ try {
- m_pImpl->ReadContents();
++ m_pImpl->ReadContents();
+ }
+ catch ( uno::RuntimeException& aRuntimeException )
+ {
+ m_pImpl->AddLog( aRuntimeException.Message );
+ m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
+ throw;
+ }
+ catch ( uno::Exception& aException )
+ {
+ m_pImpl->AddLog( aException.Message );
+ m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
+
+ uno::Any aCaught( ::cppu::getCaughtException() );
+ throw lang::WrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can not open package!\n" ) ),
+ uno::Reference< uno::XInterface >( static_cast< OWeakObject* >( this ),
+ uno::UNO_QUERY ),
+ aCaught );
+ }
-
++
+ uno::Reference< beans::XPropertySet > xPackPropSet( m_pImpl->m_xPackage, uno::UNO_QUERY_THROW );
+ try
+ {
+ xPackPropSet->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ENCRYPTION_ALGORITHMS_PROPERTY ) ),
+ uno::makeAny( aAlgorithms ) );
+ }
+ catch ( uno::RuntimeException& aRuntimeException )
+ {
+ m_pImpl->AddLog( aRuntimeException.Message );
+ m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
+ throw;
+ }
+ catch( lang::IllegalArgumentException& aIAException )
+ {
+ m_pImpl->AddLog( aIAException.Message );
+ m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
+
- throw;
++ throw;
+ }
+ catch( uno::Exception& aException )
+ {
+ m_pImpl->AddLog( aException.Message );
+ m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
+
+ throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
+ }
+ }
+ }
+
+ //-----------------------------------------------
+ uno::Sequence< beans::NamedValue > SAL_CALL OStorage::getEncryptionAlgorithms()
+ throw (uno::RuntimeException)
+ {
+ RTL_LOGFILE_CONTEXT( aLog, "package (mv76033) OStorage::getEncryptionAlgorithms" );
+ ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() );
+
+ if ( !m_pImpl )
+ {
+ ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) );
+ throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
+ }
+
+ if ( m_pData->m_nStorageType != embed::StorageFormats::PACKAGE )
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // the interface must be visible only for package storage
+
+ uno::Sequence< beans::NamedValue > aResult;
+ OSL_ENSURE( m_pData->m_bIsRoot, "getEncryptionAlgorithms() method is not available for nonroot storages!\n" );
+ if ( m_pData->m_bIsRoot )
+ {
+ try {
- m_pImpl->ReadContents();
++ m_pImpl->ReadContents();
+ }
+ catch ( uno::RuntimeException& aRuntimeException )
+ {
+ m_pImpl->AddLog( aRuntimeException.Message );
+ m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
+ throw;
+ }
+ catch ( uno::Exception& aException )
+ {
+ m_pImpl->AddLog( aException.Message );
+ m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
+
+ uno::Any aCaught( ::cppu::getCaughtException() );
+ throw lang::WrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can not open package!\n" ) ),
+ uno::Reference< uno::XInterface >( static_cast< OWeakObject* >( this ),
+ uno::UNO_QUERY ),
+ aCaught );
+ }
-
++
+ uno::Reference< beans::XPropertySet > xPackPropSet( m_pImpl->m_xPackage, uno::UNO_QUERY_THROW );
+ try
+ {
+ xPackPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ENCRYPTION_ALGORITHMS_PROPERTY ) ) ) >>= aResult;
+ }
+ catch ( uno::RuntimeException& aRuntimeException )
+ {
+ m_pImpl->AddLog( aRuntimeException.Message );
+ m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
+ throw;
+ }
+ catch( uno::Exception& aException )
+ {
+ m_pImpl->AddLog( aException.Message );
+ m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
+
+ throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
+ }
+ }
+
+ return aResult;
}
diff --cc package/source/zipapi/XUnbufferedStream.cxx
index 1cad883,d84883f..a6049fd
--- a/package/source/zipapi/XUnbufferedStream.cxx
+++ b/package/source/zipapi/XUnbufferedStream.cxx
@@@ -55,14 -58,16 +58,16 @@@ using com::sun::star::lang::IllegalArgu
using com::sun::star::packages::zip::ZipIOException;
using ::rtl::OUString;
- XUnbufferedStream::XUnbufferedStream( SotMutexHolderRef aMutexHolder,
- ZipEntry & rEntry,
- Reference < XInputStream > xNewZipStream,
- const rtl::Reference < EncryptionData > &rData,
- sal_Int8 nStreamMode,
- sal_Bool bIsEncrypted,
- const ::rtl::OUString& aMediaType,
- sal_Bool bRecoveryMode )
+ XUnbufferedStream::XUnbufferedStream(
+ const uno::Reference< lang::XMultiServiceFactory >& xFactory,
+ SotMutexHolderRef aMutexHolder,
+ ZipEntry & rEntry,
+ Reference < XInputStream > xNewZipStream,
- const ::rtl::Reference< EncryptionData >& rData,
++ const ::rtl::Reference< EncryptionData >& rData,
+ sal_Int8 nStreamMode,
+ sal_Bool bIsEncrypted,
+ const ::rtl::OUString& aMediaType,
+ sal_Bool bRecoveryMode )
: maMutexHolder( aMutexHolder.Is() ? aMutexHolder : SotMutexHolderRef( new SotMutexHolder ) )
, mxZipStream ( xNewZipStream )
, mxZipSeek ( xNewZipStream, UNO_QUERY )
@@@ -104,12 -113,12 +113,12 @@@
// Make a buffer big enough to hold both the header and the data itself
maHeader.realloc ( n_ConstHeaderSize +
- rData->aInitVector.getLength() +
- rData->aSalt.getLength() +
- rData->aDigest.getLength() +
- rData->m_aInitVector.getLength() +
- rData->m_aSalt.getLength() +
++ rData->m_aInitVector.getLength() +
++ rData->m_aSalt.getLength() +
+ rData->m_aDigest.getLength() +
aMediaType.getLength() * sizeof( sal_Unicode ) );
sal_Int8 * pHeader = maHeader.getArray();
- ZipFile::StaticFillHeader ( rData, rEntry.nSize, aMediaType, pHeader );
+ ZipFile::StaticFillHeader( rData, rEntry.nSize, aMediaType, pHeader );
mnHeaderToRead = static_cast < sal_Int16 > ( maHeader.getLength() );
}
}
@@@ -137,8 -148,8 +148,8 @@@ XUnbufferedStream::XUnbufferedStream
OSL_ENSURE( mxZipSeek.is(), "The stream must be seekable!\n" );
// skip raw header, it must be already parsed to rData
- mnZipCurrent = n_ConstHeaderSize + rData->aInitVector.getLength() +
- rData->aSalt.getLength() + rData->aDigest.getLength();
- mnZipCurrent = n_ConstHeaderSize + rData->m_aInitVector.getLength() +
++ mnZipCurrent = n_ConstHeaderSize + rData->m_aInitVector.getLength() +
+ rData->m_aSalt.getLength() + rData->m_aDigest.getLength();
try {
if ( mxZipSeek.is() )
diff --cc package/source/zipapi/XUnbufferedStream.hxx
index 5cf7272,797c080..c0e8fc5
--- a/package/source/zipapi/XUnbufferedStream.hxx
+++ b/package/source/zipapi/XUnbufferedStream.hxx
@@@ -71,7 -74,7 +74,7 @@@ public
SotMutexHolderRef aMutexHolder,
ZipEntry & rEntry,
com::sun::star::uno::Reference < com::sun::star::io::XInputStream > xNewZipStream,
- const rtl::Reference < EncryptionData > &rData,
- const ::rtl::Reference< EncryptionData >& rData,
++ const ::rtl::Reference< EncryptionData >& rData,
sal_Int8 nStreamMode,
sal_Bool bIsEncrypted,
const ::rtl::OUString& aMediaType,
diff --cc package/source/zipapi/ZipFile.cxx
index 2e9576b,7001369..61a385d
--- a/package/source/zipapi/ZipFile.cxx
+++ b/package/source/zipapi/ZipFile.cxx
@@@ -125,38 -132,77 +132,77 @@@ void ZipFile::setInputStream ( uno::Ref
aGrabber.setInputStream ( xStream );
}
- sal_Bool ZipFile::StaticGetCipher ( const rtl::Reference < EncryptionData > & xEncryptionData, rtlCipher &rCipher, sal_Bool bDecode )
+ uno::Reference< xml::crypto::XDigestContext > ZipFile::StaticGetDigestContextForChecksum( const uno::Reference< lang::XMultiServiceFactory >& xArgFactory, const ::rtl::Reference< EncryptionData >& xEncryptionData )
{
- sal_Bool bResult = sal_False;
- if ( xEncryptionData.is() )
+ uno::Reference< xml::crypto::XDigestContext > xDigestContext;
+ if ( xEncryptionData->m_nCheckAlg == xml::crypto::DigestID::SHA256_1K )
{
- Sequence < sal_uInt8 > aDerivedKey (16);
- rtlCipherError aResult;
- Sequence < sal_Int8 > aDecryptBuffer;
-
- // Get the key
- rtl_digest_PBKDF2 ( aDerivedKey.getArray(), 16,
- reinterpret_cast < const sal_uInt8 * > (xEncryptionData->aKey.getConstArray() ),
- xEncryptionData->aKey.getLength(),
- reinterpret_cast < const sal_uInt8 * > ( xEncryptionData->aSalt.getConstArray() ),
- xEncryptionData->aSalt.getLength(),
- xEncryptionData->nIterationCount );
-
- rCipher = rtl_cipher_create (rtl_Cipher_AlgorithmBF, rtl_Cipher_ModeStream);
- aResult = rtl_cipher_init( rCipher, bDecode ? rtl_Cipher_DirectionDecode : rtl_Cipher_DirectionEncode,
- aDerivedKey.getConstArray(),
- aDerivedKey.getLength(),
- reinterpret_cast < const sal_uInt8 * > ( xEncryptionData->aInitVector.getConstArray() ),
- xEncryptionData->aInitVector.getLength());
- OSL_ASSERT (aResult == rtl_Cipher_E_None);
-
- bResult = ( aResult == rtl_Cipher_E_None );
+ uno::Reference< lang::XMultiServiceFactory > xFactory = xArgFactory;
+ if ( !xFactory.is() )
+ xFactory.set( comphelper::getProcessServiceFactory(), uno::UNO_SET_THROW );
+
+ uno::Reference< xml::crypto::XDigestContextSupplier > xDigestContextSupplier(
+ xFactory->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.crypto.NSSInitializer" ) ) ),
+ uno::UNO_QUERY_THROW );
+
+ xDigestContext.set( xDigestContextSupplier->getDigestContext( xEncryptionData->m_nCheckAlg, uno::Sequence< beans::NamedValue >() ), uno::UNO_SET_THROW );
}
+ else if ( xEncryptionData->m_nCheckAlg == xml::crypto::DigestID::SHA1_1K )
+ xDigestContext.set( SHA1DigestContext::Create(), uno::UNO_SET_THROW );
- return bResult;
+ return xDigestContext;
}
- void ZipFile::StaticFillHeader ( const rtl::Reference < EncryptionData > & rData,
+ uno::Reference< xml::crypto::XCipherContext > ZipFile::StaticGetCipher( const uno::Reference< lang::XMultiServiceFactory >& xArgFactory, const ::rtl::Reference< EncryptionData >& xEncryptionData, bool bEncrypt )
+ {
+ uno::Reference< xml::crypto::XCipherContext > xResult;
+
+ try
+ {
+ uno::Sequence< sal_Int8 > aDerivedKey( xEncryptionData->m_nDerivedKeySize );
+ if ( rtl_Digest_E_None != rtl_digest_PBKDF2( reinterpret_cast< sal_uInt8* >( aDerivedKey.getArray() ),
+ aDerivedKey.getLength(),
+ reinterpret_cast< const sal_uInt8 * > (xEncryptionData->m_aKey.getConstArray() ),
+ xEncryptionData->m_aKey.getLength(),
+ reinterpret_cast< const sal_uInt8 * > ( xEncryptionData->m_aSalt.getConstArray() ),
+ xEncryptionData->m_aSalt.getLength(),
+ xEncryptionData->m_nIterationCount ) )
+ {
+ throw ZipIOException( ::rtl::OUString::createFromAscii( "Can not create derived key!\n" ),
+ uno::Reference< XInterface >() );
+ }
+
+ if ( xEncryptionData->m_nEncAlg == xml::crypto::CipherID::AES_CBC_W3C_PADDING )
+ {
+ uno::Reference< lang::XMultiServiceFactory > xFactory = xArgFactory;
+ if ( !xFactory.is() )
+ xFactory.set( comphelper::getProcessServiceFactory(), uno::UNO_SET_THROW );
+
+ uno::Reference< xml::crypto::XCipherContextSupplier > xCipherContextSupplier(
+ xFactory->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.crypto.NSSInitializer" ) ) ),
+ uno::UNO_QUERY_THROW );
+
+ xResult = xCipherContextSupplier->getCipherContext( xEncryptionData->m_nEncAlg, aDerivedKey, xEncryptionData->m_aInitVector, bEncrypt, uno::Sequence< beans::NamedValue >() );
+ }
+ else if ( xEncryptionData->m_nEncAlg == xml::crypto::CipherID::BLOWFISH_CFB_8 )
+ {
+ xResult = BlowfishCFB8CipherContext::Create( aDerivedKey, xEncryptionData->m_aInitVector, bEncrypt );
+ }
+ else
+ {
+ throw ZipIOException( ::rtl::OUString::createFromAscii( "Unknown cipher algorithm is requested!\n" ),
+ uno::Reference< XInterface >() );
+ }
+ }
+ catch( uno::Exception& )
+ {
+ OSL_ENSURE( sal_False, "Can not create cipher context!" );
+ }
+
+ return xResult;
+ }
+
-void ZipFile::StaticFillHeader( const ::rtl::Reference< EncryptionData >& rData,
++void ZipFile::StaticFillHeader( const ::rtl::Reference< EncryptionData >& rData,
sal_Int32 nSize,
const ::rtl::OUString& aMediaType,
sal_Int8 * & pHeader )
@@@ -207,19 -281,19 +281,19 @@@
*(pHeader++) = static_cast< sal_Int8 >(( nMediaTypeLength >> 8 ) & 0xFF);
// Then the salt content
- memcpy ( pHeader, rData->aSalt.getConstArray(), nSaltLength );
- rtl_copyMemory ( pHeader, rData->m_aSalt.getConstArray(), nSaltLength );
++ rtl_copyMemory ( pHeader, rData->m_aSalt.getConstArray(), nSaltLength );
pHeader += nSaltLength;
// Then the IV content
- memcpy ( pHeader, rData->aInitVector.getConstArray(), nIVLength );
- rtl_copyMemory ( pHeader, rData->m_aInitVector.getConstArray(), nIVLength );
++ rtl_copyMemory ( pHeader, rData->m_aInitVector.getConstArray(), nIVLength );
pHeader += nIVLength;
// Then the digest content
- memcpy ( pHeader, rData->aDigest.getConstArray(), nDigestLength );
- rtl_copyMemory ( pHeader, rData->m_aDigest.getConstArray(), nDigestLength );
++ rtl_copyMemory ( pHeader, rData->m_aDigest.getConstArray(), nDigestLength );
pHeader += nDigestLength;
// Then the mediatype itself
- memcpy ( pHeader, aMediaType.getStr(), nMediaTypeLength );
- rtl_copyMemory ( pHeader, aMediaType.getStr(), nMediaTypeLength );
++ rtl_copyMemory ( pHeader, aMediaType.getStr(), nMediaTypeLength );
pHeader += nMediaTypeLength;
}
@@@ -306,15 -405,16 +405,16 @@@ uno::Reference< XInputStream > ZipFile:
// if we have a digest, then this file is an encrypted one and we should
// check if we can decrypt it or not
- OSL_ENSURE( rData->aDigest.getLength(), "Can't detect password correctness without digest!\n" );
- if ( rData->aDigest.getLength() )
+ OSL_ENSURE( rData->m_aDigest.getLength(), "Can't detect password correctness without digest!\n" );
+ if ( rData->m_aDigest.getLength() )
{
- sal_Int32 nSize = sal::static_int_cast< sal_Int32 >( xSeek->getLength() );
- nSize = nSize > n_ConstDigestLength ? n_ConstDigestLength : nSize;
+ sal_Int32 nSize = sal::static_int_cast< sal_Int32 >( xSeek->getLength() );
+ if ( nSize > n_ConstDigestLength + 32 )
+ nSize = n_ConstDigestLength + 32;
// skip header
- xSeek->seek( n_ConstHeaderSize + rData->aInitVector.getLength() +
- rData->aSalt.getLength() + rData->aDigest.getLength() );
- xSeek->seek( n_ConstHeaderSize + rData->m_aInitVector.getLength() +
++ xSeek->seek( n_ConstHeaderSize + rData->m_aInitVector.getLength() +
+ rData->m_aSalt.getLength() + rData->m_aDigest.getLength() );
// Only want to read enough to verify the digest
Sequence < sal_Int8 > aReadBuffer ( nSize );
@@@ -334,38 -449,43 +449,43 @@@ sal_Bool ZipFile::StaticHasValidPasswor
return sal_False;
sal_Bool bRet = sal_False;
- sal_Int32 nSize = aReadBuffer.getLength();
-
- // make a temporary cipher
- rtlCipher aCipher;
- StaticGetCipher ( rData, aCipher, sal_True );
-
- Sequence < sal_Int8 > aDecryptBuffer ( nSize );
- rtlDigest aDigest = rtl_digest_createSHA1();
- rtlDigestError aDigestResult;
- Sequence < sal_uInt8 > aDigestSeq ( RTL_DIGEST_LENGTH_SHA1 );
- rtlCipherError aResult = rtl_cipher_decode ( aCipher,
- aReadBuffer.getConstArray(),
- nSize,
- reinterpret_cast < sal_uInt8 * > (aDecryptBuffer.getArray()),
- nSize);
- if(aResult != rtl_Cipher_E_None ) {
- OSL_ASSERT ( aResult == rtl_Cipher_E_None);
+
+ uno::Reference< xml::crypto::XCipherContext > xCipher( StaticGetCipher( xFactory, rData, false ), uno::UNO_SET_THROW );
+
+ uno::Sequence< sal_Int8 > aDecryptBuffer;
+ uno::Sequence< sal_Int8 > aDecryptBuffer2;
+ try
+ {
+ aDecryptBuffer = xCipher->convertWithCipherContext( aReadBuffer );
+ aDecryptBuffer2 = xCipher->finalizeCipherContextAndDispose();
+ }
+ catch( uno::Exception& )
+ {
+ // decryption with padding will throw the exception in finalizing if the buffer represent only part of the stream
+ // it is no problem, actually this is why we read 32 additional bytes ( two of maximal possible encryption blocks )
+ }
+
+ if ( aDecryptBuffer2.getLength() )
+ {
+ sal_Int32 nOldLen = aDecryptBuffer.getLength();
+ aDecryptBuffer.realloc( nOldLen + aDecryptBuffer2.getLength() );
+ rtl_copyMemory( aDecryptBuffer.getArray() + nOldLen, aDecryptBuffer2.getArray(), aDecryptBuffer2.getLength() );
}
- aDigestResult = rtl_digest_updateSHA1 ( aDigest,
- static_cast < const void * > ( aDecryptBuffer.getConstArray() ), nSize );
- OSL_ASSERT ( aDigestResult == rtl_Digest_E_None );
+ if ( aDecryptBuffer.getLength() > n_ConstDigestLength )
+ aDecryptBuffer.realloc( n_ConstDigestLength );
+
+ uno::Sequence< sal_Int8 > aDigestSeq;
+ uno::Reference< xml::crypto::XDigestContext > xDigestContext( StaticGetDigestContextForChecksum( xFactory, rData ), uno::UNO_SET_THROW );
- aDigestResult = rtl_digest_getSHA1 ( aDigest, aDigestSeq.getArray(), RTL_DIGEST_LENGTH_SHA1 );
- OSL_ASSERT ( aDigestResult == rtl_Digest_E_None );
- (void)aDigestResult;
+ xDigestContext->updateDigest( aDecryptBuffer );
+ aDigestSeq = xDigestContext->finalizeDigestAndDispose();
// If we don't have a digest, then we have to assume that the password is correct
- if ( rData->aDigest.getLength() != 0 &&
- ( aDigestSeq.getLength() != rData->aDigest.getLength() ||
- if ( rData->m_aDigest.getLength() != 0 &&
++ if ( rData->m_aDigest.getLength() != 0 &&
+ ( aDigestSeq.getLength() != rData->m_aDigest.getLength() ||
- 0 != rtl_compareMemory ( aDigestSeq.getConstArray(),
- rData->m_aDigest.getConstArray(),
+ 0 != rtl_compareMemory ( aDigestSeq.getConstArray(),
- rData->aDigest.getConstArray(),
++ rData->m_aDigest.getConstArray(),
aDigestSeq.getLength() ) ) )
{
// We should probably tell the user that the password they entered was wrong
diff --cc package/source/zipapi/ZipOutputStream.cxx
index 1d29e17,89e63e4..8efe20e
--- a/package/source/zipapi/ZipOutputStream.cxx
+++ b/package/source/zipapi/ZipOutputStream.cxx
@@@ -247,38 -256,49 +256,49 @@@ void ZipOutputStream::doDeflate(
if ( nLength > 0 )
{
- Sequence < sal_Int8 > aTmpBuffer ( aBuffer.getConstArray(), nLength );
- const void *pTmpBuffer = static_cast < const void * > ( aTmpBuffer.getConstArray() );
- if (bEncryptCurrentEntry)
+ uno::Sequence< sal_Int8 > aTmpBuffer( m_aDeflateBuffer.getConstArray(), nLength );
+ if ( bEncryptCurrentEntry && m_xDigestContext.is() && m_xCipherContext.is() )
{
// Need to update our digest before encryption...
- rtlDigestError aDigestResult = rtl_Digest_E_None;
- sal_Int16 nDiff = n_ConstDigestLength - mnDigested;
+ sal_Int32 nDiff = n_ConstDigestLength - mnDigested;
if ( nDiff )
{
- sal_Int16 nEat = static_cast < sal_Int16 > ( nDiff > nLength ? nLength : nDiff );
- aDigestResult = rtl_digest_updateSHA1 ( aDigest, pTmpBuffer, nEat );
- mnDigested = mnDigested + nEat;
- sal_Int32 nEat = ::std::min( nLength, nDiff );
++ sal_Int32 nEat = ::std::min( nLength, nDiff );
+ uno::Sequence< sal_Int8 > aTmpSeq( aTmpBuffer.getConstArray(), nEat );
+ m_xDigestContext->updateDigest( aTmpSeq );
+ mnDigested = mnDigested + static_cast< sal_Int16 >( nEat );
}
- OSL_ASSERT( aDigestResult == rtl_Digest_E_None );
- (void)aDigestResult;
-
- aEncryptionBuffer.realloc ( nLength );
- rtlCipherError aCipherResult;
- aCipherResult = rtl_cipher_encode ( aCipher, pTmpBuffer,
- nLength, reinterpret_cast < sal_uInt8 * > (aEncryptionBuffer.getArray()), nLength );
- OSL_ASSERT( aCipherResult == rtl_Cipher_E_None );
- (void)aCipherResult;
+ uno::Sequence< sal_Int8 > aEncryptionBuffer = m_xCipherContext->convertWithCipherContext( aTmpBuffer );
aChucker.WriteBytes( aEncryptionBuffer );
- aCRC.update ( aEncryptionBuffer );
- aEncryptionBuffer.realloc ( nOldLength );
+
+ // the sizes as well as checksum for encrypted streams is calculated here
+ pCurrentEntry->nCompressedSize += aEncryptionBuffer.getLength();
+ pCurrentEntry->nSize = pCurrentEntry->nCompressedSize;
+ aCRC.update( aEncryptionBuffer );
}
else
+ {
aChucker.WriteBytes ( aTmpBuffer );
+ }
+ }
+
+ if ( aDeflater.finished() && bEncryptCurrentEntry && m_xDigestContext.is() && m_xCipherContext.is() )
+ {
+ uno::Sequence< sal_Int8 > aEncryptionBuffer = m_xCipherContext->finalizeCipherContextAndDispose();
+ if ( aEncryptionBuffer.getLength() )
+ {
+ aChucker.WriteBytes( aEncryptionBuffer );
+
+ // the sizes as well as checksum for encrypted streams is calculated hier
+ pCurrentEntry->nCompressedSize += aEncryptionBuffer.getLength();
+ pCurrentEntry->nSize = pCurrentEntry->nCompressedSize;
+ aCRC.update( aEncryptionBuffer );
+ }
}
}
+
void ZipOutputStream::writeEND(sal_uInt32 nOffset, sal_uInt32 nLength)
throw(IOException, RuntimeException)
{
diff --cc package/source/zipapi/blowfishcontext.cxx
index 0000000,31fed2c..1739bb1
mode 000000,100644..100644
--- a/package/source/zipapi/blowfishcontext.cxx
+++ b/package/source/zipapi/blowfishcontext.cxx
@@@ -1,0 -1,122 +1,122 @@@
+ /*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
++ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+ // MARKER(update_precomp.py): autogen include statement, do not remove
+ #include "precompiled_package.hxx"
+
+ #include <rtl/cipher.h>
+ #include <rtl/ref.hxx>
+
+ #include "blowfishcontext.hxx"
+
+ using namespace ::com::sun::star;
+
+ // static
+ uno::Reference< xml::crypto::XCipherContext > BlowfishCFB8CipherContext::Create( const uno::Sequence< sal_Int8 >& aDerivedKey, const uno::Sequence< sal_Int8 >& aInitVector, bool bEncrypt )
+ {
+ ::rtl::Reference< BlowfishCFB8CipherContext > xResult = new BlowfishCFB8CipherContext();
+ xResult->m_pCipher = rtl_cipher_create( rtl_Cipher_AlgorithmBF, rtl_Cipher_ModeStream );
+ if ( !xResult->m_pCipher )
+ throw uno::RuntimeException( ::rtl::OUString::createFromAscii( "Can not create cipher!\n" ),
+ uno::Reference< XInterface >() );
+
+ if ( rtl_Cipher_E_None != rtl_cipher_init(
+ xResult->m_pCipher,
+ bEncrypt ? rtl_Cipher_DirectionEncode : rtl_Cipher_DirectionDecode,
+ reinterpret_cast< const sal_uInt8* >( aDerivedKey.getConstArray() ),
+ aDerivedKey.getLength(),
+ reinterpret_cast< const sal_uInt8* >( aInitVector.getConstArray() ),
+ aInitVector.getLength() ) )
+ {
+ throw uno::RuntimeException( ::rtl::OUString::createFromAscii( "Can not initialize cipher!\n" ),
+ uno::Reference< XInterface >() );
+ }
-
++
+ xResult->m_bEncrypt = bEncrypt;
+
+ return uno::Reference< xml::crypto::XCipherContext >( xResult.get() );
+ }
+
+ BlowfishCFB8CipherContext::~BlowfishCFB8CipherContext()
+ {
+ if ( m_pCipher )
+ {
+ rtl_cipher_destroy ( m_pCipher );
+ m_pCipher = NULL;
+ }
+ }
+
+ uno::Sequence< sal_Int8 > SAL_CALL BlowfishCFB8CipherContext::convertWithCipherContext( const uno::Sequence< ::sal_Int8 >& aData )
+ throw( lang::IllegalArgumentException, lang::DisposedException, uno::RuntimeException )
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if ( !m_pCipher )
+ throw lang::DisposedException();
+
+ uno::Sequence< sal_Int8 > aResult( aData.getLength() );
+ rtlCipherError nError = rtl_Cipher_E_None;
+
+ if ( m_bEncrypt )
+ {
+ rtl_cipher_encode( m_pCipher,
+ aData.getConstArray(),
+ aData.getLength(),
+ reinterpret_cast< sal_uInt8* >( aResult.getArray() ),
+ aResult.getLength() );
+ }
+ else
+ {
+ rtl_cipher_decode( m_pCipher,
+ aData.getConstArray(),
+ aData.getLength(),
+ reinterpret_cast< sal_uInt8* >( aResult.getArray() ),
+ aResult.getLength() );
+ }
+
+ if ( rtl_Cipher_E_None != nError )
+ {
+ throw uno::RuntimeException( ::rtl::OUString::createFromAscii( "Can not decrypt/encrypt with cipher!\n" ),
+ uno::Reference< uno::XInterface >() );
+ }
+
+ return aResult;
+ }
+
+ uno::Sequence< ::sal_Int8 > SAL_CALL BlowfishCFB8CipherContext::finalizeCipherContextAndDispose()
+ throw( lang::DisposedException, uno::RuntimeException )
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if ( !m_pCipher )
+ throw lang::DisposedException();
+
+ rtl_cipher_destroy ( m_pCipher );
+ m_pCipher = NULL;
+
+ return uno::Sequence< sal_Int8 >();
+ }
+
+
diff --cc package/source/zipapi/blowfishcontext.hxx
index 0000000,ffb1921..49cce2f
mode 000000,100644..100644
--- a/package/source/zipapi/blowfishcontext.hxx
+++ b/package/source/zipapi/blowfishcontext.hxx
@@@ -1,0 -1,58 +1,58 @@@
+ /*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
++ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+ #ifndef _BLOWFISHCONTEXT_HXX
+ #define _BLOWFISHCONTEXT_HXX
+
+ #include <com/sun/star/xml/crypto/XCipherContext.hpp>
+
+ #include <cppuhelper/implbase1.hxx>
+ #include <osl/mutex.hxx>
+
+ class BlowfishCFB8CipherContext : public cppu::WeakImplHelper1< ::com::sun::star::xml::crypto::XCipherContext >
+ {
+ ::osl::Mutex m_aMutex;
+ void* m_pCipher;
+ bool m_bEncrypt;
+
+ BlowfishCFB8CipherContext()
+ : m_pCipher( NULL )
+ , m_bEncrypt( false )
+ {}
+
+ public:
+
+ virtual ~BlowfishCFB8CipherContext();
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XCipherContext >
+ Create( const ::com::sun::star::uno::Sequence< sal_Int8 >& aDerivedKey, const ::com::sun::star::uno::Sequence< sal_Int8 >& aInitVector, bool bEncrypt );
+
+ virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL convertWithCipherContext( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& aData ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::DisposedException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL finalizeCipherContextAndDispose( ) throw (::com::sun::star::lang::DisposedException, ::com::sun::star::uno::RuntimeException);
+ };
+
+ #endif // _BLOWFISHCONTEXT_HXX
+
diff --cc package/source/zipapi/sha1context.cxx
index 0000000,4094ccf..a71f20a
mode 000000,100644..100644
--- a/package/source/zipapi/sha1context.cxx
+++ b/package/source/zipapi/sha1context.cxx
@@@ -1,0 -1,97 +1,97 @@@
+ /*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
++ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+ // MARKER(update_precomp.py): autogen include statement, do not remove
+ #include "precompiled_package.hxx"
+
+ #include <rtl/digest.h>
+ #include <rtl/ref.hxx>
+
+ #include "sha1context.hxx"
+
+ using namespace ::com::sun::star;
+
+ // static
+ uno::Reference< xml::crypto::XDigestContext > SHA1DigestContext::Create()
+ {
+ ::rtl::Reference< SHA1DigestContext > xResult = new SHA1DigestContext();
+ xResult->m_pDigest = rtl_digest_createSHA1();
+ if ( !xResult->m_pDigest )
+ throw uno::RuntimeException( ::rtl::OUString::createFromAscii( "Can not create cipher!\n" ),
+ uno::Reference< XInterface >() );
+
+ return uno::Reference< xml::crypto::XDigestContext >( xResult.get() );
+ }
+
+ SHA1DigestContext::~SHA1DigestContext()
+ {
+ if ( m_pDigest )
+ {
+ rtl_digest_destroySHA1( m_pDigest );
+ m_pDigest = NULL;
+ }
+ }
+
+ void SAL_CALL SHA1DigestContext::updateDigest( const uno::Sequence< ::sal_Int8 >& aData )
+ throw( lang::DisposedException, uno::RuntimeException )
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if ( !m_pDigest )
+ throw lang::DisposedException();
+
+ if ( rtl_Digest_E_None != rtl_digest_updateSHA1( m_pDigest, aData.getConstArray(), aData.getLength() ) )
+ {
+ rtl_digest_destroySHA1( m_pDigest );
+ m_pDigest = NULL;
+
+ throw uno::RuntimeException();
+ }
+ }
+
+ uno::Sequence< ::sal_Int8 > SAL_CALL SHA1DigestContext::finalizeDigestAndDispose()
+ throw( lang::DisposedException, uno::RuntimeException )
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if ( !m_pDigest )
+ throw lang::DisposedException();
+
+ uno::Sequence< sal_Int8 > aResult( RTL_DIGEST_LENGTH_SHA1 );
+ if ( rtl_Digest_E_None != rtl_digest_getSHA1( m_pDigest, reinterpret_cast< sal_uInt8* >( aResult.getArray() ), aResult.getLength() ) )
+ {
+ rtl_digest_destroySHA1( m_pDigest );
+ m_pDigest = NULL;
+
+ throw uno::RuntimeException();
+ }
+
+ rtl_digest_destroySHA1( m_pDigest );
+ m_pDigest = NULL;
+
+ return aResult;
+ }
+
+
diff --cc package/source/zipapi/sha1context.hxx
index 0000000,f08c279..c8f6068
mode 000000,100644..100644
--- a/package/source/zipapi/sha1context.hxx
+++ b/package/source/zipapi/sha1context.hxx
@@@ -1,0 -1,59 +1,59 @@@
+ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+ /*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
++ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+ #ifndef _SHA1CONTEXT_HXX
+ #define _SHA1CONTEXT_HXX
+
+ #include <com/sun/star/xml/crypto/XDigestContext.hpp>
+
+ #include <cppuhelper/implbase1.hxx>
+ #include <osl/mutex.hxx>
+
+ class SHA1DigestContext : public cppu::WeakImplHelper1< ::com::sun::star::xml::crypto::XDigestContext >
+ {
+ ::osl::Mutex m_aMutex;
+ void* m_pDigest;
+
+ SHA1DigestContext()
+ : m_pDigest( NULL )
+ {}
+
+ public:
+
+ virtual ~SHA1DigestContext();
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XDigestContext >
+ Create();
+
+ virtual void SAL_CALL updateDigest( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& aData ) throw (::com::sun::star::lang::DisposedException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL finalizeDigestAndDispose() throw (::com::sun::star::lang::DisposedException, ::com::sun::star::uno::RuntimeException);
+
+ };
+
+ #endif
+
+ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --cc package/source/zippackage/ZipPackage.cxx
index 1f1e48a,2ffe923..b3eb2fc
--- a/package/source/zippackage/ZipPackage.cxx
+++ b/package/source/zippackage/ZipPackage.cxx
@@@ -156,12 -159,12 +159,12 @@@ public
class DummyInputStream : public ::cppu::WeakImplHelper1< XInputStream >
{
- virtual sal_Int32 SAL_CALL readBytes( Sequence< sal_Int8 >&, sal_Int32 )
- throw ( NotConnectedException, BufferSizeExceededException, IOException, RuntimeException)
- virtual sal_Int32 SAL_CALL readBytes( uno::Sequence< sal_Int8 >&, sal_Int32 )
++ virtual sal_Int32 SAL_CALL readBytes( uno::Sequence< sal_Int8 >&, sal_Int32 )
+ throw ( NotConnectedException, BufferSizeExceededException, IOException, RuntimeException )
{ return 0; }
- virtual sal_Int32 SAL_CALL readSomeBytes( Sequence< sal_Int8 >&, sal_Int32 )
- throw ( NotConnectedException, BufferSizeExceededException, IOException, RuntimeException)
- virtual sal_Int32 SAL_CALL readSomeBytes( uno::Sequence< sal_Int8 >&, sal_Int32 )
++ virtual sal_Int32 SAL_CALL readSomeBytes( uno::Sequence< sal_Int8 >&, sal_Int32 )
+ throw ( NotConnectedException, BufferSizeExceededException, IOException, RuntimeException )
{ return 0; }
virtual void SAL_CALL skipBytes( sal_Int32 )
@@@ -531,10 -568,10 +568,10 @@@ void ZipPackage::getZipFileContents(
if ( pCurrent == m_pRootFolder )
{
- while ( (nIndex = rName.indexOf('/', nOldIndex) ) != -1 )
+ while ( ( nIndex = rName.indexOf( '/', nOldIndex ) ) != -1 )
{
sTemp = rName.copy ( nOldIndex, nIndex - nOldIndex );
- if (nIndex == nOldIndex)
- if ( nIndex == nOldIndex )
++ if ( nIndex == nOldIndex )
break;
if ( !pCurrent->hasByName( sTemp ) )
{
@@@ -568,9 -605,9 +605,9 @@@
parseContentType();
}
- // XInitialization
- void SAL_CALL ZipPackage::initialize( const Sequence< Any >& aArguments )
- throw(Exception, RuntimeException)
+ //--------------------------------------------------------
-void SAL_CALL ZipPackage::initialize( const uno::Sequence< Any >& aArguments )
++void SAL_CALL ZipPackage::initialize( const uno::Sequence< Any >& aArguments )
+ throw( Exception, RuntimeException )
{
RTL_LOGFILE_TRACE_AUTHOR ( "package", LOGFILE_AUTHOR, "{ ZipPackage::initialize" );
sal_Bool bBadZipFile = sal_False, bHaveZipFile = sal_True;
@@@ -935,15 -974,16 +974,16 @@@ sal_Bool SAL_CALL ZipPackage::hasByHier
}
}
- // XSingleServiceFactory
- uno::Reference< XInterface > SAL_CALL ZipPackage::createInstance( )
- throw(Exception, RuntimeException)
+ //--------------------------------------------------------
-uno::Reference< XInterface > SAL_CALL ZipPackage::createInstance()
++uno::Reference< XInterface > SAL_CALL ZipPackage::createInstance()
+ throw( Exception, RuntimeException )
{
- uno::Reference < XInterface > xRef = *(new ZipPackageStream ( *this, m_xFactory, m_bAllowRemoveOnInsert ));
+ uno::Reference < XInterface > xRef = *( new ZipPackageStream ( *this, m_xFactory, m_bAllowRemoveOnInsert ) );
return xRef;
}
- uno::Reference< XInterface > SAL_CALL ZipPackage::createInstanceWithArguments( const Sequence< Any >& aArguments )
- throw(Exception, RuntimeException)
+ //--------------------------------------------------------
-uno::Reference< XInterface > SAL_CALL ZipPackage::createInstanceWithArguments( const uno::Sequence< Any >& aArguments )
++uno::Reference< XInterface > SAL_CALL ZipPackage::createInstanceWithArguments( const uno::Sequence< Any >& aArguments )
+ throw( Exception, RuntimeException )
{
sal_Bool bArg = sal_False;
uno::Reference < XInterface > xRef;
@@@ -1549,15 -1593,47 +1593,47 @@@ void ZipPackage::DisconnectFromTargetAn
makeAny ( aException ) );
}
- sal_Bool SAL_CALL ZipPackage::hasPendingChanges( )
- throw(RuntimeException)
+ //--------------------------------------------------------
+ const uno::Sequence< sal_Int8 > ZipPackage::GetEncryptionKey()
+ {
+ uno::Sequence< sal_Int8 > aResult;
+
+ if ( m_aStorageEncryptionKeys.getLength() )
+ {
+ ::rtl::OUString aNameToFind;
+ if ( m_nStartKeyGenerationID == xml::crypto::DigestID::SHA256 )
+ aNameToFind = PACKAGE_ENCRYPTIONDATA_SHA256UTF8;
+ else if ( m_nStartKeyGenerationID == xml::crypto::DigestID::SHA1 )
+ aNameToFind = PACKAGE_ENCRYPTIONDATA_SHA1UTF8;
+ else
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "No expected key is provided!" ) ), uno::Reference< uno::XInterface >() );
+
+ for ( sal_Int32 nInd = 0; nInd < m_aStorageEncryptionKeys.getLength(); nInd++ )
+ if ( m_aStorageEncryptionKeys[nInd].Name.equals( aNameToFind ) )
+ m_aStorageEncryptionKeys[nInd].Value >>= aResult;
+
+ // empty keys are not allowed here
+ // so it is not important whether there is no key, or the key is empty, it is an error
+ if ( !aResult.getLength() )
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "No expected key is provided!" ) ), uno::Reference< uno::XInterface >() );
+ }
+ else
+ aResult = m_aEncryptionKey;
+
+ return aResult;
+ }
+
+ //--------------------------------------------------------
-sal_Bool SAL_CALL ZipPackage::hasPendingChanges()
++sal_Bool SAL_CALL ZipPackage::hasPendingChanges()
+ throw( RuntimeException )
{
return sal_False;
}
- Sequence< ElementChange > SAL_CALL ZipPackage::getPendingChanges( )
- throw(RuntimeException)
+ //--------------------------------------------------------
-Sequence< ElementChange > SAL_CALL ZipPackage::getPendingChanges()
++Sequence< ElementChange > SAL_CALL ZipPackage::getPendingChanges()
+ throw( RuntimeException )
{
- return Sequence < ElementChange > ();
+ return uno::Sequence < ElementChange > ();
}
/**
@@@ -1620,16 -1703,18 +1703,18 @@@ Sequence< sal_Int8 > ZipPackage::getUno
return rId.getImplementationId();
}
- sal_Int64 SAL_CALL ZipPackage::getSomething( const Sequence< sal_Int8 >& aIdentifier )
- throw(RuntimeException)
+ //--------------------------------------------------------
-sal_Int64 SAL_CALL ZipPackage::getSomething( const uno::Sequence< sal_Int8 >& aIdentifier )
++sal_Int64 SAL_CALL ZipPackage::getSomething( const uno::Sequence< sal_Int8 >& aIdentifier )
+ throw( RuntimeException )
{
- if (aIdentifier.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), aIdentifier.getConstArray(), 16 ) )
+ if ( aIdentifier.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelImplementationId().getConstArray(), aIdentifier.getConstArray(), 16 ) )
return reinterpret_cast < sal_Int64 > ( this );
return 0;
}
- uno::Reference< XPropertySetInfo > SAL_CALL ZipPackage::getPropertySetInfo( )
- throw(RuntimeException)
+ //--------------------------------------------------------
-uno::Reference< XPropertySetInfo > SAL_CALL ZipPackage::getPropertySetInfo()
++uno::Reference< XPropertySetInfo > SAL_CALL ZipPackage::getPropertySetInfo()
+ throw( RuntimeException )
{
return uno::Reference < XPropertySetInfo > ();
}
@@@ -1639,20 -1726,91 +1726,91 @@@ void SAL_CALL ZipPackage::setPropertyVa
if ( m_nFormat != embed::StorageFormats::PACKAGE )
throw UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
- if (aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("HasEncryptedEntries") )
- ||aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("HasNonEncryptedEntries") )
- ||aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("IsInconsistent") )
- ||aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("MediaTypeFallbackUsed") ) )
+ if ( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( HAS_ENCRYPTED_ENTRIES_PROPERTY ) )
+ ||aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( HAS_NONENCRYPTED_ENTRIES_PROPERTY ) )
+ ||aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( IS_INCONSISTENT_PROPERTY ) )
+ ||aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( MEDIATYPE_FALLBACK_USED_PROPERTY ) ) )
throw PropertyVetoException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
- else if (aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("EncryptionKey") ) )
+ else if ( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ENCRYPTION_KEY_PROPERTY ) ) )
{
- if (!( aValue >>= m_aEncryptionKey ) || m_aEncryptionKey.getLength() == 0 )
+ if ( !( aValue >>= m_aEncryptionKey ) )
throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 2 );
+
+ m_aStorageEncryptionKeys.realloc( 0 );
}
- else if (aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("UseManifest") ) )
+ else if ( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( STORAGE_ENCRYPTION_KEYS_PROPERTY ) ) )
{
- if (!( aValue >>= m_bUseManifest ) )
+ // this property is only necessary to support raw passwords in storage API;
+ // because of this support the storage has to operate with more than one key dependent on storage generation algorithm;
+ // when this support is removed, the storage will get only one key from outside
+ // TODO/LATER: Get rid of this property as well as of support of raw passwords in storages
+ uno::Sequence< beans::NamedValue > aKeys;
+ if ( !( aValue >>= aKeys ) || ( aKeys.getLength() && aKeys.getLength() < 2 ) )
throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 2 );
+
+ if ( aKeys.getLength() )
+ {
+ bool bHasSHA256 = false;
+ bool bHasSHA1 = false;
+ for ( sal_Int32 nInd = 0; nInd < aKeys.getLength(); nInd++ )
+ {
+ if ( aKeys[nInd].Name.equals( PACKAGE_ENCRYPTIONDATA_SHA256UTF8 ) )
+ bHasSHA256 = true;
+ if ( aKeys[nInd].Name.equals( PACKAGE_ENCRYPTIONDATA_SHA1UTF8 ) )
+ bHasSHA1 = true;
+ }
+
+ if ( !bHasSHA256 || !bHasSHA1 )
+ throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Expected keys are not provided!" ) ), uno::Reference< uno::XInterface >(), 2 );
+ }
+
+ m_aStorageEncryptionKeys = aKeys;
+ m_aEncryptionKey.realloc( 0 );
+ }
+ else if ( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ENCRYPTION_ALGORITHMS_PROPERTY ) ) )
+ {
+ uno::Sequence< beans::NamedValue > aAlgorithms;
+ if ( m_pZipFile || !( aValue >>= aAlgorithms ) || aAlgorithms.getLength() == 0 )
+ {
+ // the algorithms can not be changed if the file has a persistence based on the algorithms ( m_pZipFile )
+ throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "unexpected algorithms list is provided." ) ), uno::Reference< uno::XInterface >(), 2 );
+ }
+
+ for ( sal_Int32 nInd = 0; nInd < aAlgorithms.getLength(); nInd++ )
+ {
+ if ( aAlgorithms[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "StartKeyGenerationAlgorithm" ) ) )
+ {
+ sal_Int32 nID = 0;
+ if ( !( aAlgorithms[nInd].Value >>= nID )
+ || ( nID != xml::crypto::DigestID::SHA256 && nID != xml::crypto::DigestID::SHA1 ) )
+ throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected start key generation algorithm is provided!" ) ), uno::Reference< uno::XInterface >(), 2 );
-
++
+ m_nStartKeyGenerationID = nID;
+ }
+ else if ( aAlgorithms[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "EncryptionAlgorithm" ) ) )
+ {
+ sal_Int32 nID = 0;
+ if ( !( aAlgorithms[nInd].Value >>= nID )
+ || ( nID != xml::crypto::CipherID::AES_CBC_W3C_PADDING && nID != xml::crypto::CipherID::BLOWFISH_CFB_8 ) )
+ throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected start key generation algorithm is provided!" ) ), uno::Reference< uno::XInterface >(), 2 );
-
++
+ m_nCommonEncryptionID = nID;
+ }
+ else if ( aAlgorithms[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ChecksumAlgorithm" ) ) )
+ {
+ sal_Int32 nID = 0;
+ if ( !( aAlgorithms[nInd].Value >>= nID )
+ || ( nID != xml::crypto::DigestID::SHA1_1K && nID != xml::crypto::DigestID::SHA256_1K ) )
+ throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected start key generation algorithm is provided!" ) ), uno::Reference< uno::XInterface >(), 2 );
-
++
+ m_nChecksumDigestID = nID;
+ }
+ else
+ {
+ OSL_ENSURE( sal_False, "Unexpected encryption algorithm is provided!" );
+ throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "unexpected algorithms list is provided." ) ), uno::Reference< uno::XInterface >(), 2 );
+ }
+ }
}
else
throw UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
diff --cc package/source/zippackage/ZipPackageEntry.cxx
index 6d76413,bf3d8be..fdb7abc
--- a/package/source/zippackage/ZipPackageEntry.cxx
+++ b/package/source/zippackage/ZipPackageEntry.cxx
@@@ -82,11 -82,11 +82,11 @@@ void SAL_CALL ZipPackageEntry::setName
if ( pParent )
pParent->doInsertByName ( this, sal_False );
}
- Reference< XInterface > SAL_CALL ZipPackageEntry::getParent( )
-uno::Reference< XInterface > SAL_CALL ZipPackageEntry::getParent( )
++uno::Reference< XInterface > SAL_CALL ZipPackageEntry::getParent( )
throw(RuntimeException)
{
- // return Reference< XInterface >( xParent, UNO_QUERY );
- return Reference< XInterface >( static_cast< ::cppu::OWeakObject* >( pParent ), UNO_QUERY );
+ // return uno::Reference< XInterface >( xParent, UNO_QUERY );
+ return uno::Reference< XInterface >( static_cast< ::cppu::OWeakObject* >( pParent ), UNO_QUERY );
}
void ZipPackageEntry::doSetParent ( ZipPackageFolder * pNewParent, sal_Bool bInsert )
@@@ -97,7 -97,7 +97,7 @@@
pNewParent->doInsertByName ( this, sal_False );
}
- void SAL_CALL ZipPackageEntry::setParent( const Reference< XInterface >& xNewParent )
-void SAL_CALL ZipPackageEntry::setParent( const uno::Reference< XInterface >& xNewParent )
++void SAL_CALL ZipPackageEntry::setParent( const uno::Reference< XInterface >& xNewParent )
throw(NoSupportException, RuntimeException)
{
sal_Int64 nTest(0);
@@@ -115,24 -115,24 +115,24 @@@
}
}
//XPropertySet
- Reference< beans::XPropertySetInfo > SAL_CALL ZipPackageEntry::getPropertySetInfo( )
-uno::Reference< beans::XPropertySetInfo > SAL_CALL ZipPackageEntry::getPropertySetInfo( )
++uno::Reference< beans::XPropertySetInfo > SAL_CALL ZipPackageEntry::getPropertySetInfo( )
throw(RuntimeException)
{
- return Reference < beans::XPropertySetInfo > ();
+ return uno::Reference < beans::XPropertySetInfo > ();
}
- void SAL_CALL ZipPackageEntry::addPropertyChangeListener( const OUString& /*aPropertyName*/, const Reference< beans::XPropertyChangeListener >& /*xListener*/ )
-void SAL_CALL ZipPackageEntry::addPropertyChangeListener( const OUString& /*aPropertyName*/, const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/ )
++void SAL_CALL ZipPackageEntry::addPropertyChangeListener( const OUString& /*aPropertyName*/, const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/ )
throw(beans::UnknownPropertyException, WrappedTargetException, RuntimeException)
{
}
- void SAL_CALL ZipPackageEntry::removePropertyChangeListener( const OUString& /*aPropertyName*/, const Reference< beans::XPropertyChangeListener >& /*aListener*/ )
-void SAL_CALL ZipPackageEntry::removePropertyChangeListener( const OUString& /*aPropertyName*/, const uno::Reference< beans::XPropertyChangeListener >& /*aListener*/ )
++void SAL_CALL ZipPackageEntry::removePropertyChangeListener( const OUString& /*aPropertyName*/, const uno::Reference< beans::XPropertyChangeListener >& /*aListener*/ )
throw(beans::UnknownPropertyException, WrappedTargetException, RuntimeException)
{
}
- void SAL_CALL ZipPackageEntry::addVetoableChangeListener( const OUString& /*PropertyName*/, const Reference< beans::XVetoableChangeListener >& /*aListener*/ )
-void SAL_CALL ZipPackageEntry::addVetoableChangeListener( const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ )
++void SAL_CALL ZipPackageEntry::addVetoableChangeListener( const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ )
throw(beans::UnknownPropertyException, WrappedTargetException, RuntimeException)
{
}
- void SAL_CALL ZipPackageEntry::removeVetoableChangeListener( const OUString& /*PropertyName*/, const Reference< beans::XVetoableChangeListener >& /*aListener*/ )
-void SAL_CALL ZipPackageEntry::removeVetoableChangeListener( const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ )
++void SAL_CALL ZipPackageEntry::removeVetoableChangeListener( const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ )
throw(beans::UnknownPropertyException, WrappedTargetException, RuntimeException)
{
}
diff --cc package/source/zippackage/ZipPackageFolder.cxx
index 67d3414,4384e6f..0528177
--- a/package/source/zippackage/ZipPackageFolder.cxx
+++ b/package/source/zippackage/ZipPackageFolder.cxx
@@@ -193,8 -192,8 +192,8 @@@ const ::com::sun::star::uno::Sequence
}
// XNameContainer
- void SAL_CALL ZipPackageFolder::insertByName( const OUString& aName, const Any& aElement )
- throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
-void SAL_CALL ZipPackageFolder::insertByName( const ::rtl::OUString& aName, const uno::Any& aElement )
++void SAL_CALL ZipPackageFolder::insertByName( const ::rtl::OUString& aName, const uno::Any& aElement )
+ throw(IllegalArgumentException, ElementExistException, WrappedTargetException, uno::RuntimeException)
{
if (hasByName(aName))
throw ElementExistException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
@@@ -227,8 -226,8 +226,8 @@@
throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 0 );
}
}
- void SAL_CALL ZipPackageFolder::removeByName( const OUString& Name )
- throw(NoSuchElementException, WrappedTargetException, RuntimeException)
-void SAL_CALL ZipPackageFolder::removeByName( const ::rtl::OUString& Name )
++void SAL_CALL ZipPackageFolder::removeByName( const ::rtl::OUString& Name )
+ throw(NoSuchElementException, WrappedTargetException, uno::RuntimeException)
{
ContentHash::iterator aIter = maContents.find ( Name );
if ( aIter == maContents.end() )
@@@ -236,19 -235,19 +235,19 @@@
maContents.erase( aIter );
}
// XEnumerationAccess
- Reference< XEnumeration > SAL_CALL ZipPackageFolder::createEnumeration( )
- throw(RuntimeException)
-uno::Reference< XEnumeration > SAL_CALL ZipPackageFolder::createEnumeration( )
++uno::Reference< XEnumeration > SAL_CALL ZipPackageFolder::createEnumeration( )
+ throw(uno::RuntimeException)
{
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list