diff options
Diffstat (limited to 'xmlsecurity/source')
36 files changed, 551 insertions, 538 deletions
diff --git a/xmlsecurity/source/component/certificatecontainer.cxx b/xmlsecurity/source/component/certificatecontainer.cxx index e230c7b2ce83..a5842bf5eaa9 100644 --- a/xmlsecurity/source/component/certificatecontainer.cxx +++ b/xmlsecurity/source/component/certificatecontainer.cxx @@ -126,7 +126,7 @@ CertificateContainer::hasCertificate( const OUString & url, const OUString & cer OUString SAL_CALL CertificateContainer::getImplementationName( ) { - return "com.sun.star.security.CertificateContainer"; + return u"com.sun.star.security.CertificateContainer"_ustr; } sal_Bool SAL_CALL @@ -138,7 +138,7 @@ CertificateContainer::supportsService( const OUString& ServiceName ) Sequence< OUString > SAL_CALL CertificateContainer::getSupportedServiceNames( ) { - return { "com.sun.star.security.CertificateContainer" }; + return { u"com.sun.star.security.CertificateContainer"_ustr }; } extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* diff --git a/xmlsecurity/source/component/documentdigitalsignatures.cxx b/xmlsecurity/source/component/documentdigitalsignatures.cxx index c0f9a58b14f7..3833a76e81e5 100644 --- a/xmlsecurity/source/component/documentdigitalsignatures.cxx +++ b/xmlsecurity/source/component/documentdigitalsignatures.cxx @@ -228,7 +228,7 @@ void DocumentDigitalSignatures::initialize( const Sequence< Any >& aArguments) { if (aArguments.getLength() > 2) throw css::lang::IllegalArgumentException( - "DocumentDigitalSignatures::initialize requires zero, one, or two arguments", + u"DocumentDigitalSignatures::initialize requires zero, one, or two arguments"_ustr, static_cast<XInitialization*>(this), 0); m_nArgumentsCount = aArguments.getLength(); @@ -238,13 +238,13 @@ void DocumentDigitalSignatures::initialize( const Sequence< Any >& aArguments) if (!(aArguments[0] >>= m_sODFVersion)) throw css::lang::IllegalArgumentException( - "DocumentDigitalSignatures::initialize: the first arguments must be a string", + u"DocumentDigitalSignatures::initialize: the first arguments must be a string"_ustr, static_cast<XInitialization*>(this), 0); if (aArguments.getLength() == 2 && !(aArguments[1] >>= m_bHasDocumentSignature)) throw css::lang::IllegalArgumentException( - "DocumentDigitalSignatures::initialize: the second arguments must be a bool", + u"DocumentDigitalSignatures::initialize: the second arguments must be a bool"_ustr, static_cast<XInitialization*>(this), 1); //the Version is supported as of ODF1.2, so for and 1.1 document or older we will receive the @@ -256,7 +256,7 @@ void DocumentDigitalSignatures::initialize( const Sequence< Any >& aArguments) OUString DocumentDigitalSignatures::getImplementationName() { - return "com.sun.star.security.DocumentDigitalSignatures"; + return u"com.sun.star.security.DocumentDigitalSignatures"_ustr; } sal_Bool DocumentDigitalSignatures::supportsService( @@ -268,7 +268,7 @@ sal_Bool DocumentDigitalSignatures::supportsService( css::uno::Sequence<OUString> DocumentDigitalSignatures::getSupportedServiceNames() { - Sequence<OUString> aRet{ "com.sun.star.security.DocumentDigitalSignatures" }; + Sequence<OUString> aRet{ u"com.sun.star.security.DocumentDigitalSignatures"_ustr }; return aRet; } @@ -710,8 +710,8 @@ DocumentDigitalSignatures::chooseCertificatesImpl(std::map<OUString, OUString>& return { Reference< css::security::XCertificate >(nullptr) }; uno::Sequence< Reference< css::security::XCertificate > > xCerts = aChooser->GetSelectedCertificates(); - rProperties["Description"] = aChooser->GetDescription(); - rProperties["Usage"] = aChooser->GetUsageText(); + rProperties[u"Description"_ustr] = aChooser->GetDescription(); + rProperties[u"Usage"_ustr] = aChooser->GetUsageText(); return xCerts; } @@ -725,7 +725,7 @@ Reference< css::security::XCertificate > DocumentDigitalSignatures::chooseSignin { std::map<OUString, OUString> aProperties; Reference< css::security::XCertificate > xCert = chooseCertificatesImpl( aProperties, CertificateChooserUserAction::Sign )[0]; - rDescription = aProperties["Description"]; + rDescription = aProperties[u"Description"_ustr]; return xCert; } @@ -733,7 +733,7 @@ Reference< css::security::XCertificate > DocumentDigitalSignatures::selectSignin { std::map<OUString, OUString> aProperties; Reference< css::security::XCertificate > xCert = chooseCertificatesImpl( aProperties, CertificateChooserUserAction::SelectSign )[0]; - rDescription = aProperties["Description"]; + rDescription = aProperties[u"Description"_ustr]; return xCert; } @@ -744,7 +744,7 @@ DocumentDigitalSignatures::selectSigningCertificateWithType(const CertificateKin std::map<OUString, OUString> aProperties; Reference<css::security::XCertificate> xCert = chooseCertificatesImpl(aProperties, CertificateChooserUserAction::SelectSign, certificateKind)[0]; - rDescription = aProperties["Description"]; + rDescription = aProperties[u"Description"_ustr]; return xCert; } @@ -885,7 +885,7 @@ bool DocumentDigitalSignatures::signWithCertificateImpl( sal_Int32 nSecurityId; - bool bSuccess = aSignatureManager.add(xCertificate, xSecurityContext, "", nSecurityId, true); + bool bSuccess = aSignatureManager.add(xCertificate, xSecurityContext, u""_ustr, nSecurityId, true); if (!bSuccess) return false; diff --git a/xmlsecurity/source/dialogs/certificatechooser.cxx b/xmlsecurity/source/dialogs/certificatechooser.cxx index c95ad1947d0b..0575ae758cfe 100644 --- a/xmlsecurity/source/dialogs/certificatechooser.cxx +++ b/xmlsecurity/source/dialogs/certificatechooser.cxx @@ -41,17 +41,17 @@ using namespace css; CertificateChooser::CertificateChooser(weld::Window* _pParent, std::vector< css::uno::Reference< css::xml::crypto::XXMLSecurityContext > > && rxSecurityContexts, CertificateChooserUserAction eAction) - : GenericDialogController(_pParent, "xmlsec/ui/selectcertificatedialog.ui", "SelectCertificateDialog") + : GenericDialogController(_pParent, u"xmlsec/ui/selectcertificatedialog.ui"_ustr, u"SelectCertificateDialog"_ustr) , meAction(eAction) - , m_xFTSign(m_xBuilder->weld_label("sign")) - , m_xFTEncrypt(m_xBuilder->weld_label("encrypt")) - , m_xCertLB(m_xBuilder->weld_tree_view("signatures")) - , m_xViewBtn(m_xBuilder->weld_button("viewcert")) - , m_xOKBtn(m_xBuilder->weld_button("ok")) - , m_xFTDescription(m_xBuilder->weld_label("description-label")) - , m_xDescriptionED(m_xBuilder->weld_entry("description")) - , m_xSearchBox(m_xBuilder->weld_entry("searchbox")) - , m_xReloadBtn(m_xBuilder->weld_button("reloadcert")) + , m_xFTSign(m_xBuilder->weld_label(u"sign"_ustr)) + , m_xFTEncrypt(m_xBuilder->weld_label(u"encrypt"_ustr)) + , m_xCertLB(m_xBuilder->weld_tree_view(u"signatures"_ustr)) + , m_xViewBtn(m_xBuilder->weld_button(u"viewcert"_ustr)) + , m_xOKBtn(m_xBuilder->weld_button(u"ok"_ustr)) + , m_xFTDescription(m_xBuilder->weld_label(u"description-label"_ustr)) + , m_xDescriptionED(m_xBuilder->weld_entry(u"description"_ustr)) + , m_xSearchBox(m_xBuilder->weld_entry(u"searchbox"_ustr)) + , m_xReloadBtn(m_xBuilder->weld_button(u"reloadcert"_ustr)) { auto nControlWidth = m_xCertLB->get_approximate_digit_width() * 105; m_xCertLB->set_size_request(nControlWidth, m_xCertLB->get_height_rows(12)); diff --git a/xmlsecurity/source/dialogs/certificateviewer.cxx b/xmlsecurity/source/dialogs/certificateviewer.cxx index 62de673c00e4..5d197490bac1 100644 --- a/xmlsecurity/source/dialogs/certificateviewer.cxx +++ b/xmlsecurity/source/dialogs/certificateviewer.cxx @@ -49,23 +49,23 @@ CertificateViewer::CertificateViewer(weld::Window* _pParent, const css::uno::Reference< css::xml::crypto::XSecurityEnvironment >& _rxSecurityEnvironment, const css::uno::Reference< css::security::XCertificate >& _rXCert, bool bCheckForPrivateKey, CertificateChooser* pParentChooser) - : GenericDialogController(_pParent, "xmlsec/ui/viewcertdialog.ui", "ViewCertDialog") + : GenericDialogController(_pParent, u"xmlsec/ui/viewcertdialog.ui"_ustr, u"ViewCertDialog"_ustr) , mbCheckForPrivateKey(bCheckForPrivateKey) , mpParentChooser(pParentChooser) - , mxTabCtrl(m_xBuilder->weld_notebook("tabcontrol")) + , mxTabCtrl(m_xBuilder->weld_notebook(u"tabcontrol"_ustr)) { mxTabCtrl->connect_enter_page(LINK(this, CertificateViewer, ActivatePageHdl)); mxSecurityEnvironment = _rxSecurityEnvironment; mxCert = _rXCert; - mxGeneralPage.reset(new CertificateViewerGeneralTP(mxTabCtrl->get_page("general"), this)); - mxDetailsPage.reset(new CertificateViewerDetailsTP(mxTabCtrl->get_page("details"), this)); + mxGeneralPage.reset(new CertificateViewerGeneralTP(mxTabCtrl->get_page(u"general"_ustr), this)); + mxDetailsPage.reset(new CertificateViewerDetailsTP(mxTabCtrl->get_page(u"details"_ustr), this)); if (!mxSecurityEnvironment->buildCertificatePath(mxCert).hasElements()) - mxTabCtrl->remove_page("path"); + mxTabCtrl->remove_page(u"path"_ustr); else - mxPathId.reset(new CertificateViewerCertPathTP(mxTabCtrl->get_page("path"), this)); - mxTabCtrl->set_current_page("general"); + mxPathId.reset(new CertificateViewerCertPathTP(mxTabCtrl->get_page(u"path"_ustr), this)); + mxTabCtrl->set_current_page(u"general"_ustr); } IMPL_LINK(CertificateViewer, ActivatePageHdl, const OUString&, rPage, void) @@ -83,17 +83,17 @@ CertificateViewerTP::CertificateViewerTP(weld::Container* pParent, const OUStrin } CertificateViewerGeneralTP::CertificateViewerGeneralTP(weld::Container* pParent, CertificateViewer* pDlg) - : CertificateViewerTP(pParent, "xmlsec/ui/certgeneral.ui", "CertGeneral", pDlg) - , m_xCertImg(mxBuilder->weld_image("certimage")) - , m_xHintNotTrustedFT(mxBuilder->weld_label("hintnotrust")) - , m_xIssuedToLabelFT(mxBuilder->weld_label("issued_to")) - , m_xIssuedToFT(mxBuilder->weld_label("issued_to_value")) - , m_xIssuedByLabelFT(mxBuilder->weld_label("issued_by")) - , m_xIssuedByFT(mxBuilder->weld_label("issued_by_value")) - , m_xValidFromDateFT(mxBuilder->weld_label("valid_from_value")) - , m_xValidToDateFT(mxBuilder->weld_label("valid_to_value")) - , m_xKeyImg(mxBuilder->weld_image("keyimage")) - , m_xHintCorrespPrivKeyFT(mxBuilder->weld_label("privatekey")) + : CertificateViewerTP(pParent, u"xmlsec/ui/certgeneral.ui"_ustr, u"CertGeneral"_ustr, pDlg) + , m_xCertImg(mxBuilder->weld_image(u"certimage"_ustr)) + , m_xHintNotTrustedFT(mxBuilder->weld_label(u"hintnotrust"_ustr)) + , m_xIssuedToLabelFT(mxBuilder->weld_label(u"issued_to"_ustr)) + , m_xIssuedToFT(mxBuilder->weld_label(u"issued_to_value"_ustr)) + , m_xIssuedByLabelFT(mxBuilder->weld_label(u"issued_by"_ustr)) + , m_xIssuedByFT(mxBuilder->weld_label(u"issued_by_value"_ustr)) + , m_xValidFromDateFT(mxBuilder->weld_label(u"valid_from_value"_ustr)) + , m_xValidToDateFT(mxBuilder->weld_label(u"valid_to_value"_ustr)) + , m_xKeyImg(mxBuilder->weld_image(u"keyimage"_ustr)) + , m_xHintCorrespPrivKeyFT(mxBuilder->weld_label(u"privatekey"_ustr)) { //Verify the certificate sal_Int32 certStatus = mpDlg->mxSecurityEnvironment->verifyCertificate(mpDlg->mxCert, @@ -157,9 +157,9 @@ void CertificateViewerDetailsTP::InsertElement(const OUString& rField, const OUS } CertificateViewerDetailsTP::CertificateViewerDetailsTP(weld::Container* pParent, CertificateViewer* pDlg) - : CertificateViewerTP(pParent, "xmlsec/ui/certdetails.ui", "CertDetails", pDlg) - , m_xElementsLB(mxBuilder->weld_tree_view("tablecontainer")) - , m_xValueDetails(mxBuilder->weld_text_view("valuedetails")) + : CertificateViewerTP(pParent, u"xmlsec/ui/certdetails.ui"_ustr, u"CertDetails"_ustr, pDlg) + , m_xElementsLB(mxBuilder->weld_tree_view(u"tablecontainer"_ustr)) + , m_xValueDetails(mxBuilder->weld_text_view(u"valuedetails"_ustr)) { const int nWidth = m_xElementsLB->get_approximate_digit_width() * 60; const int nHeight = m_xElementsLB->get_height_rows(8); @@ -252,15 +252,15 @@ IMPL_LINK_NOARG(CertificateViewerDetailsTP, ElementSelectHdl, weld::TreeView&, v } CertificateViewerCertPathTP::CertificateViewerCertPathTP(weld::Container* pParent, CertificateViewer* pDlg) - : CertificateViewerTP(pParent, "xmlsec/ui/certpage.ui", "CertPage", pDlg) + : CertificateViewerTP(pParent, u"xmlsec/ui/certpage.ui"_ustr, u"CertPage"_ustr, pDlg) , mpParent(pDlg) , mbFirstActivateDone(false) - , mxCertPathLB(mxBuilder->weld_tree_view("signatures")) + , mxCertPathLB(mxBuilder->weld_tree_view(u"signatures"_ustr)) , mxScratchIter(mxCertPathLB->make_iterator()) - , mxViewCertPB(mxBuilder->weld_button("viewcert")) - , mxCertStatusML(mxBuilder->weld_text_view("status")) - , mxCertOK(mxBuilder->weld_label("certok")) - , mxCertNotValidated(mxBuilder->weld_label("certnotok")) + , mxViewCertPB(mxBuilder->weld_button(u"viewcert"_ustr)) + , mxCertStatusML(mxBuilder->weld_text_view(u"status"_ustr)) + , mxCertOK(mxBuilder->weld_label(u"certok"_ustr)) + , mxCertNotValidated(mxBuilder->weld_label(u"certnotok"_ustr)) { const int nWidth = mxCertPathLB->get_approximate_digit_width() * 60; const int nHeight = mxCertPathLB->get_height_rows(6); diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx index cfe6845cee34..da396d7ba0a7 100644 --- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx +++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx @@ -193,28 +193,28 @@ DigitalSignaturesDialog::DigitalSignaturesDialog( weld::Window* pParent, const uno::Reference< uno::XComponentContext >& rxCtx, DocumentSignatureMode eMode, bool bReadOnly, OUString sODFVersion, bool bHasDocumentSignature) - : GenericDialogController(pParent, "xmlsec/ui/digitalsignaturesdialog.ui", "DigitalSignaturesDialog") + : GenericDialogController(pParent, u"xmlsec/ui/digitalsignaturesdialog.ui"_ustr, u"DigitalSignaturesDialog"_ustr) , maSignatureManager(rxCtx, eMode) , m_sODFVersion (std::move(sODFVersion)) , m_bHasDocumentSignature(bHasDocumentSignature) , m_bWarningShowSignMacro(false) - , m_xHintDocFT(m_xBuilder->weld_label("dochint")) - , m_xHintBasicFT(m_xBuilder->weld_label("macrohint")) - , m_xHintPackageFT(m_xBuilder->weld_label("packagehint")) - , m_xSignaturesLB(m_xBuilder->weld_tree_view("signatures")) - , m_xSigsValidImg(m_xBuilder->weld_image("validimg")) - , m_xSigsValidFI(m_xBuilder->weld_label("validft")) - , m_xSigsInvalidImg(m_xBuilder->weld_image("invalidimg")) - , m_xSigsInvalidFI(m_xBuilder->weld_label("invalidft")) - , m_xSigsNotvalidatedImg(m_xBuilder->weld_image("notvalidatedimg")) - , m_xSigsNotvalidatedFI(m_xBuilder->weld_label("notvalidatedft")) - , m_xSigsOldSignatureImg(m_xBuilder->weld_image("oldsignatureimg")) - , m_xSigsOldSignatureFI(m_xBuilder->weld_label("oldsignatureft")) - , m_xViewBtn(m_xBuilder->weld_button("view")) - , m_xAddBtn(m_xBuilder->weld_button("sign")) - , m_xRemoveBtn(m_xBuilder->weld_button("remove")) - , m_xStartCertMgrBtn(m_xBuilder->weld_button("start_certmanager")) - , m_xCloseBtn(m_xBuilder->weld_button("close")) + , m_xHintDocFT(m_xBuilder->weld_label(u"dochint"_ustr)) + , m_xHintBasicFT(m_xBuilder->weld_label(u"macrohint"_ustr)) + , m_xHintPackageFT(m_xBuilder->weld_label(u"packagehint"_ustr)) + , m_xSignaturesLB(m_xBuilder->weld_tree_view(u"signatures"_ustr)) + , m_xSigsValidImg(m_xBuilder->weld_image(u"validimg"_ustr)) + , m_xSigsValidFI(m_xBuilder->weld_label(u"validft"_ustr)) + , m_xSigsInvalidImg(m_xBuilder->weld_image(u"invalidimg"_ustr)) + , m_xSigsInvalidFI(m_xBuilder->weld_label(u"invalidft"_ustr)) + , m_xSigsNotvalidatedImg(m_xBuilder->weld_image(u"notvalidatedimg"_ustr)) + , m_xSigsNotvalidatedFI(m_xBuilder->weld_label(u"notvalidatedft"_ustr)) + , m_xSigsOldSignatureImg(m_xBuilder->weld_image(u"oldsignatureimg"_ustr)) + , m_xSigsOldSignatureFI(m_xBuilder->weld_label(u"oldsignatureft"_ustr)) + , m_xViewBtn(m_xBuilder->weld_button(u"view"_ustr)) + , m_xAddBtn(m_xBuilder->weld_button(u"sign"_ustr)) + , m_xRemoveBtn(m_xBuilder->weld_button(u"remove"_ustr)) + , m_xStartCertMgrBtn(m_xBuilder->weld_button(u"start_certmanager"_ustr)) + , m_xCloseBtn(m_xBuilder->weld_button(u"close"_ustr)) { auto nControlWidth = m_xSignaturesLB->get_approximate_digit_width() * 105; m_xSignaturesLB->set_size_request(nControlWidth, m_xSignaturesLB->get_height_rows(10)); @@ -307,7 +307,7 @@ void DigitalSignaturesDialog::SetStorage( const css::uno::Reference < css::embed } // only ODF 1.1 wants to be non-XAdES (m_sODFVersion="1.0" for OOXML somehow?) - m_bAdESCompliant = !rxStore->hasByName("META-INF") // it's a Zip storage + m_bAdESCompliant = !rxStore->hasByName(u"META-INF"_ustr) // it's a Zip storage || !DocumentSignatureHelper::isODFPre_1_2(m_sODFVersion); maSignatureManager.setStore(rxStore); @@ -324,7 +324,7 @@ bool DigitalSignaturesDialog::canAddRemove() //FIXME: this func needs some cleanup, such as real split between //'canAdd' and 'canRemove' case uno::Reference<container::XNameAccess> xNameAccess = maSignatureManager.getStore(); - if (xNameAccess.is() && xNameAccess->hasByName("[Content_Types].xml")) + if (xNameAccess.is() && xNameAccess->hasByName(u"[Content_Types].xml"_ustr)) // It's always possible to append an OOXML signature. return true; @@ -789,7 +789,7 @@ uno::Reference<xml::crypto::XSecurityEnvironment> DigitalSignaturesDialog::getSe case CertificateKind_X509: return maSignatureManager.getSecurityEnvironment(); default: - throw RuntimeException("Unknown certificate kind"); + throw RuntimeException(u"Unknown certificate kind"_ustr); } } diff --git a/xmlsecurity/source/dialogs/macrosecurity.cxx b/xmlsecurity/source/dialogs/macrosecurity.cxx index 9ff7b4088bd7..03b078fcedae 100644 --- a/xmlsecurity/source/dialogs/macrosecurity.cxx +++ b/xmlsecurity/source/dialogs/macrosecurity.cxx @@ -55,18 +55,18 @@ IMPL_LINK_NOARG(MacroSecurity, OkBtnHdl, weld::Button&, void) MacroSecurity::MacroSecurity(weld::Window* pParent, css::uno::Reference<css::xml::crypto::XSecurityEnvironment> xSecurityEnvironment) - : GenericDialogController(pParent, "xmlsec/ui/macrosecuritydialog.ui", "MacroSecurityDialog") + : GenericDialogController(pParent, u"xmlsec/ui/macrosecuritydialog.ui"_ustr, u"MacroSecurityDialog"_ustr) , m_xSecurityEnvironment(std::move(xSecurityEnvironment)) - , m_xTabCtrl(m_xBuilder->weld_notebook("tabcontrol")) - , m_xOkBtn(m_xBuilder->weld_button("ok")) - , m_xResetBtn(m_xBuilder->weld_button("reset")) + , m_xTabCtrl(m_xBuilder->weld_notebook(u"tabcontrol"_ustr)) + , m_xOkBtn(m_xBuilder->weld_button(u"ok"_ustr)) + , m_xResetBtn(m_xBuilder->weld_button(u"reset"_ustr)) { m_xTabCtrl->connect_enter_page(LINK(this, MacroSecurity, ActivatePageHdl)); - m_xLevelTP.reset(new MacroSecurityLevelTP(m_xTabCtrl->get_page("SecurityLevelPage"), this)); - m_xTrustSrcTP.reset(new MacroSecurityTrustedSourcesTP(m_xTabCtrl->get_page("SecurityTrustPage"), this)); + m_xLevelTP.reset(new MacroSecurityLevelTP(m_xTabCtrl->get_page(u"SecurityLevelPage"_ustr), this)); + m_xTrustSrcTP.reset(new MacroSecurityTrustedSourcesTP(m_xTabCtrl->get_page(u"SecurityTrustPage"_ustr), this)); - m_xTabCtrl->set_current_page("SecurityLevelPage"); + m_xTabCtrl->set_current_page(u"SecurityLevelPage"_ustr); m_xOkBtn->connect_clicked(LINK(this, MacroSecurity, OkBtnHdl)); } @@ -95,18 +95,18 @@ MacroSecurityTP::~MacroSecurityTP() } MacroSecurityLevelTP::MacroSecurityLevelTP(weld::Container* pParent, MacroSecurity* pDlg) - : MacroSecurityTP(pParent, "xmlsec/ui/securitylevelpage.ui", "SecurityLevelPage", pDlg) - , m_xVeryHighRB(m_xBuilder->weld_radio_button("vhigh")) - , m_xHighRB(m_xBuilder->weld_radio_button("high")) - , m_xMediumRB(m_xBuilder->weld_radio_button("med")) - , m_xLowRB(m_xBuilder->weld_radio_button("low")) - , m_xVHighImg(m_xBuilder->weld_widget("vhighimg")) - , m_xHighImg(m_xBuilder->weld_widget("highimg")) - , m_xMedImg(m_xBuilder->weld_widget("medimg")) - , m_xLowImg(m_xBuilder->weld_widget("lowimg")) - , m_xWarningLb(m_xBuilder->weld_label("warningmsg")) - , m_xWarningImg(m_xBuilder->weld_image("warningimg")) - , m_xWarningBox(m_xBuilder->weld_box("warningbox")) + : MacroSecurityTP(pParent, u"xmlsec/ui/securitylevelpage.ui"_ustr, u"SecurityLevelPage"_ustr, pDlg) + , m_xVeryHighRB(m_xBuilder->weld_radio_button(u"vhigh"_ustr)) + , m_xHighRB(m_xBuilder->weld_radio_button(u"high"_ustr)) + , m_xMediumRB(m_xBuilder->weld_radio_button(u"med"_ustr)) + , m_xLowRB(m_xBuilder->weld_radio_button(u"low"_ustr)) + , m_xVHighImg(m_xBuilder->weld_widget(u"vhighimg"_ustr)) + , m_xHighImg(m_xBuilder->weld_widget(u"highimg"_ustr)) + , m_xMedImg(m_xBuilder->weld_widget(u"medimg"_ustr)) + , m_xLowImg(m_xBuilder->weld_widget(u"lowimg"_ustr)) + , m_xWarningLb(m_xBuilder->weld_label(u"warningmsg"_ustr)) + , m_xWarningImg(m_xBuilder->weld_image(u"warningimg"_ustr)) + , m_xWarningBox(m_xBuilder->weld_box(u"warningbox"_ustr)) { m_xLowRB->connect_toggled( LINK( this, MacroSecurityLevelTP, RadioButtonHdl ) ); m_xMediumRB->connect_toggled( LINK( this, MacroSecurityLevelTP, RadioButtonHdl ) ); @@ -170,7 +170,7 @@ MacroSecurityLevelTP::MacroSecurityLevelTP(weld::Container* pParent, MacroSecuri m_xLowRB->set_sensitive(false); } - SetWarningLabel(""); + SetWarningLabel(u""_ustr); // Use same font color as in InfobarType::WARNING m_xWarningLb->set_font_color(Color(0x70, 0x43, 0x00)); m_xWarningImg->set_size_request(24, 24); @@ -214,7 +214,7 @@ IMPL_LINK_NOARG(MacroSecurityLevelTP, RadioButtonHdl, weld::Toggleable&, void) SetWarningLabel(XsResId(STR_RELOAD_FILE_WARNING)); else { - SetWarningLabel(""); + SetWarningLabel(u""_ustr); } } @@ -398,15 +398,15 @@ void MacroSecurityTrustedSourcesTP::FillCertLB(const bool bShowWarnings) } MacroSecurityTrustedSourcesTP::MacroSecurityTrustedSourcesTP(weld::Container* pParent, MacroSecurity* pDlg) - : MacroSecurityTP(pParent, "xmlsec/ui/securitytrustpage.ui", "SecurityTrustPage", pDlg) - , m_xTrustCertROFI(m_xBuilder->weld_image("lockcertimg")) - , m_xTrustCertLB(m_xBuilder->weld_tree_view("certificates")) - , m_xViewCertPB(m_xBuilder->weld_button("viewcert")) - , m_xRemoveCertPB(m_xBuilder->weld_button("removecert")) - , m_xTrustFileROFI(m_xBuilder->weld_image("lockfileimg")) - , m_xTrustFileLocLB(m_xBuilder->weld_tree_view("locations")) - , m_xAddLocPB(m_xBuilder->weld_button("addfile")) - , m_xRemoveLocPB(m_xBuilder->weld_button("removefile")) + : MacroSecurityTP(pParent, u"xmlsec/ui/securitytrustpage.ui"_ustr, u"SecurityTrustPage"_ustr, pDlg) + , m_xTrustCertROFI(m_xBuilder->weld_image(u"lockcertimg"_ustr)) + , m_xTrustCertLB(m_xBuilder->weld_tree_view(u"certificates"_ustr)) + , m_xViewCertPB(m_xBuilder->weld_button(u"viewcert"_ustr)) + , m_xRemoveCertPB(m_xBuilder->weld_button(u"removecert"_ustr)) + , m_xTrustFileROFI(m_xBuilder->weld_image(u"lockfileimg"_ustr)) + , m_xTrustFileLocLB(m_xBuilder->weld_tree_view(u"locations"_ustr)) + , m_xAddLocPB(m_xBuilder->weld_button(u"addfile"_ustr)) + , m_xRemoveLocPB(m_xBuilder->weld_button(u"removefile"_ustr)) { auto nColWidth = m_xTrustCertLB->get_approximate_digit_width() * 12; std::vector<int> aWidths diff --git a/xmlsecurity/source/framework/saxeventkeeperimpl.cxx b/xmlsecurity/source/framework/saxeventkeeperimpl.cxx index b490e24327d3..8a0da7185dcc 100644 --- a/xmlsecurity/source/framework/saxeventkeeperimpl.cxx +++ b/xmlsecurity/source/framework/saxeventkeeperimpl.cxx @@ -1127,12 +1127,12 @@ void SAL_CALL SAXEventKeeperImpl::initialize( const css::uno::Sequence< css::uno OUString SAXEventKeeperImpl_getImplementationName () { - return "com.sun.star.xml.security.framework.SAXEventKeeperImpl"; + return u"com.sun.star.xml.security.framework.SAXEventKeeperImpl"_ustr; } css::uno::Sequence< OUString > SAXEventKeeperImpl_getSupportedServiceNames( ) { - return { "com.sun.star.xml.crypto.sax.SAXEventKeeper" }; + return { u"com.sun.star.xml.crypto.sax.SAXEventKeeper"_ustr }; } /* XServiceInfo */ diff --git a/xmlsecurity/source/framework/signaturecreatorimpl.cxx b/xmlsecurity/source/framework/signaturecreatorimpl.cxx index 4371b7ae696d..ebb796bd8350 100644 --- a/xmlsecurity/source/framework/signaturecreatorimpl.cxx +++ b/xmlsecurity/source/framework/signaturecreatorimpl.cxx @@ -148,12 +148,12 @@ void SAL_CALL SignatureCreatorImpl::initialize( const css::uno::Sequence< css::u OUString SignatureCreatorImpl_getImplementationName () { - return "com.sun.star.xml.security.framework.SignatureCreatorImpl"; + return u"com.sun.star.xml.security.framework.SignatureCreatorImpl"_ustr; } css::uno::Sequence< OUString > SignatureCreatorImpl_getSupportedServiceNames( ) { - return { "com.sun.star.xml.crypto.sax.SignatureCreator" }; + return { u"com.sun.star.xml.crypto.sax.SignatureCreator"_ustr }; } /* XServiceInfo */ diff --git a/xmlsecurity/source/framework/signatureverifierimpl.cxx b/xmlsecurity/source/framework/signatureverifierimpl.cxx index 44e9e4c0a46c..b96050d5c0bd 100644 --- a/xmlsecurity/source/framework/signatureverifierimpl.cxx +++ b/xmlsecurity/source/framework/signatureverifierimpl.cxx @@ -103,12 +103,12 @@ void SAL_CALL SignatureVerifierImpl::initialize( OUString SignatureVerifierImpl_getImplementationName () { - return "com.sun.star.xml.security.framework.SignatureVerifierImpl"; + return u"com.sun.star.xml.security.framework.SignatureVerifierImpl"_ustr; } css::uno::Sequence< OUString > SignatureVerifierImpl_getSupportedServiceNames( ) { - return { "com.sun.star.xml.crypto.sax.SignatureVerifier" }; + return { u"com.sun.star.xml.crypto.sax.SignatureVerifier"_ustr }; } /* XServiceInfo */ diff --git a/xmlsecurity/source/framework/xmlsignaturetemplateimpl.cxx b/xmlsecurity/source/framework/xmlsignaturetemplateimpl.cxx index 203f0fea2072..3553a77f7e87 100644 --- a/xmlsecurity/source/framework/xmlsignaturetemplateimpl.cxx +++ b/xmlsecurity/source/framework/xmlsignaturetemplateimpl.cxx @@ -98,12 +98,12 @@ Sequence< OUString > SAL_CALL XMLSignatureTemplateImpl::getSupportedServiceNames //Helper for XServiceInfo Sequence< OUString > XMLSignatureTemplateImpl::impl_getSupportedServiceNames() { - Sequence<OUString> seqServiceNames { "com.sun.star.xml.crypto.XMLSignatureTemplate" }; + Sequence<OUString> seqServiceNames { u"com.sun.star.xml.crypto.XMLSignatureTemplate"_ustr }; return seqServiceNames ; } OUString XMLSignatureTemplateImpl::impl_getImplementationName() { - return "com.sun.star.xml.security.framework.XMLSignatureTemplateImpl" ; + return u"com.sun.star.xml.security.framework.XMLSignatureTemplateImpl"_ustr ; } //Helper for registry diff --git a/xmlsecurity/source/gpg/CertificateImpl.cxx b/xmlsecurity/source/gpg/CertificateImpl.cxx index 563011e6d688..7e3d942313d6 100644 --- a/xmlsecurity/source/gpg/CertificateImpl.cxx +++ b/xmlsecurity/source/gpg/CertificateImpl.cxx @@ -133,7 +133,7 @@ Sequence< sal_Int8 > SAL_CALL CertificateImpl::getEncoded() ); if (err) - throw RuntimeException("The GpgME library failed to retrieve the public key"); + throw RuntimeException(u"The GpgME library failed to retrieve the public key"_ustr); off_t result = data_out.seek(0,SEEK_SET); (void) result; @@ -147,7 +147,7 @@ Sequence< sal_Int8 > SAL_CALL CertificateImpl::getEncoded() result = data_out.seek(0,SEEK_SET); assert(result == 0); if( data_out.read(m_aBits.getArray(), len) != len ) - throw RuntimeException("The GpgME library failed to read the key"); + throw RuntimeException(u"The GpgME library failed to read the key"_ustr); // Export key to base64Empty for gpg return m_aBits; @@ -234,7 +234,7 @@ const GpgME::Key* CertificateImpl::getCertificate() const /* XServiceInfo */ OUString SAL_CALL CertificateImpl::getImplementationName() { - return "com.sun.star.xml.security.gpg.XCertificate_GpgImpl"; + return u"com.sun.star.xml.security.gpg.XCertificate_GpgImpl"_ustr; } /* XServiceInfo */ diff --git a/xmlsecurity/source/gpg/SEInitializer.cxx b/xmlsecurity/source/gpg/SEInitializer.cxx index 5cfe325aa88b..e81407bef8d8 100644 --- a/xmlsecurity/source/gpg/SEInitializer.cxx +++ b/xmlsecurity/source/gpg/SEInitializer.cxx @@ -62,12 +62,12 @@ sal_Bool SAL_CALL SEInitializerGpg::supportsService(const OUString& rServiceName uno::Sequence<OUString> SAL_CALL SEInitializerGpg::getSupportedServiceNames() { - return { "com.sun.star.xml.crypto.GPGSEInitializer" }; + return { u"com.sun.star.xml.crypto.GPGSEInitializer"_ustr }; } OUString SAL_CALL SEInitializerGpg::getImplementationName() { - return "com.sun.star.xml.security.SEInitializer_Gpg"; + return u"com.sun.star.xml.security.SEInitializer_Gpg"_ustr; } extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface* diff --git a/xmlsecurity/source/gpg/SecurityEnvironment.cxx b/xmlsecurity/source/gpg/SecurityEnvironment.cxx index 1fed32d5399e..371291ab5cd2 100644 --- a/xmlsecurity/source/gpg/SecurityEnvironment.cxx +++ b/xmlsecurity/source/gpg/SecurityEnvironment.cxx @@ -79,11 +79,11 @@ SecurityEnvironmentGpg::SecurityEnvironmentGpg() #endif GpgME::Error err = GpgME::checkEngine(GpgME::OpenPGP); if (err) - throw RuntimeException("The GpgME library failed to initialize for the OpenPGP protocol."); + throw RuntimeException(u"The GpgME library failed to initialize for the OpenPGP protocol."_ustr); m_ctx.reset( GpgME::Context::createForProtocol(GpgME::OpenPGP) ); if (m_ctx == nullptr) - throw RuntimeException("The GpgME library failed to initialize for the OpenPGP protocol."); + throw RuntimeException(u"The GpgME library failed to initialize for the OpenPGP protocol."_ustr); m_ctx->setArmor(false); } @@ -144,7 +144,7 @@ Reference< XCertificate > SecurityEnvironmentGpg::getCertificate( const OUString xmlSecSize nWritten; int nRet = xmlSecBase64Decode_ex(strKeyId, const_cast<xmlSecByte*>(strKeyId), xmlStrlen(strKeyId), &nWritten); if(nRet < 0) - throw RuntimeException("Base64 decode failed"); + throw RuntimeException(u"Base64 decode failed"_ustr); m_ctx->setKeyListMode(GPGME_KEYLIST_MODE_LOCAL); GpgME::Error err = m_ctx->startKeyListing("", false); diff --git a/xmlsecurity/source/gpg/XMLSecurityContext.cxx b/xmlsecurity/source/gpg/XMLSecurityContext.cxx index 1fb407113f7a..1dbbb0e2183f 100644 --- a/xmlsecurity/source/gpg/XMLSecurityContext.cxx +++ b/xmlsecurity/source/gpg/XMLSecurityContext.cxx @@ -27,7 +27,7 @@ sal_Int32 SAL_CALL XMLSecurityContextGpg::addSecurityEnvironment( const Reference<XSecurityEnvironment>& aSecurityEnvironment) { if (!aSecurityEnvironment.is()) - throw RuntimeException("Invalid SecurityEnvironment given!"); + throw RuntimeException(u"Invalid SecurityEnvironment given!"_ustr); m_vSecurityEnvironments.push_back(aSecurityEnvironment); return m_vSecurityEnvironments.size() - 1; @@ -42,7 +42,7 @@ Reference<XSecurityEnvironment> SAL_CALL XMLSecurityContextGpg::getSecurityEnvironmentByIndex(sal_Int32 index) { if (index < 0 || o3tl::make_unsigned(index) >= m_vSecurityEnvironments.size()) - throw RuntimeException("Invalid index"); + throw RuntimeException(u"Invalid index"_ustr); return m_vSecurityEnvironments[index]; } @@ -51,7 +51,7 @@ Reference<XSecurityEnvironment> SAL_CALL XMLSecurityContextGpg::getSecurityEnvir { if (m_nDefaultEnvIndex < 0 || o3tl::make_unsigned(m_nDefaultEnvIndex) >= m_vSecurityEnvironments.size()) - throw RuntimeException("Invalid index"); + throw RuntimeException(u"Invalid index"_ustr); return getSecurityEnvironmentByIndex(m_nDefaultEnvIndex); } @@ -69,7 +69,7 @@ void SAL_CALL XMLSecurityContextGpg::setDefaultSecurityEnvironmentIndex(sal_Int3 /* XServiceInfo */ OUString SAL_CALL XMLSecurityContextGpg::getImplementationName() { - return "com.sun.star.xml.security.gpg.XMLSecurityContext_GpgImpl"; + return u"com.sun.star.xml.security.gpg.XMLSecurityContext_GpgImpl"_ustr; } /* XServiceInfo */ @@ -81,7 +81,7 @@ sal_Bool SAL_CALL XMLSecurityContextGpg::supportsService(const OUString& service /* XServiceInfo */ Sequence<OUString> SAL_CALL XMLSecurityContextGpg::getSupportedServiceNames() { - return { OUString("com.sun.star.xml.crypto.XMLSecurityContext") }; + return { u"com.sun.star.xml.crypto.XMLSecurityContext"_ustr }; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx b/xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx index 04b4bec56ec3..2eff021eb38f 100644 --- a/xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx +++ b/xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx @@ -166,10 +166,10 @@ SAL_CALL XMLSignature_GpgImpl::generate( // TODO assert that... nodeset = xmlSecNodeSetGetChildren(pNode->doc, cur, 1, 0); if(nodeset == nullptr) - throw RuntimeException("The GpgME library failed to initialize for the OpenPGP protocol."); + throw RuntimeException(u"The GpgME library failed to initialize for the OpenPGP protocol."_ustr); if( xmlSecTransformCtxXmlExecute(&(pDsigCtx->transformCtx), nodeset) < 0 ) - throw RuntimeException("The GpgME library failed to initialize for the OpenPGP protocol."); + throw RuntimeException(u"The GpgME library failed to initialize for the OpenPGP protocol."_ustr); // now extract the keyid from PGPData // walk xml tree to PGPData node - go to children, first is @@ -182,12 +182,12 @@ SAL_CALL XMLSignature_GpgImpl::generate( cur = xmlSecGetNextElementNode(cur->children); // check that this is now PGPData if(!xmlSecCheckNodeName(cur, xmlSecNodePGPData, xmlSecDSigNs)) - throw RuntimeException("The GpgME library failed to initialize for the OpenPGP protocol."); + throw RuntimeException(u"The GpgME library failed to initialize for the OpenPGP protocol."_ustr); // check that this is now PGPKeyID cur = xmlSecGetNextElementNode(cur->children); static const xmlChar xmlSecNodePGPKeyID[] = "PGPKeyID"; if(!xmlSecCheckNodeName(cur, xmlSecNodePGPKeyID, xmlSecDSigNs)) - throw RuntimeException("The GpgME library failed to initialize for the OpenPGP protocol."); + throw RuntimeException(u"The GpgME library failed to initialize for the OpenPGP protocol."_ustr); GpgME::Context& rCtx=pSecEnv->getGpgContext(); rCtx.setKeyListMode(GPGME_KEYLIST_MODE_LOCAL); @@ -196,11 +196,11 @@ SAL_CALL XMLSignature_GpgImpl::generate( xmlSecSize nWritten; int nRet = xmlSecBase64Decode_ex(pKey, reinterpret_cast<xmlSecByte*>(pKey), xmlStrlen(pKey), &nWritten); if(nRet < 0) - throw RuntimeException("The GpgME library failed to initialize for the OpenPGP protocol."); + throw RuntimeException(u"The GpgME library failed to initialize for the OpenPGP protocol."_ustr); if( rCtx.addSigningKey( rCtx.key( reinterpret_cast<char*>(pKey), err, true)) ) - throw RuntimeException("The GpgME library failed to initialize for the OpenPGP protocol."); + throw RuntimeException(u"The GpgME library failed to initialize for the OpenPGP protocol."_ustr); xmlFree(pKey); @@ -224,21 +224,21 @@ SAL_CALL XMLSignature_GpgImpl::generate( len += curr; if(sign_res.error() || !len) - throw RuntimeException("The GpgME library failed to initialize for the OpenPGP protocol."); + throw RuntimeException(u"The GpgME library failed to initialize for the OpenPGP protocol."_ustr); // write signed data to xml xmlChar* signature = static_cast<xmlChar*>(xmlMalloc(len + 1)); if(signature == nullptr) - throw RuntimeException("The GpgME library failed to initialize for the OpenPGP protocol."); + throw RuntimeException(u"The GpgME library failed to initialize for the OpenPGP protocol."_ustr); result = data_out.seek(0,SEEK_SET); assert(result == 0); if( data_out.read(signature, len) != len ) - throw RuntimeException("The GpgME library failed to initialize for the OpenPGP protocol."); + throw RuntimeException(u"The GpgME library failed to initialize for the OpenPGP protocol."_ustr); // conversion to base64 xmlChar* signatureEncoded=nullptr; if( !(signatureEncoded=xmlSecBase64Encode(reinterpret_cast<xmlSecByte*>(signature), len, 79)) ) - throw RuntimeException("The GpgME library failed to initialize for the OpenPGP protocol."); + throw RuntimeException(u"The GpgME library failed to initialize for the OpenPGP protocol."_ustr); xmlFree(signature); // walk xml tree to sign value node - go to children, first is @@ -340,11 +340,11 @@ SAL_CALL XMLSignature_GpgImpl::validate( // TODO assert that... nodeset = xmlSecNodeSetGetChildren(pNode->doc, cur, 1, 0); if(nodeset == nullptr) - throw RuntimeException("The GpgME library failed to initialize for the OpenPGP protocol."); + throw RuntimeException(u"The GpgME library failed to initialize for the OpenPGP protocol."_ustr); // TODO assert we really have the SignatureInfo here? if( xmlSecTransformCtxXmlExecute(&(pDsigCtx->transformCtx), nodeset) < 0 ) - throw RuntimeException("The GpgME library failed to initialize for the OpenPGP protocol."); + throw RuntimeException(u"The GpgME library failed to initialize for the OpenPGP protocol."_ustr); // Validate the template via gpgme GpgME::Context& rCtx=pSecEnv->getGpgContext(); @@ -361,12 +361,12 @@ SAL_CALL XMLSignature_GpgImpl::validate( cur = xmlSecGetNextElementNode(cur->next); if(!xmlSecCheckNodeName(cur, xmlSecNodeSignatureValue, xmlSecDSigNs)) - throw RuntimeException("The GpgME library failed to initialize for the OpenPGP protocol."); + throw RuntimeException(u"The GpgME library failed to initialize for the OpenPGP protocol."_ustr); xmlChar* pSignatureValue=xmlNodeGetContent(cur); xmlSecSize nSigSize; int nRet = xmlSecBase64Decode_ex(pSignatureValue, reinterpret_cast<xmlSecByte*>(pSignatureValue), xmlStrlen(pSignatureValue), &nSigSize); if( nRet < 0) - throw RuntimeException("The GpgME library failed to initialize for the OpenPGP protocol."); + throw RuntimeException(u"The GpgME library failed to initialize for the OpenPGP protocol."_ustr); GpgME::Data data_signature( reinterpret_cast<char*>(pSignatureValue), @@ -396,7 +396,7 @@ SAL_CALL XMLSignature_GpgImpl::validate( cur = xmlSecGetNextElementNode(cur->children); // check that this is now PGPData if(!xmlSecCheckNodeName(cur, xmlSecNodePGPData, xmlSecDSigNs)) - throw RuntimeException("The GpgME library failed to initialize for the OpenPGP protocol."); + throw RuntimeException(u"The GpgME library failed to initialize for the OpenPGP protocol."_ustr); // check that this is now PGPKeyPacket cur = xmlSecGetNextElementNode(cur->children); static const xmlChar xmlSecNodePGPKeyPacket[] = "PGPKeyPacket"; @@ -419,7 +419,7 @@ SAL_CALL XMLSignature_GpgImpl::validate( xmlSecSize nKeyLen; nRet = xmlSecBase64Decode_ex(pKeyPacket, reinterpret_cast<xmlSecByte*>(pKeyPacket), xmlStrlen(pKeyPacket), &nKeyLen); if( nRet < 0) - throw RuntimeException("The GpgME library failed to initialize for the OpenPGP protocol."); + throw RuntimeException(u"The GpgME library failed to initialize for the OpenPGP protocol."_ustr); GpgME::Data data_key( reinterpret_cast<char*>(pKeyPacket), @@ -518,12 +518,12 @@ Sequence< OUString > SAL_CALL XMLSignature_GpgImpl::getSupportedServiceNames() { //Helper for XServiceInfo Sequence< OUString > XMLSignature_GpgImpl::impl_getSupportedServiceNames() { - Sequence<OUString> seqServiceNames { "com.sun.star.xml.crypto.XMLSignature" }; + Sequence<OUString> seqServiceNames { u"com.sun.star.xml.crypto.XMLSignature"_ustr }; return seqServiceNames ; } OUString XMLSignature_GpgImpl::impl_getImplementationName() { - return "com.sun.star.xml.security.bridge.xmlsec.XMLSignature_GpgImpl" ; + return u"com.sun.star.xml.security.bridge.xmlsec.XMLSignature_GpgImpl"_ustr ; } //Helper for registry diff --git a/xmlsecurity/source/helper/UriBindingHelper.cxx b/xmlsecurity/source/helper/UriBindingHelper.cxx index 9bd101934e47..52cf6d07a4fa 100644 --- a/xmlsecurity/source/helper/UriBindingHelper.cxx +++ b/xmlsecurity/source/helper/UriBindingHelper.cxx @@ -83,7 +83,7 @@ uno::Reference < io::XInputStream > UriBindingHelper::OpenInputStream( const uno const OUString sName = ::rtl::Uri::decode( aURI, rtl_UriDecodeStrict, rtl_UriCharClassRelSegment); if (sName.isEmpty() && !aURI.isEmpty()) - throw uno::Exception("Could not decode URI for stream element.", nullptr); + throw uno::Exception(u"Could not decode URI for stream element."_ustr, nullptr); uno::Reference< io::XStream > xStream; if (!rxStore->hasByName(sName)) @@ -99,7 +99,7 @@ uno::Reference < io::XInputStream > UriBindingHelper::OpenInputStream( const uno const OUString aStoreName = ::rtl::Uri::decode( aURI.copy( 0, nSepPos ), rtl_UriDecodeStrict, rtl_UriCharClassRelSegment); if (aStoreName.isEmpty() && !aURI.isEmpty()) - throw uno::Exception("Could not decode URI for stream element.", nullptr); + throw uno::Exception(u"Could not decode URI for stream element."_ustr, nullptr); OUString aElement = aURI.copy( nSepPos+1 ); uno::Reference < embed::XStorage > xSubStore = rxStore->openStorageElement( aStoreName, embed::ElementModes::READ ); diff --git a/xmlsecurity/source/helper/documentsignaturehelper.cxx b/xmlsecurity/source/helper/documentsignaturehelper.cxx index 8e666b14ba6e..b35c709915f4 100644 --- a/xmlsecurity/source/helper/documentsignaturehelper.cxx +++ b/xmlsecurity/source/helper/documentsignaturehelper.cxx @@ -109,7 +109,7 @@ static void ImplFillElementList( rName, rtl_UriCharClassRelSegment, rtl_UriEncodeStrict, RTL_TEXTENCODING_UTF8); if (sEncName.isEmpty() && !rName.isEmpty()) - throw css::uno::RuntimeException("Failed to encode element name of XStorage", nullptr); + throw css::uno::RuntimeException(u"Failed to encode element name of XStorage"_ustr, nullptr); if ( rxStore->isStreamElement( rName ) ) { @@ -184,7 +184,7 @@ DocumentSignatureHelper::CreateElementList( const DocumentSignatureAlgorithm mode) { std::vector< OUString > aElements; - OUString aSep( "/" ); + OUString aSep( u"/"_ustr ); switch ( eMode ) { @@ -196,7 +196,7 @@ DocumentSignatureHelper::CreateElementList( ImplFillElementList(aElements, rxStore, std::u16string_view(), false, mode); // 2) Pictures... - OUString aSubStorageName( "Pictures" ); + OUString aSubStorageName( u"Pictures"_ustr ); try { Reference < css::embed::XStorage > xSubStore = rxStore->openStorageElement( aSubStorageName, css::embed::ElementModes::READ ); @@ -243,7 +243,7 @@ DocumentSignatureHelper::CreateElementList( case DocumentSignatureMode::Macros: { // 1) Macros - OUString aSubStorageName( "Basic" ); + OUString aSubStorageName( u"Basic"_ustr ); try { Reference < css::embed::XStorage > xSubStore = rxStore->openStorageElement( aSubStorageName, css::embed::ElementModes::READ ); @@ -294,11 +294,11 @@ DocumentSignatureHelper::CreateElementList( void DocumentSignatureHelper::AppendContentTypes(const uno::Reference<embed::XStorage>& xStorage, std::vector<OUString>& rElements) { - if (!xStorage.is() || !xStorage->hasByName("[Content_Types].xml")) + if (!xStorage.is() || !xStorage->hasByName(u"[Content_Types].xml"_ustr)) // ODF return; - uno::Reference<io::XInputStream> xRelStream(xStorage->openStreamElement("[Content_Types].xml", embed::ElementModes::READ), uno::UNO_QUERY); + uno::Reference<io::XInputStream> xRelStream(xStorage->openStreamElement(u"[Content_Types].xml"_ustr, embed::ElementModes::READ), uno::UNO_QUERY); uno::Sequence< uno::Sequence<beans::StringPair> > aContentTypeInfo = comphelper::OFOPXMLHelper::ReadContentTypeSequence(xRelStream, comphelper::getProcessComponentContext()); if (aContentTypeInfo.getLength() < 2) { @@ -349,11 +349,11 @@ SignatureStreamHelper DocumentSignatureHelper::OpenSignatureStream( if (!rxStore.is()) return aHelper; - if (rxStore->hasByName("META-INF")) + if (rxStore->hasByName(u"META-INF"_ustr)) { try { - aHelper.xSignatureStorage = rxStore->openStorageElement( "META-INF", nSubStorageOpenMode ); + aHelper.xSignatureStorage = rxStore->openStorageElement( u"META-INF"_ustr, nSubStorageOpenMode ); if ( aHelper.xSignatureStorage.is() ) { OUString aSIGStreamName; @@ -376,7 +376,7 @@ SignatureStreamHelper DocumentSignatureHelper::OpenSignatureStream( uno::UNO_QUERY); sal_Int64 nSize = 0; uno::Reference<beans::XPropertySet> xPropertySet(xInputStream, uno::UNO_QUERY); - xPropertySet->getPropertyValue("Size") >>= nSize; + xPropertySet->getPropertyValue(u"Size"_ustr) >>= nSize; if (nSize >= 0 || nSize < SAL_MAX_INT32) { uno::Sequence<sal_Int8> aData; @@ -400,15 +400,15 @@ SignatureStreamHelper DocumentSignatureHelper::OpenSignatureStream( SAL_WARN_IF( nOpenMode != css::embed::ElementModes::READ, "xmlsecurity.helper", "Error creating signature stream..." ); } } - else if(rxStore->hasByName("[Content_Types].xml")) + else if(rxStore->hasByName(u"[Content_Types].xml"_ustr)) { try { - if (rxStore->hasByName("_xmlsignatures") && (nOpenMode & embed::ElementModes::TRUNCATE)) + if (rxStore->hasByName(u"_xmlsignatures"_ustr) && (nOpenMode & embed::ElementModes::TRUNCATE)) // Truncate, then all signatures will be written -> remove previous ones. - rxStore->removeElement("_xmlsignatures"); + rxStore->removeElement(u"_xmlsignatures"_ustr); - aHelper.xSignatureStorage = rxStore->openStorageElement("_xmlsignatures", nSubStorageOpenMode); + aHelper.xSignatureStorage = rxStore->openStorageElement(u"_xmlsignatures"_ustr, nSubStorageOpenMode); aHelper.nStorageFormat = embed::StorageFormats::OFOPXML; } catch (const io::IOException&) @@ -428,7 +428,7 @@ bool DocumentSignatureHelper::CanSignWithGPG( if (!rxStore.is()) return false; - if (rxStore->hasByName("META-INF")) // ODF + if (rxStore->hasByName(u"META-INF"_ustr)) // ODF { return !isODFPre_1_2(sOdfVersion); } @@ -505,49 +505,49 @@ bool DocumentSignatureHelper::equalsReferenceUriManifestPath( OUString DocumentSignatureHelper::GetDocumentContentSignatureDefaultStreamName() { - return "documentsignatures.xml"; + return u"documentsignatures.xml"_ustr; } OUString DocumentSignatureHelper::GetScriptingContentSignatureDefaultStreamName() { - return "macrosignatures.xml"; + return u"macrosignatures.xml"_ustr; } OUString DocumentSignatureHelper::GetPackageSignatureDefaultStreamName() { - return "packagesignatures.xml"; + return u"packagesignatures.xml"_ustr; } void DocumentSignatureHelper::writeDigestMethod( const uno::Reference<xml::sax::XDocumentHandler>& xDocumentHandler) { rtl::Reference<comphelper::AttributeList> pAttributeList(new comphelper::AttributeList()); - pAttributeList->AddAttribute("Algorithm", ALGO_XMLDSIGSHA256); - xDocumentHandler->startElement("DigestMethod", uno::Reference<xml::sax::XAttributeList>(pAttributeList)); - xDocumentHandler->endElement("DigestMethod"); + pAttributeList->AddAttribute(u"Algorithm"_ustr, ALGO_XMLDSIGSHA256); + xDocumentHandler->startElement(u"DigestMethod"_ustr, uno::Reference<xml::sax::XAttributeList>(pAttributeList)); + xDocumentHandler->endElement(u"DigestMethod"_ustr); } static void WriteXadesCert( uno::Reference<xml::sax::XDocumentHandler> const& xDocumentHandler, SignatureInformation::X509CertInfo const& rCertInfo) { - xDocumentHandler->startElement("xd:Cert", uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); - xDocumentHandler->startElement("xd:CertDigest", uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); + xDocumentHandler->startElement(u"xd:Cert"_ustr, uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); + xDocumentHandler->startElement(u"xd:CertDigest"_ustr, uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); DocumentSignatureHelper::writeDigestMethod(xDocumentHandler); - xDocumentHandler->startElement("DigestValue", uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); + xDocumentHandler->startElement(u"DigestValue"_ustr, uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); assert(!rCertInfo.CertDigest.isEmpty()); xDocumentHandler->characters(rCertInfo.CertDigest); - xDocumentHandler->endElement("DigestValue"); - xDocumentHandler->endElement("xd:CertDigest"); - xDocumentHandler->startElement("xd:IssuerSerial", uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); - xDocumentHandler->startElement("X509IssuerName", uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); + xDocumentHandler->endElement(u"DigestValue"_ustr); + xDocumentHandler->endElement(u"xd:CertDigest"_ustr); + xDocumentHandler->startElement(u"xd:IssuerSerial"_ustr, uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); + xDocumentHandler->startElement(u"X509IssuerName"_ustr, uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); xDocumentHandler->characters(rCertInfo.X509IssuerName); - xDocumentHandler->endElement("X509IssuerName"); - xDocumentHandler->startElement("X509SerialNumber", uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); + xDocumentHandler->endElement(u"X509IssuerName"_ustr); + xDocumentHandler->startElement(u"X509SerialNumber"_ustr, uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); xDocumentHandler->characters(rCertInfo.X509SerialNumber); - xDocumentHandler->endElement("X509SerialNumber"); - xDocumentHandler->endElement("xd:IssuerSerial"); - xDocumentHandler->endElement("xd:Cert"); + xDocumentHandler->endElement(u"X509SerialNumber"_ustr); + xDocumentHandler->endElement(u"xd:IssuerSerial"_ustr); + xDocumentHandler->endElement(u"xd:Cert"_ustr); } void DocumentSignatureHelper::writeSignedProperties( @@ -557,15 +557,15 @@ void DocumentSignatureHelper::writeSignedProperties( { { rtl::Reference<comphelper::AttributeList> pAttributeList(new comphelper::AttributeList()); - pAttributeList->AddAttribute("Id", "idSignedProperties_" + signatureInfo.ouSignatureId); - xDocumentHandler->startElement("xd:SignedProperties", uno::Reference<xml::sax::XAttributeList>(pAttributeList)); + pAttributeList->AddAttribute(u"Id"_ustr, "idSignedProperties_" + signatureInfo.ouSignatureId); + xDocumentHandler->startElement(u"xd:SignedProperties"_ustr, uno::Reference<xml::sax::XAttributeList>(pAttributeList)); } - xDocumentHandler->startElement("xd:SignedSignatureProperties", uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); - xDocumentHandler->startElement("xd:SigningTime", uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); + xDocumentHandler->startElement(u"xd:SignedSignatureProperties"_ustr, uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); + xDocumentHandler->startElement(u"xd:SigningTime"_ustr, uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); xDocumentHandler->characters(sDate); - xDocumentHandler->endElement("xd:SigningTime"); - xDocumentHandler->startElement("xd:SigningCertificate", uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); + xDocumentHandler->endElement(u"xd:SigningTime"_ustr); + xDocumentHandler->startElement(u"xd:SigningCertificate"_ustr, uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); assert(signatureInfo.GetSigningCertificate() || !signatureInfo.ouGpgKeyID.isEmpty()); if (signatureInfo.GetSigningCertificate()) { @@ -586,35 +586,35 @@ void DocumentSignatureHelper::writeSignedProperties( temp.CertDigest = signatureInfo.ouGpgKeyID; WriteXadesCert(xDocumentHandler, temp); } - xDocumentHandler->endElement("xd:SigningCertificate"); - xDocumentHandler->startElement("xd:SignaturePolicyIdentifier", uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); - xDocumentHandler->startElement("xd:SignaturePolicyImplied", uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); - xDocumentHandler->endElement("xd:SignaturePolicyImplied"); - xDocumentHandler->endElement("xd:SignaturePolicyIdentifier"); + xDocumentHandler->endElement(u"xd:SigningCertificate"_ustr); + xDocumentHandler->startElement(u"xd:SignaturePolicyIdentifier"_ustr, uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); + xDocumentHandler->startElement(u"xd:SignaturePolicyImplied"_ustr, uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); + xDocumentHandler->endElement(u"xd:SignaturePolicyImplied"_ustr); + xDocumentHandler->endElement(u"xd:SignaturePolicyIdentifier"_ustr); if (bWriteSignatureLineData && !signatureInfo.ouSignatureLineId.isEmpty() && signatureInfo.aValidSignatureImage.is() && signatureInfo.aInvalidSignatureImage.is()) { rtl::Reference<comphelper::AttributeList> pAttributeList(new comphelper::AttributeList()); pAttributeList->AddAttribute( - "xmlns:loext", "urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"); + u"xmlns:loext"_ustr, u"urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"_ustr); xDocumentHandler->startElement( - "loext:SignatureLine", + u"loext:SignatureLine"_ustr, Reference<XAttributeList>(pAttributeList)); { // Write SignatureLineId element xDocumentHandler->startElement( - "loext:SignatureLineId", + u"loext:SignatureLineId"_ustr, Reference<XAttributeList>(new comphelper::AttributeList())); xDocumentHandler->characters(signatureInfo.ouSignatureLineId); - xDocumentHandler->endElement("loext:SignatureLineId"); + xDocumentHandler->endElement(u"loext:SignatureLineId"_ustr); } { // Write SignatureLineValidImage element xDocumentHandler->startElement( - "loext:SignatureLineValidImage", + u"loext:SignatureLineValidImage"_ustr, Reference<XAttributeList>(new comphelper::AttributeList())); OUString aGraphicInBase64; @@ -623,28 +623,28 @@ void DocumentSignatureHelper::writeSignedProperties( SAL_WARN("xmlsecurity.helper", "could not convert graphic to base64"); xDocumentHandler->characters(aGraphicInBase64); - xDocumentHandler->endElement("loext:SignatureLineValidImage"); + xDocumentHandler->endElement(u"loext:SignatureLineValidImage"_ustr); } { // Write SignatureLineInvalidImage element xDocumentHandler->startElement( - "loext:SignatureLineInvalidImage", + u"loext:SignatureLineInvalidImage"_ustr, Reference<XAttributeList>(new comphelper::AttributeList())); OUString aGraphicInBase64; Graphic aGraphic(signatureInfo.aInvalidSignatureImage); if (!XOutBitmap::GraphicToBase64(aGraphic, aGraphicInBase64, false)) SAL_WARN("xmlsecurity.helper", "could not convert graphic to base64"); xDocumentHandler->characters(aGraphicInBase64); - xDocumentHandler->endElement("loext:SignatureLineInvalidImage"); + xDocumentHandler->endElement(u"loext:SignatureLineInvalidImage"_ustr); } - xDocumentHandler->endElement("loext:SignatureLine"); + xDocumentHandler->endElement(u"loext:SignatureLine"_ustr); } - xDocumentHandler->endElement("xd:SignedSignatureProperties"); + xDocumentHandler->endElement(u"xd:SignedSignatureProperties"_ustr); - xDocumentHandler->endElement("xd:SignedProperties"); + xDocumentHandler->endElement(u"xd:SignedProperties"_ustr); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlsecurity/source/helper/documentsignaturemanager.cxx b/xmlsecurity/source/helper/documentsignaturemanager.cxx index 84d89ffeff72..620c85458afe 100644 --- a/xmlsecurity/source/helper/documentsignaturemanager.cxx +++ b/xmlsecurity/source/helper/documentsignaturemanager.cxx @@ -147,14 +147,15 @@ bool DocumentSignatureManager::readManifest() uno::Reference<packages::manifest::XManifestReader> xReader = packages::manifest::ManifestReader::create(mxContext); - if (mxStore->hasByName("META-INF")) + if (mxStore->hasByName(u"META-INF"_ustr)) { //Get the manifest.xml uno::Reference<embed::XStorage> xSubStore( - mxStore->openStorageElement("META-INF", embed::ElementModes::READ), UNO_SET_THROW); + mxStore->openStorageElement(u"META-INF"_ustr, embed::ElementModes::READ), + UNO_SET_THROW); uno::Reference<io::XInputStream> xStream( - xSubStore->openStreamElement("manifest.xml", css::embed::ElementModes::READ), + xSubStore->openStreamElement(u"manifest.xml"_ustr, css::embed::ElementModes::READ), UNO_QUERY_THROW); m_manifest = xReader->readManifestSequence(xStream); @@ -229,7 +230,7 @@ SignatureStreamHelper DocumentSignatureManager::ImplOpenSignatureStream(sal_Int3 bool bTempStream) { SignatureStreamHelper aHelper; - if (mxStore.is() && mxStore->hasByName("[Content_Types].xml")) + if (mxStore.is() && mxStore->hasByName(u"[Content_Types].xml"_ustr)) aHelper.nStorageFormat = embed::StorageFormats::OFOPXML; if (bTempStream) @@ -655,7 +656,7 @@ void DocumentSignatureManager::write(bool bXAdESCompliantIfODF) maSignatureHelper.EnsureSignaturesRelation(mxStore, /*bAdd=*/false); // Also remove the whole signature sub-storage: release our read-write reference + remove the element. aStreamHelper = SignatureStreamHelper(); - mxStore->removeElement("_xmlsignatures"); + mxStore->removeElement(u"_xmlsignatures"_ustr); } for (std::size_t i = 0; i < nSignatureCount; ++i) diff --git a/xmlsecurity/source/helper/ooxmlsecexporter.cxx b/xmlsecurity/source/helper/ooxmlsecexporter.cxx index 804cfd274802..874fc4079c28 100644 --- a/xmlsecurity/source/helper/ooxmlsecexporter.cxx +++ b/xmlsecurity/source/helper/ooxmlsecexporter.cxx @@ -112,32 +112,32 @@ bool OOXMLSecExporter::Impl::isOOXMLRelationDenylist(const OUString& rRelationNa void OOXMLSecExporter::Impl::writeSignedInfo() { - m_xDocumentHandler->startElement( - "SignedInfo", uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); + m_xDocumentHandler->startElement(u"SignedInfo"_ustr, uno::Reference<xml::sax::XAttributeList>( + new comphelper::AttributeList())); writeCanonicalizationMethod(); writeSignatureMethod(); writeSignedInfoReferences(); - m_xDocumentHandler->endElement("SignedInfo"); + m_xDocumentHandler->endElement(u"SignedInfo"_ustr); } void OOXMLSecExporter::Impl::writeCanonicalizationMethod() { rtl::Reference<comphelper::AttributeList> pAttributeList(new comphelper::AttributeList()); - pAttributeList->AddAttribute("Algorithm", ALGO_C14N); - m_xDocumentHandler->startElement("CanonicalizationMethod", + pAttributeList->AddAttribute(u"Algorithm"_ustr, ALGO_C14N); + m_xDocumentHandler->startElement(u"CanonicalizationMethod"_ustr, uno::Reference<xml::sax::XAttributeList>(pAttributeList)); - m_xDocumentHandler->endElement("CanonicalizationMethod"); + m_xDocumentHandler->endElement(u"CanonicalizationMethod"_ustr); } void OOXMLSecExporter::Impl::writeCanonicalizationTransform() { rtl::Reference<comphelper::AttributeList> pAttributeList(new comphelper::AttributeList()); - pAttributeList->AddAttribute("Algorithm", ALGO_C14N); - m_xDocumentHandler->startElement("Transform", + pAttributeList->AddAttribute(u"Algorithm"_ustr, ALGO_C14N); + m_xDocumentHandler->startElement(u"Transform"_ustr, uno::Reference<xml::sax::XAttributeList>(pAttributeList)); - m_xDocumentHandler->endElement("Transform"); + m_xDocumentHandler->endElement(u"Transform"_ustr); } void OOXMLSecExporter::Impl::writeSignatureMethod() @@ -145,13 +145,13 @@ void OOXMLSecExporter::Impl::writeSignatureMethod() rtl::Reference<comphelper::AttributeList> pAttributeList(new comphelper::AttributeList()); if (m_rInformation.eAlgorithmID == svl::crypto::SignatureMethodAlgorithm::ECDSA) - pAttributeList->AddAttribute("Algorithm", ALGO_ECDSASHA256); + pAttributeList->AddAttribute(u"Algorithm"_ustr, ALGO_ECDSASHA256); else - pAttributeList->AddAttribute("Algorithm", ALGO_RSASHA256); + pAttributeList->AddAttribute(u"Algorithm"_ustr, ALGO_RSASHA256); - m_xDocumentHandler->startElement("SignatureMethod", + m_xDocumentHandler->startElement(u"SignatureMethod"_ustr, uno::Reference<xml::sax::XAttributeList>(pAttributeList)); - m_xDocumentHandler->endElement("SignatureMethod"); + m_xDocumentHandler->endElement(u"SignatureMethod"_ustr); } void OOXMLSecExporter::Impl::writeSignedInfoReferences() @@ -165,82 +165,83 @@ void OOXMLSecExporter::Impl::writeSignedInfoReferences() rtl::Reference<comphelper::AttributeList> pAttributeList( new comphelper::AttributeList()); if (!rReference.ouURI.startsWith("idSignedProperties")) - pAttributeList->AddAttribute("Type", - "http://www.w3.org/2000/09/xmldsig#Object"); + pAttributeList->AddAttribute(u"Type"_ustr, + u"http://www.w3.org/2000/09/xmldsig#Object"_ustr); else - pAttributeList->AddAttribute("Type", - "http://uri.etsi.org/01903#SignedProperties"); - pAttributeList->AddAttribute("URI", "#" + rReference.ouURI); + pAttributeList->AddAttribute( + u"Type"_ustr, u"http://uri.etsi.org/01903#SignedProperties"_ustr); + pAttributeList->AddAttribute(u"URI"_ustr, "#" + rReference.ouURI); m_xDocumentHandler->startElement( - "Reference", uno::Reference<xml::sax::XAttributeList>(pAttributeList)); + u"Reference"_ustr, uno::Reference<xml::sax::XAttributeList>(pAttributeList)); } if (rReference.ouURI.startsWith("idSignedProperties")) { m_xDocumentHandler->startElement( - "Transforms", + u"Transforms"_ustr, uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); writeCanonicalizationTransform(); - m_xDocumentHandler->endElement("Transforms"); + m_xDocumentHandler->endElement(u"Transforms"_ustr); } DocumentSignatureHelper::writeDigestMethod(m_xDocumentHandler); m_xDocumentHandler->startElement( - "DigestValue", + u"DigestValue"_ustr, uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); m_xDocumentHandler->characters(rReference.ouDigestValue); - m_xDocumentHandler->endElement("DigestValue"); - m_xDocumentHandler->endElement("Reference"); + m_xDocumentHandler->endElement(u"DigestValue"_ustr); + m_xDocumentHandler->endElement(u"Reference"_ustr); } } } void OOXMLSecExporter::Impl::writeSignatureValue() { - m_xDocumentHandler->startElement("SignatureValue", uno::Reference<xml::sax::XAttributeList>( - new comphelper::AttributeList())); + m_xDocumentHandler->startElement( + u"SignatureValue"_ustr, + uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); m_xDocumentHandler->characters(m_rInformation.ouSignatureValue); - m_xDocumentHandler->endElement("SignatureValue"); + m_xDocumentHandler->endElement(u"SignatureValue"_ustr); } void OOXMLSecExporter::Impl::writeKeyInfo() { m_xDocumentHandler->startElement( - "KeyInfo", uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); + u"KeyInfo"_ustr, uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); assert(m_rInformation.GetSigningCertificate()); for (auto const& rData : m_rInformation.X509Datas) { - m_xDocumentHandler->startElement( - "X509Data", uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); + m_xDocumentHandler->startElement(u"X509Data"_ustr, uno::Reference<xml::sax::XAttributeList>( + new comphelper::AttributeList())); for (auto const& it : rData) { m_xDocumentHandler->startElement( - "X509Certificate", + u"X509Certificate"_ustr, uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); m_xDocumentHandler->characters(it.X509Certificate); - m_xDocumentHandler->endElement("X509Certificate"); + m_xDocumentHandler->endElement(u"X509Certificate"_ustr); } - m_xDocumentHandler->endElement("X509Data"); + m_xDocumentHandler->endElement(u"X509Data"_ustr); } - m_xDocumentHandler->endElement("KeyInfo"); + m_xDocumentHandler->endElement(u"KeyInfo"_ustr); } void OOXMLSecExporter::Impl::writePackageObject() { rtl::Reference<comphelper::AttributeList> pAttributeList(new comphelper::AttributeList()); - pAttributeList->AddAttribute("Id", "idPackageObject_" + m_rInformation.ouSignatureId); - m_xDocumentHandler->startElement("Object", + pAttributeList->AddAttribute(u"Id"_ustr, "idPackageObject_" + m_rInformation.ouSignatureId); + m_xDocumentHandler->startElement(u"Object"_ustr, uno::Reference<xml::sax::XAttributeList>(pAttributeList)); writeManifest(); writePackageObjectSignatureProperties(); - m_xDocumentHandler->endElement("Object"); + m_xDocumentHandler->endElement(u"Object"_ustr); } void OOXMLSecExporter::Impl::writeManifest() { - m_xDocumentHandler->startElement( - "Manifest", uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); + m_xDocumentHandler->startElement(u"Manifest"_ustr, uno::Reference<xml::sax::XAttributeList>( + new comphelper::AttributeList())); const SignatureReferenceInformations& rReferences = m_rInformation.vSignatureReferenceInfors; for (const SignatureReferenceInformation& rReference : rReferences) { @@ -252,7 +253,7 @@ void OOXMLSecExporter::Impl::writeManifest() writeManifestReference(rReference); } } - m_xDocumentHandler->endElement("Manifest"); + m_xDocumentHandler->endElement(u"Manifest"_ustr); } void OOXMLSecExporter::Impl::writeRelationshipTransform(const OUString& rURI) @@ -265,8 +266,8 @@ void OOXMLSecExporter::Impl::writeRelationshipTransform(const OUString& rURI) uno::UNO_QUERY); { rtl::Reference<comphelper::AttributeList> pAttributeList(new comphelper::AttributeList()); - pAttributeList->AddAttribute("Algorithm", ALGO_RELATIONSHIP); - m_xDocumentHandler->startElement("Transform", + pAttributeList->AddAttribute(u"Algorithm"_ustr, ALGO_RELATIONSHIP); + m_xDocumentHandler->startElement(u"Transform"_ustr, uno::Reference<xml::sax::XAttributeList>(pAttributeList)); } @@ -289,41 +290,41 @@ void OOXMLSecExporter::Impl::writeRelationshipTransform(const OUString& rURI) continue; rtl::Reference<comphelper::AttributeList> pAttributeList(new comphelper::AttributeList()); - pAttributeList->AddAttribute("xmlns:mdssi", NS_MDSSI); - pAttributeList->AddAttribute("SourceId", aId); - m_xDocumentHandler->startElement("mdssi:RelationshipReference", + pAttributeList->AddAttribute(u"xmlns:mdssi"_ustr, NS_MDSSI); + pAttributeList->AddAttribute(u"SourceId"_ustr, aId); + m_xDocumentHandler->startElement(u"mdssi:RelationshipReference"_ustr, uno::Reference<xml::sax::XAttributeList>(pAttributeList)); - m_xDocumentHandler->endElement("mdssi:RelationshipReference"); + m_xDocumentHandler->endElement(u"mdssi:RelationshipReference"_ustr); } - m_xDocumentHandler->endElement("Transform"); + m_xDocumentHandler->endElement(u"Transform"_ustr); } void OOXMLSecExporter::Impl::writePackageObjectSignatureProperties() { m_xDocumentHandler->startElement( - "SignatureProperties", + u"SignatureProperties"_ustr, uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); { rtl::Reference<comphelper::AttributeList> pAttributeList(new comphelper::AttributeList()); - pAttributeList->AddAttribute("Id", "idSignatureTime_" + m_rInformation.ouSignatureId); - pAttributeList->AddAttribute("Target", "#" + m_rInformation.ouSignatureId); - m_xDocumentHandler->startElement("SignatureProperty", + pAttributeList->AddAttribute(u"Id"_ustr, "idSignatureTime_" + m_rInformation.ouSignatureId); + pAttributeList->AddAttribute(u"Target"_ustr, "#" + m_rInformation.ouSignatureId); + m_xDocumentHandler->startElement(u"SignatureProperty"_ustr, uno::Reference<xml::sax::XAttributeList>(pAttributeList)); } { rtl::Reference<comphelper::AttributeList> pAttributeList(new comphelper::AttributeList()); - pAttributeList->AddAttribute("xmlns:mdssi", NS_MDSSI); - m_xDocumentHandler->startElement("mdssi:SignatureTime", + pAttributeList->AddAttribute(u"xmlns:mdssi"_ustr, NS_MDSSI); + m_xDocumentHandler->startElement(u"mdssi:SignatureTime"_ustr, uno::Reference<xml::sax::XAttributeList>(pAttributeList)); } - m_xDocumentHandler->startElement( - "mdssi:Format", uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); - m_xDocumentHandler->characters("YYYY-MM-DDThh:mm:ssTZD"); - m_xDocumentHandler->endElement("mdssi:Format"); + m_xDocumentHandler->startElement(u"mdssi:Format"_ustr, uno::Reference<xml::sax::XAttributeList>( + new comphelper::AttributeList())); + m_xDocumentHandler->characters(u"YYYY-MM-DDThh:mm:ssTZD"_ustr); + m_xDocumentHandler->endElement(u"mdssi:Format"_ustr); - m_xDocumentHandler->startElement( - "mdssi:Value", uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); + m_xDocumentHandler->startElement(u"mdssi:Value"_ustr, uno::Reference<xml::sax::XAttributeList>( + new comphelper::AttributeList())); if (!m_rInformation.ouDateTime.isEmpty()) m_aSignatureTimeValue = m_rInformation.ouDateTime; else @@ -338,18 +339,18 @@ void OOXMLSecExporter::Impl::writePackageObjectSignatureProperties() } } m_xDocumentHandler->characters(m_aSignatureTimeValue); - m_xDocumentHandler->endElement("mdssi:Value"); + m_xDocumentHandler->endElement(u"mdssi:Value"_ustr); - m_xDocumentHandler->endElement("mdssi:SignatureTime"); - m_xDocumentHandler->endElement("SignatureProperty"); - m_xDocumentHandler->endElement("SignatureProperties"); + m_xDocumentHandler->endElement(u"mdssi:SignatureTime"_ustr); + m_xDocumentHandler->endElement(u"SignatureProperty"_ustr); + m_xDocumentHandler->endElement(u"SignatureProperties"_ustr); } void OOXMLSecExporter::Impl::writeManifestReference(const SignatureReferenceInformation& rReference) { rtl::Reference<comphelper::AttributeList> pAttributeList(new comphelper::AttributeList()); - pAttributeList->AddAttribute("URI", rReference.ouURI); - m_xDocumentHandler->startElement("Reference", + pAttributeList->AddAttribute(u"URI"_ustr, rReference.ouURI); + m_xDocumentHandler->startElement(u"Reference"_ustr, uno::Reference<xml::sax::XAttributeList>(pAttributeList)); // Transforms @@ -365,138 +366,149 @@ void OOXMLSecExporter::Impl::writeManifestReference(const SignatureReferenceInfo if (nQueryPos != -1) aURI = aURI.copy(0, nQueryPos); - m_xDocumentHandler->startElement("Transforms", uno::Reference<xml::sax::XAttributeList>( - new comphelper::AttributeList())); + m_xDocumentHandler->startElement( + u"Transforms"_ustr, + uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); writeRelationshipTransform(aURI); writeCanonicalizationTransform(); - m_xDocumentHandler->endElement("Transforms"); + m_xDocumentHandler->endElement(u"Transforms"_ustr); } DocumentSignatureHelper::writeDigestMethod(m_xDocumentHandler); - m_xDocumentHandler->startElement( - "DigestValue", uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); + m_xDocumentHandler->startElement(u"DigestValue"_ustr, uno::Reference<xml::sax::XAttributeList>( + new comphelper::AttributeList())); m_xDocumentHandler->characters(rReference.ouDigestValue); - m_xDocumentHandler->endElement("DigestValue"); - m_xDocumentHandler->endElement("Reference"); + m_xDocumentHandler->endElement(u"DigestValue"_ustr); + m_xDocumentHandler->endElement(u"Reference"_ustr); } void OOXMLSecExporter::Impl::writeOfficeObject() { { rtl::Reference<comphelper::AttributeList> pAttributeList(new comphelper::AttributeList()); - pAttributeList->AddAttribute("Id", "idOfficeObject_" + m_rInformation.ouSignatureId); - m_xDocumentHandler->startElement("Object", + pAttributeList->AddAttribute(u"Id"_ustr, "idOfficeObject_" + m_rInformation.ouSignatureId); + m_xDocumentHandler->startElement(u"Object"_ustr, uno::Reference<xml::sax::XAttributeList>(pAttributeList)); } m_xDocumentHandler->startElement( - "SignatureProperties", + u"SignatureProperties"_ustr, uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); { rtl::Reference<comphelper::AttributeList> pAttributeList(new comphelper::AttributeList()); - pAttributeList->AddAttribute("Id", "idOfficeV1Details_" + m_rInformation.ouSignatureId); - pAttributeList->AddAttribute("Target", "#" + m_rInformation.ouSignatureId); - m_xDocumentHandler->startElement("SignatureProperty", + pAttributeList->AddAttribute(u"Id"_ustr, + "idOfficeV1Details_" + m_rInformation.ouSignatureId); + pAttributeList->AddAttribute(u"Target"_ustr, "#" + m_rInformation.ouSignatureId); + m_xDocumentHandler->startElement(u"SignatureProperty"_ustr, uno::Reference<xml::sax::XAttributeList>(pAttributeList)); } writeSignatureInfo(); - m_xDocumentHandler->endElement("SignatureProperty"); - m_xDocumentHandler->endElement("SignatureProperties"); - m_xDocumentHandler->endElement("Object"); + m_xDocumentHandler->endElement(u"SignatureProperty"_ustr); + m_xDocumentHandler->endElement(u"SignatureProperties"_ustr); + m_xDocumentHandler->endElement(u"Object"_ustr); } void OOXMLSecExporter::Impl::writeSignatureInfo() { rtl::Reference<comphelper::AttributeList> pAttributeList(new comphelper::AttributeList()); - pAttributeList->AddAttribute("xmlns", "http://schemas.microsoft.com/office/2006/digsig"); - m_xDocumentHandler->startElement("SignatureInfoV1", + pAttributeList->AddAttribute(u"xmlns"_ustr, + u"http://schemas.microsoft.com/office/2006/digsig"_ustr); + m_xDocumentHandler->startElement(u"SignatureInfoV1"_ustr, uno::Reference<xml::sax::XAttributeList>(pAttributeList)); m_xDocumentHandler->startElement( - "SetupID", uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); + u"SetupID"_ustr, uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); m_xDocumentHandler->characters(m_rInformation.ouSignatureLineId); - m_xDocumentHandler->endElement("SetupID"); + m_xDocumentHandler->endElement(u"SetupID"_ustr); m_xDocumentHandler->startElement( - "SignatureText", uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); - m_xDocumentHandler->endElement("SignatureText"); - m_xDocumentHandler->startElement("SignatureImage", uno::Reference<xml::sax::XAttributeList>( - new comphelper::AttributeList())); - m_xDocumentHandler->endElement("SignatureImage"); - m_xDocumentHandler->startElement("SignatureComments", uno::Reference<xml::sax::XAttributeList>( - new comphelper::AttributeList())); + u"SignatureText"_ustr, + uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); + m_xDocumentHandler->endElement(u"SignatureText"_ustr); + m_xDocumentHandler->startElement( + u"SignatureImage"_ustr, + uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); + m_xDocumentHandler->endElement(u"SignatureImage"_ustr); + m_xDocumentHandler->startElement( + u"SignatureComments"_ustr, + uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); m_xDocumentHandler->characters(m_rInformation.ouDescription); - m_xDocumentHandler->endElement("SignatureComments"); + m_xDocumentHandler->endElement(u"SignatureComments"_ustr); // Just hardcode something valid according to [MS-OFFCRYPTO]. - m_xDocumentHandler->startElement("WindowsVersion", uno::Reference<xml::sax::XAttributeList>( - new comphelper::AttributeList())); - m_xDocumentHandler->characters("6.1"); - m_xDocumentHandler->endElement("WindowsVersion"); m_xDocumentHandler->startElement( - "OfficeVersion", uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); - m_xDocumentHandler->characters("16.0"); - m_xDocumentHandler->endElement("OfficeVersion"); - m_xDocumentHandler->startElement("ApplicationVersion", uno::Reference<xml::sax::XAttributeList>( - new comphelper::AttributeList())); - m_xDocumentHandler->characters("16.0"); - m_xDocumentHandler->endElement("ApplicationVersion"); + u"WindowsVersion"_ustr, + uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); + m_xDocumentHandler->characters(u"6.1"_ustr); + m_xDocumentHandler->endElement(u"WindowsVersion"_ustr); m_xDocumentHandler->startElement( - "Monitors", uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); - m_xDocumentHandler->characters("1"); - m_xDocumentHandler->endElement("Monitors"); + u"OfficeVersion"_ustr, + uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); + m_xDocumentHandler->characters(u"16.0"_ustr); + m_xDocumentHandler->endElement(u"OfficeVersion"_ustr); m_xDocumentHandler->startElement( - "HorizontalResolution", + u"ApplicationVersion"_ustr, uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); - m_xDocumentHandler->characters("1280"); - m_xDocumentHandler->endElement("HorizontalResolution"); - m_xDocumentHandler->startElement("VerticalResolution", uno::Reference<xml::sax::XAttributeList>( - new comphelper::AttributeList())); - m_xDocumentHandler->characters("800"); - m_xDocumentHandler->endElement("VerticalResolution"); + m_xDocumentHandler->characters(u"16.0"_ustr); + m_xDocumentHandler->endElement(u"ApplicationVersion"_ustr); + m_xDocumentHandler->startElement(u"Monitors"_ustr, uno::Reference<xml::sax::XAttributeList>( + new comphelper::AttributeList())); + m_xDocumentHandler->characters(u"1"_ustr); + m_xDocumentHandler->endElement(u"Monitors"_ustr); m_xDocumentHandler->startElement( - "ColorDepth", uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); - m_xDocumentHandler->characters("32"); - m_xDocumentHandler->endElement("ColorDepth"); + u"HorizontalResolution"_ustr, + uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); + m_xDocumentHandler->characters(u"1280"_ustr); + m_xDocumentHandler->endElement(u"HorizontalResolution"_ustr); + m_xDocumentHandler->startElement( + u"VerticalResolution"_ustr, + uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); + m_xDocumentHandler->characters(u"800"_ustr); + m_xDocumentHandler->endElement(u"VerticalResolution"_ustr); + m_xDocumentHandler->startElement(u"ColorDepth"_ustr, uno::Reference<xml::sax::XAttributeList>( + new comphelper::AttributeList())); + m_xDocumentHandler->characters(u"32"_ustr); + m_xDocumentHandler->endElement(u"ColorDepth"_ustr); m_xDocumentHandler->startElement( - "SignatureProviderId", + u"SignatureProviderId"_ustr, uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); - m_xDocumentHandler->characters("{00000000-0000-0000-0000-000000000000}"); - m_xDocumentHandler->endElement("SignatureProviderId"); + m_xDocumentHandler->characters(u"{00000000-0000-0000-0000-000000000000}"_ustr); + m_xDocumentHandler->endElement(u"SignatureProviderId"_ustr); m_xDocumentHandler->startElement( - "SignatureProviderUrl", + u"SignatureProviderUrl"_ustr, uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); - m_xDocumentHandler->endElement("SignatureProviderUrl"); + m_xDocumentHandler->endElement(u"SignatureProviderUrl"_ustr); m_xDocumentHandler->startElement( - "SignatureProviderDetails", + u"SignatureProviderDetails"_ustr, uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); m_xDocumentHandler->characters( - "9"); // This is what MSO 2016 writes, though [MS-OFFCRYPTO] doesn't document what the value means. - m_xDocumentHandler->endElement("SignatureProviderDetails"); + u"9"_ustr); // This is what MSO 2016 writes, though [MS-OFFCRYPTO] doesn't document what the value means. + m_xDocumentHandler->endElement(u"SignatureProviderDetails"_ustr); m_xDocumentHandler->startElement( - "SignatureType", uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); - m_xDocumentHandler->characters("2"); - m_xDocumentHandler->endElement("SignatureType"); + u"SignatureType"_ustr, + uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); + m_xDocumentHandler->characters(u"2"_ustr); + m_xDocumentHandler->endElement(u"SignatureType"_ustr); - m_xDocumentHandler->endElement("SignatureInfoV1"); + m_xDocumentHandler->endElement(u"SignatureInfoV1"_ustr); } void OOXMLSecExporter::Impl::writePackageSignature() { m_xDocumentHandler->startElement( - "Object", uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); + u"Object"_ustr, uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); { rtl::Reference<comphelper::AttributeList> pAttributeList(new comphelper::AttributeList()); - pAttributeList->AddAttribute("xmlns:xd", NS_XD); - pAttributeList->AddAttribute("Target", "#" + m_rInformation.ouSignatureId); - m_xDocumentHandler->startElement("xd:QualifyingProperties", + pAttributeList->AddAttribute(u"xmlns:xd"_ustr, NS_XD); + pAttributeList->AddAttribute(u"Target"_ustr, "#" + m_rInformation.ouSignatureId); + m_xDocumentHandler->startElement(u"xd:QualifyingProperties"_ustr, uno::Reference<xml::sax::XAttributeList>(pAttributeList)); } DocumentSignatureHelper::writeSignedProperties(m_xDocumentHandler, m_rInformation, m_aSignatureTimeValue, false); - m_xDocumentHandler->endElement("xd:QualifyingProperties"); - m_xDocumentHandler->endElement("Object"); + m_xDocumentHandler->endElement(u"xd:QualifyingProperties"_ustr); + m_xDocumentHandler->endElement(u"Object"_ustr); } void OOXMLSecExporter::Impl::writeSignatureLineImages() @@ -504,37 +516,37 @@ void OOXMLSecExporter::Impl::writeSignatureLineImages() if (m_rInformation.aValidSignatureImage.is()) { rtl::Reference<comphelper::AttributeList> pAttributeList(new comphelper::AttributeList()); - pAttributeList->AddAttribute("Id", "idValidSigLnImg"); - m_xDocumentHandler->startElement("Object", + pAttributeList->AddAttribute(u"Id"_ustr, u"idValidSigLnImg"_ustr); + m_xDocumentHandler->startElement(u"Object"_ustr, uno::Reference<xml::sax::XAttributeList>(pAttributeList)); OUString aGraphicInBase64; Graphic aGraphic(m_rInformation.aValidSignatureImage); if (!XOutBitmap::GraphicToBase64(aGraphic, aGraphicInBase64, false, ConvertDataFormat::EMF)) SAL_WARN("xmlsecurity.helper", "could not convert graphic to base64"); m_xDocumentHandler->characters(aGraphicInBase64); - m_xDocumentHandler->endElement("Object"); + m_xDocumentHandler->endElement(u"Object"_ustr); } if (!m_rInformation.aInvalidSignatureImage.is()) return; rtl::Reference<comphelper::AttributeList> pAttributeList(new comphelper::AttributeList()); - pAttributeList->AddAttribute("Id", "idInvalidSigLnImg"); - m_xDocumentHandler->startElement("Object", + pAttributeList->AddAttribute(u"Id"_ustr, u"idInvalidSigLnImg"_ustr); + m_xDocumentHandler->startElement(u"Object"_ustr, uno::Reference<xml::sax::XAttributeList>(pAttributeList)); OUString aGraphicInBase64; Graphic aGraphic(m_rInformation.aInvalidSignatureImage); if (!XOutBitmap::GraphicToBase64(aGraphic, aGraphicInBase64, false, ConvertDataFormat::EMF)) SAL_WARN("xmlsecurity.helper", "could not convert graphic to base64"); m_xDocumentHandler->characters(aGraphicInBase64); - m_xDocumentHandler->endElement("Object"); + m_xDocumentHandler->endElement(u"Object"_ustr); } void OOXMLSecExporter::Impl::writeSignature() { rtl::Reference<comphelper::AttributeList> pAttributeList(new comphelper::AttributeList()); - pAttributeList->AddAttribute("xmlns", NS_XMLDSIG); - pAttributeList->AddAttribute("Id", m_rInformation.ouSignatureId); - getDocumentHandler()->startElement("Signature", + pAttributeList->AddAttribute(u"xmlns"_ustr, NS_XMLDSIG); + pAttributeList->AddAttribute(u"Id"_ustr, m_rInformation.ouSignatureId); + getDocumentHandler()->startElement(u"Signature"_ustr, uno::Reference<xml::sax::XAttributeList>(pAttributeList)); writeSignedInfo(); @@ -545,7 +557,7 @@ void OOXMLSecExporter::Impl::writeSignature() writePackageSignature(); writeSignatureLineImages(); - getDocumentHandler()->endElement("Signature"); + getDocumentHandler()->endElement(u"Signature"_ustr); } OOXMLSecExporter::OOXMLSecExporter( diff --git a/xmlsecurity/source/helper/ooxmlsecparser.cxx b/xmlsecurity/source/helper/ooxmlsecparser.cxx index c75a8c6f4aa6..ff1802e02943 100644 --- a/xmlsecurity/source/helper/ooxmlsecparser.cxx +++ b/xmlsecurity/source/helper/ooxmlsecparser.cxx @@ -370,7 +370,7 @@ class OOXMLSecParser::DsDigestMethodContext virtual void StartElement( css::uno::Reference<css::xml::sax::XAttributeList> const& xAttrs) override { - OUString ouAlgorithm = xAttrs->getValueByName("Algorithm"); + OUString ouAlgorithm = xAttrs->getValueByName(u"Algorithm"_ustr); SAL_WARN_IF( ouAlgorithm.isEmpty(), "xmlsecurity.helper", "no Algorithm in Reference" ); if (ouAlgorithm.isEmpty()) @@ -409,7 +409,7 @@ class OOXMLSecParser::DsTransformContext virtual void StartElement( css::uno::Reference<css::xml::sax::XAttributeList> const& xAttrs) override { - OUString aAlgorithm = xAttrs->getValueByName("Algorithm"); + OUString aAlgorithm = xAttrs->getValueByName(u"Algorithm"_ustr); if (aAlgorithm == ALGO_RELATIONSHIP) { @@ -469,10 +469,10 @@ class OOXMLSecParser::DsReferenceContext { m_rParser.HandleIdAttr(xAttrs); - m_URI = xAttrs->getValueByName("URI"); + m_URI = xAttrs->getValueByName(u"URI"_ustr); SAL_WARN_IF(m_URI.isEmpty(), "xmlsecurity.helper", "URI is empty"); // Remember the type of this reference. - m_Type = xAttrs->getValueByName("Type"); + m_Type = xAttrs->getValueByName(u"Type"_ustr); } virtual void EndElement() override @@ -535,7 +535,7 @@ class OOXMLSecParser::DsSignatureMethodContext virtual void StartElement( css::uno::Reference<css::xml::sax::XAttributeList> const& xAttrs) override { - OUString ouAlgorithm = xAttrs->getValueByName("Algorithm"); + OUString ouAlgorithm = xAttrs->getValueByName(u"Algorithm"_ustr); if (ouAlgorithm == ALGO_ECDSASHA1 || ouAlgorithm == ALGO_ECDSASHA256 || ouAlgorithm == ALGO_ECDSASHA512) { @@ -701,7 +701,7 @@ class OOXMLSecParser::XadesSigningTimeContext { if (m_isReferenced) { - m_rParser.m_pXSecController->setDate("", m_Value); + m_rParser.m_pXSecController->setDate(u""_ustr, m_Value); } else { @@ -897,7 +897,7 @@ class OOXMLSecParser::MsodigsigSignatureInfoV1Context } if (!m_SignatureComments.isEmpty()) { - m_rParser.m_pXSecController->setDescription("", m_SignatureComments); + m_rParser.m_pXSecController->setDescription(u""_ustr, m_SignatureComments); } } @@ -1223,13 +1223,13 @@ OOXMLSecParser::OOXMLSecParser(XMLSignatureHelper& rXMLSignatureHelper, XSecCont { using namespace xmloff::token; m_pNamespaceMap->Add( GetXMLToken(XML_XML), GetXMLToken(XML_N_XML), XML_NAMESPACE_XML ); - m_pNamespaceMap->Add( "_ds", GetXMLToken(XML_N_DS), XML_NAMESPACE_DS ); - m_pNamespaceMap->Add( "_xades132", GetXMLToken(XML_N_XADES132), XML_NAMESPACE_XADES132); - m_pNamespaceMap->Add( "_xades141", GetXMLToken(XML_N_XADES141), XML_NAMESPACE_XADES141); - m_pNamespaceMap->Add( "_dc", GetXMLToken(XML_N_DC), XML_NAMESPACE_DC ); - m_pNamespaceMap->Add( "_mdssi", NS_MDSSI, XML_NAMESPACE_MDSSI ); - m_pNamespaceMap->Add( "_msodigsig", "http://schemas.microsoft.com/office/2006/digsig", XML_NAMESPACE_MSODIGSIG ); - m_pNamespaceMap->Add( "_office_libo", + m_pNamespaceMap->Add( u"_ds"_ustr, GetXMLToken(XML_N_DS), XML_NAMESPACE_DS ); + m_pNamespaceMap->Add( u"_xades132"_ustr, GetXMLToken(XML_N_XADES132), XML_NAMESPACE_XADES132); + m_pNamespaceMap->Add( u"_xades141"_ustr, GetXMLToken(XML_N_XADES141), XML_NAMESPACE_XADES141); + m_pNamespaceMap->Add( u"_dc"_ustr, GetXMLToken(XML_N_DC), XML_NAMESPACE_DC ); + m_pNamespaceMap->Add( u"_mdssi"_ustr, NS_MDSSI, XML_NAMESPACE_MDSSI ); + m_pNamespaceMap->Add( u"_msodigsig"_ustr, u"http://schemas.microsoft.com/office/2006/digsig"_ustr, XML_NAMESPACE_MSODIGSIG ); + m_pNamespaceMap->Add( u"_office_libo"_ustr, GetXMLToken(XML_N_LO_EXT), XML_NAMESPACE_LO_EXT); } @@ -1239,7 +1239,7 @@ OOXMLSecParser::~OOXMLSecParser() OUString OOXMLSecParser::HandleIdAttr(css::uno::Reference<css::xml::sax::XAttributeList> const& xAttrs) { - OUString const aId = xAttrs->getValueByName("Id"); + OUString const aId = xAttrs->getValueByName(u"Id"_ustr); if (!aId.isEmpty()) { m_pXSecController->collectToVerify(aId); @@ -1275,7 +1275,7 @@ void SAL_CALL OOXMLSecParser::startElement(const OUString& rName, const uno::Ref if (nPrefix != XML_NAMESPACE_DS || localName != "Signature") { throw css::xml::sax::SAXException( - "xmlsecurity: unexpected root element", nullptr, + u"xmlsecurity: unexpected root element"_ustr, nullptr, css::uno::Any()); } diff --git a/xmlsecurity/source/helper/pdfsignaturehelper.cxx b/xmlsecurity/source/helper/pdfsignaturehelper.cxx index 3c0084c8b4e2..d5f789bd6b65 100644 --- a/xmlsecurity/source/helper/pdfsignaturehelper.cxx +++ b/xmlsecurity/source/helper/pdfsignaturehelper.cxx @@ -53,7 +53,7 @@ bool GetSignatureLinePage(const uno::Reference<frame::XModel>& xModel, sal_Int32 return false; } - return xPage->getPropertyValue("Number") >>= rPage; + return xPage->getPropertyValue(u"Number"_ustr) >>= rPage; } /// If the currently selected shape is a Draw signature line, export that to PDF. @@ -82,8 +82,8 @@ void GetSignatureLineShape(const uno::Reference<frame::XModel>& xModel, sal_Int3 return; } - comphelper::SequenceAsHashMap aMap(xShapeProps->getPropertyValue("InteropGrabBag")); - auto it = aMap.find("SignatureCertificate"); + comphelper::SequenceAsHashMap aMap(xShapeProps->getPropertyValue(u"InteropGrabBag"_ustr)); + auto it = aMap.find(u"SignatureCertificate"_ustr); if (it == aMap.end()) { return; @@ -99,14 +99,14 @@ void GetSignatureLineShape(const uno::Reference<frame::XModel>& xModel, sal_Int3 // Export just the signature line. utl::MediaDescriptor aMediaDescriptor; - aMediaDescriptor["FilterName"] <<= OUString("draw_pdf_Export"); + aMediaDescriptor[u"FilterName"_ustr] <<= u"draw_pdf_Export"_ustr; SvMemoryStream aStream; uno::Reference<io::XOutputStream> xStream(new utl::OStreamWrapper(aStream)); - aMediaDescriptor["OutputStream"] <<= xStream; + aMediaDescriptor[u"OutputStream"_ustr] <<= xStream; uno::Sequence<beans::PropertyValue> aFilterData( comphelper::InitPropertySequence({ { "Selection", uno::Any(xShapes) } })); - aMediaDescriptor["FilterData"] <<= aFilterData; - xStorable->storeToURL("private:stream", aMediaDescriptor.getAsConstPropertyValueList()); + aMediaDescriptor[u"FilterData"_ustr] <<= aFilterData; + xStorable->storeToURL(u"private:stream"_ustr, aMediaDescriptor.getAsConstPropertyValueList()); xStream->flush(); aStream.Seek(0); diff --git a/xmlsecurity/source/helper/xmlsignaturehelper.cxx b/xmlsecurity/source/helper/xmlsignaturehelper.cxx index 3bb0b04c4ea1..d69b48ae076b 100644 --- a/xmlsecurity/source/helper/xmlsignaturehelper.cxx +++ b/xmlsecurity/source/helper/xmlsignaturehelper.cxx @@ -195,12 +195,12 @@ uno::Reference<xml::sax::XWriter> XMLSignatureHelper::CreateDocumentHandlerWithH sNamespace = NS_DOCUMENTSIGNATURES_ODF_1_2; pAttributeList->AddAttribute( - "xmlns", + u"xmlns"_ustr, sNamespace); xSaxWriter->startDocument(); xSaxWriter->startElement( - "document-signatures", + u"document-signatures"_ustr, pAttributeList); return xSaxWriter; @@ -208,7 +208,7 @@ uno::Reference<xml::sax::XWriter> XMLSignatureHelper::CreateDocumentHandlerWithH void XMLSignatureHelper::CloseDocumentHandler( const uno::Reference<xml::sax::XDocumentHandler>& xDocumentHandler ) { - xDocumentHandler->endElement( "document-signatures" ); + xDocumentHandler->endElement( u"document-signatures"_ustr ); xDocumentHandler->endDocument(); } @@ -321,14 +321,14 @@ bool lcl_isSignatureOriginType(const beans::StringPair& rPair) bool XMLSignatureHelper::ReadAndVerifySignatureStorage(const uno::Reference<embed::XStorage>& xStorage, bool bCacheLastSignature) { sal_Int32 nOpenMode = embed::ElementModes::READ; - if (xStorage.is() && !xStorage->hasByName("_rels")) + if (xStorage.is() && !xStorage->hasByName(u"_rels"_ustr)) { SAL_WARN("xmlsecurity.helper", "expected stream, in signature storage but not found: _rels"); return false; } - uno::Reference<embed::XStorage> xSubStorage = xStorage->openStorageElement("_rels", nOpenMode); - uno::Reference<io::XInputStream> xRelStream(xSubStorage->openStreamElement("origin.sigs.rels", nOpenMode), uno::UNO_QUERY); + uno::Reference<embed::XStorage> xSubStorage = xStorage->openStorageElement(u"_rels"_ustr, nOpenMode); + uno::Reference<io::XInputStream> xRelStream(xSubStorage->openStreamElement(u"origin.sigs.rels"_ustr, nOpenMode), uno::UNO_QUERY); uno::Sequence< uno::Sequence<beans::StringPair> > aRelationsInfo = comphelper::OFOPXMLHelper::ReadRelationsInfoSequence(xRelStream, u"origin.sigs.rels", mxCtx); for (sal_Int32 i = 0; i < aRelationsInfo.getLength(); ++i) @@ -364,7 +364,7 @@ bool XMLSignatureHelper::ReadAndVerifySignatureStorage(const uno::Reference<embe continue; sal_Int64 nSize = 0; - xPropertySet->getPropertyValue("Size") >>= nSize; + xPropertySet->getPropertyValue(u"Size"_ustr) >>= nSize; if (nSize < 0 || nSize > SAL_MAX_INT32) { SAL_WARN("xmlsecurity.helper", "bogus signature size: " << nSize); @@ -417,8 +417,8 @@ bool XMLSignatureHelper::ReadAndVerifySignatureStorageStream(const css::uno::Ref void XMLSignatureHelper::EnsureSignaturesRelation(const css::uno::Reference<css::embed::XStorage>& xStorage, bool bAdd) { sal_Int32 nOpenMode = embed::ElementModes::READWRITE; - uno::Reference<embed::XStorage> xSubStorage = xStorage->openStorageElement("_rels", nOpenMode); - uno::Reference<io::XInputStream> xRelStream(xSubStorage->openStreamElement(".rels", nOpenMode), uno::UNO_QUERY); + uno::Reference<embed::XStorage> xSubStorage = xStorage->openStorageElement(u"_rels"_ustr, nOpenMode); + uno::Reference<io::XInputStream> xRelStream(xSubStorage->openStreamElement(u".rels"_ustr, nOpenMode), uno::UNO_QUERY); std::vector< uno::Sequence<beans::StringPair> > aRelationsInfo = comphelper::sequenceToContainer< std::vector< uno::Sequence<beans::StringPair> > >(comphelper::OFOPXMLHelper::ReadRelationsInfoSequence(xRelStream, u".rels", mxCtx)); // Do we have a relation already? @@ -474,14 +474,14 @@ void XMLSignatureHelper::ExportSignatureRelations(const css::uno::Reference<css: { // Write the empty file, its relations will be the signatures. sal_Int32 nOpenMode = embed::ElementModes::READWRITE; - uno::Reference<io::XOutputStream> xOriginStream(xStorage->openStreamElement("origin.sigs", nOpenMode), uno::UNO_QUERY); + uno::Reference<io::XOutputStream> xOriginStream(xStorage->openStreamElement(u"origin.sigs"_ustr, nOpenMode), uno::UNO_QUERY); uno::Reference<io::XTruncate> xTruncate(xOriginStream, uno::UNO_QUERY); xTruncate->truncate(); xOriginStream->closeOutput(); // Write the relations. - uno::Reference<embed::XStorage> xSubStorage = xStorage->openStorageElement("_rels", nOpenMode); - uno::Reference<io::XOutputStream> xRelStream(xSubStorage->openStreamElement("origin.sigs.rels", nOpenMode), uno::UNO_QUERY); + uno::Reference<embed::XStorage> xSubStorage = xStorage->openStorageElement(u"_rels"_ustr, nOpenMode); + uno::Reference<io::XOutputStream> xRelStream(xSubStorage->openStreamElement(u"origin.sigs.rels"_ustr, nOpenMode), uno::UNO_QUERY); std::vector< uno::Sequence<beans::StringPair> > aRelations; for (int i = 0; i < nSignatureCount; ++i) { @@ -498,7 +498,7 @@ void XMLSignatureHelper::ExportSignatureRelations(const css::uno::Reference<css: void XMLSignatureHelper::ExportSignatureContentTypes(const css::uno::Reference<css::embed::XStorage>& xStorage, int nSignatureCount) { - uno::Reference<io::XStream> xStream = xStorage->openStreamElement("[Content_Types].xml", embed::ElementModes::READWRITE); + uno::Reference<io::XStream> xStream = xStorage->openStreamElement(u"[Content_Types].xml"_ustr, embed::ElementModes::READWRITE); uno::Reference<io::XInputStream> xInputStream = xStream->getInputStream(); uno::Sequence< uno::Sequence<beans::StringPair> > aContentTypeInfo = comphelper::OFOPXMLHelper::ReadContentTypeSequence(xInputStream, mxCtx); if (aContentTypeInfo.getLength() < 2) diff --git a/xmlsecurity/source/helper/xsecctl.cxx b/xmlsecurity/source/helper/xsecctl.cxx index 08b822f15757..fd68c3486d76 100644 --- a/xmlsecurity/source/helper/xsecctl.cxx +++ b/xmlsecurity/source/helper/xsecctl.cxx @@ -182,7 +182,7 @@ void XSecController::createXSecComponent( ) m_xXMLSignature.set(new XMLSignature_GpgImpl()); else // xmlsec or mscrypt #endif - m_xXMLSignature.set(xMCF->createInstanceWithContext("com.sun.star.xml.crypto.XMLSignature", mxCtx), css::uno::UNO_QUERY); + m_xXMLSignature.set(xMCF->createInstanceWithContext(u"com.sun.star.xml.crypto.XMLSignature"_ustr, mxCtx), css::uno::UNO_QUERY); bool bSuccess = m_xXMLSignature.is(); if ( bSuccess ) @@ -531,32 +531,32 @@ void writeUnsignedProperties( { { rtl::Reference<comphelper::AttributeList> pAttributeList(new comphelper::AttributeList()); - pAttributeList->AddAttribute("Id", "idUnsignedProperties_" + signatureInfo.ouSignatureId); - xDocumentHandler->startElement("xd:UnsignedProperties", uno::Reference<xml::sax::XAttributeList>(pAttributeList)); + pAttributeList->AddAttribute(u"Id"_ustr, "idUnsignedProperties_" + signatureInfo.ouSignatureId); + xDocumentHandler->startElement(u"xd:UnsignedProperties"_ustr, uno::Reference<xml::sax::XAttributeList>(pAttributeList)); } { - xDocumentHandler->startElement("xd:UnsignedSignatureProperties", uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); + xDocumentHandler->startElement(u"xd:UnsignedSignatureProperties"_ustr, uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); { - xDocumentHandler->startElement("xd:CertificateValues", uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); + xDocumentHandler->startElement(u"xd:CertificateValues"_ustr, uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); { for (const auto& i: signatureInfo.maEncapsulatedX509Certificates) { - xDocumentHandler->startElement("xd:EncapsulatedX509Certificate", uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); + xDocumentHandler->startElement(u"xd:EncapsulatedX509Certificate"_ustr, uno::Reference<xml::sax::XAttributeList>(new comphelper::AttributeList())); xDocumentHandler->characters(i); - xDocumentHandler->endElement("xd:EncapsulatedX509Certificate"); + xDocumentHandler->endElement(u"xd:EncapsulatedX509Certificate"_ustr); } } - xDocumentHandler->endElement("xd:CertificateValues"); + xDocumentHandler->endElement(u"xd:CertificateValues"_ustr); } - xDocumentHandler->endElement("xd:UnsignedSignatureProperties"); + xDocumentHandler->endElement(u"xd:UnsignedSignatureProperties"_ustr); } - xDocumentHandler->endElement("xd:UnsignedProperties"); + xDocumentHandler->endElement(u"xd:UnsignedProperties"_ustr); } } @@ -586,30 +586,30 @@ void XSecController::exportSignature( */ pAttributeList = new comphelper::AttributeList(); pAttributeList->AddAttribute( - "xmlns", + u"xmlns"_ustr, NS_XMLDSIG); if (!signatureInfo.ouSignatureId.isEmpty()) { pAttributeList->AddAttribute( - "Id", + u"Id"_ustr, signatureInfo.ouSignatureId); } - xDocumentHandler->startElement( "Signature", pAttributeList); + xDocumentHandler->startElement( u"Signature"_ustr, pAttributeList); { /* Write SignedInfo element */ xDocumentHandler->startElement( - "SignedInfo", + u"SignedInfo"_ustr, css::uno::Reference< css::xml::sax::XAttributeList > (new comphelper::AttributeList())); { /* Write CanonicalizationMethod element */ pAttributeList = new comphelper::AttributeList(); pAttributeList->AddAttribute( - "Algorithm", + u"Algorithm"_ustr, ALGO_C14N); - xDocumentHandler->startElement( "CanonicalizationMethod", pAttributeList ); - xDocumentHandler->endElement( "CanonicalizationMethod" ); + xDocumentHandler->startElement( u"CanonicalizationMethod"_ustr, pAttributeList ); + xDocumentHandler->endElement( u"CanonicalizationMethod"_ustr ); /* Write SignatureMethod element */ pAttributeList = new comphelper::AttributeList(); @@ -620,10 +620,10 @@ void XSecController::exportSignature( // Assume that all Reference elements use the same DigestMethod:Algorithm, and that the // SignatureMethod:Algorithm should be the corresponding one. pAttributeList->AddAttribute( - "Algorithm", + u"Algorithm"_ustr, getSignatureURI(signatureInfo.eAlgorithmID, vReferenceInfors[0].nDigestID)); - xDocumentHandler->startElement( "SignatureMethod", pAttributeList ); - xDocumentHandler->endElement( "SignatureMethod" ); + xDocumentHandler->startElement( u"SignatureMethod"_ustr, pAttributeList ); + xDocumentHandler->endElement( u"SignatureMethod"_ustr ); /* Write Reference element */ int j; @@ -640,7 +640,7 @@ void XSecController::exportSignature( */ { pAttributeList->AddAttribute( - "URI", + u"URI"_ustr, refInfor.ouURI); } else @@ -650,23 +650,23 @@ void XSecController::exportSignature( { if (refInfor.ouURI.startsWith("idSignedProperties")) { - pAttributeList->AddAttribute("URI", "#idSignedProperties_" + signatureInfo.ouSignatureId); + pAttributeList->AddAttribute(u"URI"_ustr, "#idSignedProperties_" + signatureInfo.ouSignatureId); if (bXAdESCompliantIfODF && !refInfor.ouType.isEmpty()) { // The reference which points to the SignedProperties // shall have this specific type. - pAttributeList->AddAttribute("Type", refInfor.ouType); + pAttributeList->AddAttribute(u"Type"_ustr, refInfor.ouType); } } else { pAttributeList->AddAttribute( - "URI", + u"URI"_ustr, "#" + refInfor.ouURI); } } - xDocumentHandler->startElement( "Reference", pAttributeList ); + xDocumentHandler->startElement( u"Reference"_ustr, pAttributeList ); { /* Write Transforms element */ if (refInfor.nType == SignatureReferenceType::XMLSTREAM) @@ -675,90 +675,90 @@ void XSecController::exportSignature( */ { xDocumentHandler->startElement( - "Transforms", + u"Transforms"_ustr, css::uno::Reference< css::xml::sax::XAttributeList > (new comphelper::AttributeList())); { pAttributeList = new comphelper::AttributeList(); pAttributeList->AddAttribute( - "Algorithm", + u"Algorithm"_ustr, ALGO_C14N); xDocumentHandler->startElement( - "Transform", + u"Transform"_ustr, pAttributeList ); - xDocumentHandler->endElement( "Transform" ); + xDocumentHandler->endElement( u"Transform"_ustr ); } - xDocumentHandler->endElement( "Transforms" ); + xDocumentHandler->endElement( u"Transforms"_ustr ); } /* Write DigestMethod element */ pAttributeList = new comphelper::AttributeList(); pAttributeList->AddAttribute( - "Algorithm", + u"Algorithm"_ustr, getDigestURI(refInfor.nDigestID)); xDocumentHandler->startElement( - "DigestMethod", + u"DigestMethod"_ustr, pAttributeList ); - xDocumentHandler->endElement( "DigestMethod" ); + xDocumentHandler->endElement( u"DigestMethod"_ustr ); /* Write DigestValue element */ xDocumentHandler->startElement( - "DigestValue", + u"DigestValue"_ustr, css::uno::Reference< css::xml::sax::XAttributeList > (new comphelper::AttributeList())); xDocumentHandler->characters( refInfor.ouDigestValue ); - xDocumentHandler->endElement( "DigestValue" ); + xDocumentHandler->endElement( u"DigestValue"_ustr ); } - xDocumentHandler->endElement( "Reference" ); + xDocumentHandler->endElement( u"Reference"_ustr ); } } - xDocumentHandler->endElement( "SignedInfo" ); + xDocumentHandler->endElement( u"SignedInfo"_ustr ); /* Write SignatureValue element */ xDocumentHandler->startElement( - "SignatureValue", + u"SignatureValue"_ustr, css::uno::Reference< css::xml::sax::XAttributeList > (new comphelper::AttributeList())); xDocumentHandler->characters( signatureInfo.ouSignatureValue ); - xDocumentHandler->endElement( "SignatureValue" ); + xDocumentHandler->endElement( u"SignatureValue"_ustr ); /* Write KeyInfo element */ xDocumentHandler->startElement( - "KeyInfo", + u"KeyInfo"_ustr, css::uno::Reference< css::xml::sax::XAttributeList > (new comphelper::AttributeList())); { // GPG or X509 key? if (!signatureInfo.ouGpgCertificate.isEmpty()) { pAttributeList = new comphelper::AttributeList(); - pAttributeList->AddAttribute("xmlns:loext", NS_LOEXT); + pAttributeList->AddAttribute(u"xmlns:loext"_ustr, NS_LOEXT); /* Write PGPData element */ xDocumentHandler->startElement( - "PGPData", + u"PGPData"_ustr, pAttributeList); { /* Write keyid element */ xDocumentHandler->startElement( - "PGPKeyID", + u"PGPKeyID"_ustr, css::uno::Reference< css::xml::sax::XAttributeList > (new comphelper::AttributeList())); xDocumentHandler->characters(signatureInfo.ouGpgKeyID); - xDocumentHandler->endElement( "PGPKeyID" ); + xDocumentHandler->endElement( u"PGPKeyID"_ustr ); /* Write PGPKeyPacket element */ if (!signatureInfo.ouGpgCertificate.isEmpty()) { xDocumentHandler->startElement( - "PGPKeyPacket", + u"PGPKeyPacket"_ustr, css::uno::Reference< css::xml::sax::XAttributeList > (new comphelper::AttributeList())); xDocumentHandler->characters( signatureInfo.ouGpgCertificate ); - xDocumentHandler->endElement( "PGPKeyPacket" ); + xDocumentHandler->endElement( u"PGPKeyPacket"_ustr ); } /* Write PGPOwner element */ xDocumentHandler->startElement( - "loext:PGPOwner", + u"loext:PGPOwner"_ustr, css::uno::Reference< css::xml::sax::XAttributeList >(new comphelper::AttributeList())); xDocumentHandler->characters( signatureInfo.ouGpgOwner ); - xDocumentHandler->endElement( "loext:PGPOwner" ); + xDocumentHandler->endElement( u"loext:PGPOwner"_ustr ); } - xDocumentHandler->endElement( "PGPData" ); + xDocumentHandler->endElement( u"PGPData"_ustr ); } else { @@ -767,82 +767,82 @@ void XSecController::exportSignature( { /* Write X509Data element */ xDocumentHandler->startElement( - "X509Data", + u"X509Data"_ustr, css::uno::Reference< css::xml::sax::XAttributeList > (new comphelper::AttributeList())); { for (auto const& it : rData) { /* Write X509IssuerSerial element */ xDocumentHandler->startElement( - "X509IssuerSerial", + u"X509IssuerSerial"_ustr, css::uno::Reference< css::xml::sax::XAttributeList > (new comphelper::AttributeList())); { /* Write X509IssuerName element */ xDocumentHandler->startElement( - "X509IssuerName", + u"X509IssuerName"_ustr, css::uno::Reference< css::xml::sax::XAttributeList > (new comphelper::AttributeList())); xDocumentHandler->characters(it.X509IssuerName); - xDocumentHandler->endElement( "X509IssuerName" ); + xDocumentHandler->endElement( u"X509IssuerName"_ustr ); /* Write X509SerialNumber element */ xDocumentHandler->startElement( - "X509SerialNumber", + u"X509SerialNumber"_ustr, css::uno::Reference< css::xml::sax::XAttributeList > (new comphelper::AttributeList())); xDocumentHandler->characters(it.X509SerialNumber); - xDocumentHandler->endElement( "X509SerialNumber" ); + xDocumentHandler->endElement( u"X509SerialNumber"_ustr ); } - xDocumentHandler->endElement( "X509IssuerSerial" ); + xDocumentHandler->endElement( u"X509IssuerSerial"_ustr ); /* Write X509Certificate element */ if (!it.X509Certificate.isEmpty()) { xDocumentHandler->startElement( - "X509Certificate", + u"X509Certificate"_ustr, css::uno::Reference< css::xml::sax::XAttributeList > (new comphelper::AttributeList())); xDocumentHandler->characters(it.X509Certificate); - xDocumentHandler->endElement( "X509Certificate" ); + xDocumentHandler->endElement( u"X509Certificate"_ustr ); } } } - xDocumentHandler->endElement( "X509Data" ); + xDocumentHandler->endElement( u"X509Data"_ustr ); } } } - xDocumentHandler->endElement( "KeyInfo" ); + xDocumentHandler->endElement( u"KeyInfo"_ustr ); OUString sDate; /* Write Object element */ xDocumentHandler->startElement( - "Object", + u"Object"_ustr, css::uno::Reference< css::xml::sax::XAttributeList > (new comphelper::AttributeList())); { /* Write SignatureProperties element */ xDocumentHandler->startElement( - "SignatureProperties", + u"SignatureProperties"_ustr, css::uno::Reference< css::xml::sax::XAttributeList > (new comphelper::AttributeList())); { /* Write SignatureProperty element */ pAttributeList = new comphelper::AttributeList(); pAttributeList->AddAttribute( - "Id", + u"Id"_ustr, signatureInfo.ouDateTimePropertyId); pAttributeList->AddAttribute( - "Target", + u"Target"_ustr, "#" + signatureInfo.ouSignatureId); xDocumentHandler->startElement( - "SignatureProperty", + u"SignatureProperty"_ustr, pAttributeList); { /* Write timestamp element */ pAttributeList = new comphelper::AttributeList(); pAttributeList->AddAttribute( - "xmlns:dc", + u"xmlns:dc"_ustr, NS_DC); xDocumentHandler->startElement( - "dc:date", + u"dc:date"_ustr, pAttributeList); OUStringBuffer buffer; @@ -863,9 +863,9 @@ void XSecController::exportSignature( xDocumentHandler->characters( sDate ); xDocumentHandler->endElement( - "dc:date"); + u"dc:date"_ustr); } - xDocumentHandler->endElement( "SignatureProperty" ); + xDocumentHandler->endElement( u"SignatureProperty"_ustr ); } // Write signature description. @@ -873,49 +873,49 @@ void XSecController::exportSignature( { // SignatureProperty element. pAttributeList = new comphelper::AttributeList(); - pAttributeList->AddAttribute("Id", signatureInfo.ouDescriptionPropertyId); - pAttributeList->AddAttribute("Target", "#" + signatureInfo.ouSignatureId); - xDocumentHandler->startElement("SignatureProperty", pAttributeList); + pAttributeList->AddAttribute(u"Id"_ustr, signatureInfo.ouDescriptionPropertyId); + pAttributeList->AddAttribute(u"Target"_ustr, "#" + signatureInfo.ouSignatureId); + xDocumentHandler->startElement(u"SignatureProperty"_ustr, pAttributeList); { // Description element. pAttributeList = new comphelper::AttributeList(); - pAttributeList->AddAttribute("xmlns:dc", NS_DC); + pAttributeList->AddAttribute(u"xmlns:dc"_ustr, NS_DC); - xDocumentHandler->startElement("dc:description", pAttributeList); + xDocumentHandler->startElement(u"dc:description"_ustr, pAttributeList); xDocumentHandler->characters(signatureInfo.ouDescription); - xDocumentHandler->endElement("dc:description"); + xDocumentHandler->endElement(u"dc:description"_ustr); } - xDocumentHandler->endElement("SignatureProperty"); + xDocumentHandler->endElement(u"SignatureProperty"_ustr); } - xDocumentHandler->endElement( "SignatureProperties" ); + xDocumentHandler->endElement( u"SignatureProperties"_ustr ); } - xDocumentHandler->endElement( "Object" ); + xDocumentHandler->endElement( u"Object"_ustr ); // In XAdES, write another Object element for the QualifyingProperties if (bXAdESCompliantIfODF) { pAttributeList = new comphelper::AttributeList(); - pAttributeList->AddAttribute("xmlns:xd", NS_XD); + pAttributeList->AddAttribute(u"xmlns:xd"_ustr, NS_XD); xDocumentHandler->startElement( - "Object", + u"Object"_ustr, pAttributeList); { pAttributeList = new comphelper::AttributeList(); - pAttributeList->AddAttribute("Target", "#" + signatureInfo.ouSignatureId); + pAttributeList->AddAttribute(u"Target"_ustr, "#" + signatureInfo.ouSignatureId); xDocumentHandler->startElement( - "xd:QualifyingProperties", + u"xd:QualifyingProperties"_ustr, pAttributeList); DocumentSignatureHelper::writeSignedProperties(xDocumentHandler, signatureInfo, sDate, true); writeUnsignedProperties(xDocumentHandler, signatureInfo); - xDocumentHandler->endElement( "xd:QualifyingProperties" ); + xDocumentHandler->endElement( u"xd:QualifyingProperties"_ustr ); } - xDocumentHandler->endElement( "Object" ); + xDocumentHandler->endElement( u"Object"_ustr ); } } - xDocumentHandler->endElement( "Signature" ); + xDocumentHandler->endElement( u"Signature"_ustr ); } void XSecController::exportOOXMLSignature(const uno::Reference<embed::XStorage>& xRootStorage, const uno::Reference<xml::sax::XDocumentHandler>& xDocumentHandler, const SignatureInformation& rInformation) diff --git a/xmlsecurity/source/helper/xsecparser.cxx b/xmlsecurity/source/helper/xsecparser.cxx index cf4f0bbe09fe..fc714e44eaf5 100644 --- a/xmlsecurity/source/helper/xsecparser.cxx +++ b/xmlsecurity/source/helper/xsecparser.cxx @@ -489,7 +489,7 @@ class XSecParser::DsDigestMethodContext virtual void StartElement( css::uno::Reference<css::xml::sax::XAttributeList> const& xAttrs) override { - OUString ouAlgorithm = xAttrs->getValueByName("Algorithm"); + OUString ouAlgorithm = xAttrs->getValueByName(u"Algorithm"_ustr); SAL_WARN_IF( ouAlgorithm.isEmpty(), "xmlsecurity.helper", "no Algorithm in Reference" ); if (ouAlgorithm.isEmpty()) @@ -528,7 +528,7 @@ class XSecParser::DsTransformContext virtual void StartElement( css::uno::Reference<css::xml::sax::XAttributeList> const& xAttrs) override { - OUString ouAlgorithm = xAttrs->getValueByName("Algorithm"); + OUString ouAlgorithm = xAttrs->getValueByName(u"Algorithm"_ustr); if (ouAlgorithm == ALGO_C14N) /* @@ -591,10 +591,10 @@ class XSecParser::DsReferenceContext { m_rParser.HandleIdAttr(xAttrs); - m_URI = xAttrs->getValueByName("URI"); + m_URI = xAttrs->getValueByName(u"URI"_ustr); SAL_WARN_IF(m_URI.isEmpty(), "xmlsecurity.helper", "URI is empty"); // Remember the type of this reference. - m_Type = xAttrs->getValueByName("Type"); + m_Type = xAttrs->getValueByName(u"Type"_ustr); } virtual void EndElement() override @@ -657,7 +657,7 @@ class XSecParser::DsSignatureMethodContext virtual void StartElement( css::uno::Reference<css::xml::sax::XAttributeList> const& xAttrs) override { - OUString ouAlgorithm = xAttrs->getValueByName("Algorithm"); + OUString ouAlgorithm = xAttrs->getValueByName(u"Algorithm"_ustr); if (ouAlgorithm == ALGO_ECDSASHA1 || ouAlgorithm == ALGO_ECDSASHA256 || ouAlgorithm == ALGO_ECDSASHA512) { @@ -1081,7 +1081,7 @@ class XSecParser::XadesSigningTimeContext { if (m_isReferenced) { - m_rParser.m_pXSecController->setDate("", m_Value); + m_rParser.m_pXSecController->setDate(u""_ustr, m_Value); } else { @@ -1442,13 +1442,13 @@ XSecParser::XSecParser(XMLSignatureHelper& rXMLSignatureHelper, { using namespace xmloff::token; m_pNamespaceMap->Add( GetXMLToken(XML_XML), GetXMLToken(XML_N_XML), XML_NAMESPACE_XML ); - m_pNamespaceMap->Add( "_dsig_ooo", GetXMLToken(XML_N_DSIG_OOO), XML_NAMESPACE_DSIG_OOO ); - m_pNamespaceMap->Add( "_dsig", GetXMLToken(XML_N_DSIG), XML_NAMESPACE_DSIG ); - m_pNamespaceMap->Add( "_ds", GetXMLToken(XML_N_DS), XML_NAMESPACE_DS ); - m_pNamespaceMap->Add( "_xades132", GetXMLToken(XML_N_XADES132), XML_NAMESPACE_XADES132); - m_pNamespaceMap->Add( "_xades141", GetXMLToken(XML_N_XADES141), XML_NAMESPACE_XADES141); - m_pNamespaceMap->Add( "_dc", GetXMLToken(XML_N_DC), XML_NAMESPACE_DC ); - m_pNamespaceMap->Add( "_office_libo", + m_pNamespaceMap->Add( u"_dsig_ooo"_ustr, GetXMLToken(XML_N_DSIG_OOO), XML_NAMESPACE_DSIG_OOO ); + m_pNamespaceMap->Add( u"_dsig"_ustr, GetXMLToken(XML_N_DSIG), XML_NAMESPACE_DSIG ); + m_pNamespaceMap->Add( u"_ds"_ustr, GetXMLToken(XML_N_DS), XML_NAMESPACE_DS ); + m_pNamespaceMap->Add( u"_xades132"_ustr, GetXMLToken(XML_N_XADES132), XML_NAMESPACE_XADES132); + m_pNamespaceMap->Add( u"_xades141"_ustr, GetXMLToken(XML_N_XADES141), XML_NAMESPACE_XADES141); + m_pNamespaceMap->Add( u"_dc"_ustr, GetXMLToken(XML_N_DC), XML_NAMESPACE_DC ); + m_pNamespaceMap->Add( u"_office_libo"_ustr, GetXMLToken(XML_N_LO_EXT), XML_NAMESPACE_LO_EXT); } @@ -1464,11 +1464,11 @@ OUString XSecParser::HandleIdAttr(css::uno::Reference<css::xml::sax::XAttributeL OUString XSecParser::getIdAttr(const css::uno::Reference< css::xml::sax::XAttributeList >& xAttribs ) { - OUString ouIdAttr = xAttribs->getValueByName("id"); + OUString ouIdAttr = xAttribs->getValueByName(u"id"_ustr); if (ouIdAttr.isEmpty()) { - ouIdAttr = xAttribs->getValueByName("Id"); + ouIdAttr = xAttribs->getValueByName(u"Id"_ustr); } return ouIdAttr; @@ -1512,7 +1512,7 @@ void SAL_CALL XSecParser::startElement( || localName != "document-signatures") { throw css::xml::sax::SAXException( - "xmlsecurity: unexpected root element", nullptr, + u"xmlsecurity: unexpected root element"_ustr, nullptr, css::uno::Any()); } @@ -1540,13 +1540,13 @@ void SAL_CALL XSecParser::startElement( {//getCaughtException MUST be the first line in the catch block css::uno::Any exc = cppu::getCaughtException(); throw css::xml::sax::SAXException( - "xmlsecurity: Exception in XSecParser::startElement", + u"xmlsecurity: Exception in XSecParser::startElement"_ustr, nullptr, exc); } catch (...) { throw css::xml::sax::SAXException( - "xmlsecurity: unexpected exception in XSecParser::startElement", nullptr, + u"xmlsecurity: unexpected exception in XSecParser::startElement"_ustr, nullptr, css::uno::Any()); } } @@ -1568,13 +1568,13 @@ void SAL_CALL XSecParser::endElement(const OUString& rName) {//getCaughtException MUST be the first line in the catch block css::uno::Any exc = cppu::getCaughtException(); throw css::xml::sax::SAXException( - "xmlsecurity: Exception in XSecParser::endElement", + u"xmlsecurity: Exception in XSecParser::endElement"_ustr, nullptr, exc); } catch (...) { throw css::xml::sax::SAXException( - "xmlsecurity: unexpected exception in XSecParser::endElement", nullptr, + u"xmlsecurity: unexpected exception in XSecParser::endElement"_ustr, nullptr, css::uno::Any()); } diff --git a/xmlsecurity/source/helper/xsecsign.cxx b/xmlsecurity/source/helper/xsecsign.cxx index 6788f694ec2d..633f51517fce 100644 --- a/xmlsecurity/source/helper/xsecsign.cxx +++ b/xmlsecurity/source/helper/xsecsign.cxx @@ -139,7 +139,7 @@ css::uno::Reference< css::xml::crypto::sax::XReferenceResolvedListener > XSecCon { OUString aId = "idSignedProperties_" + internalSignatureInfor.signatureInfor.ouSignatureId; // We write a new reference, so it's possible to use the correct type URI. - internalSignatureInfor.addReference(SignatureReferenceType::SAMEDOCUMENT, digestID, aId, -1, "http://uri.etsi.org/01903#SignedProperties"); + internalSignatureInfor.addReference(SignatureReferenceType::SAMEDOCUMENT, digestID, aId, -1, u"http://uri.etsi.org/01903#SignedProperties"_ustr); size++; } diff --git a/xmlsecurity/source/helper/xsecverify.cxx b/xmlsecurity/source/helper/xsecverify.cxx index c45bece5fed9..553486ca8d36 100644 --- a/xmlsecurity/source/helper/xsecverify.cxx +++ b/xmlsecurity/source/helper/xsecverify.cxx @@ -486,7 +486,7 @@ Reference<css::graphic::XGraphic> lcl_getGraphicFromString(std::u16string_view r graphic::GraphicProvider::create(comphelper::getProcessComponentContext()) ); Reference< io::XInputStream > xInputStream( new ::comphelper::SequenceInputStream( seq ) ); - Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue("InputStream", xInputStream) }; + Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue(u"InputStream"_ustr, xInputStream) }; xGraphic = xGraphicProvider->queryGraphic(aArgs); return xGraphic; diff --git a/xmlsecurity/source/xmlsec/nss/ciphercontext.cxx b/xmlsecurity/source/xmlsec/nss/ciphercontext.cxx index c6031b7e1566..19e4e3ab991f 100644 --- a/xmlsecurity/source/xmlsec/nss/ciphercontext.cxx +++ b/xmlsecurity/source/xmlsec/nss/ciphercontext.cxx @@ -41,7 +41,7 @@ uno::Reference< xml::crypto::XCipherContext > OCipherContext::Create( CK_MECHANI if (!xResult->m_pSlot) { SAL_WARN("xmlsecurity.nss", "PK11_GetBestSlot failed"); - throw uno::RuntimeException("PK11_GetBestSlot failed"); + throw uno::RuntimeException(u"PK11_GetBestSlot failed"_ustr); } SECItem aKeyItem = { siBuffer, @@ -52,7 +52,7 @@ uno::Reference< xml::crypto::XCipherContext > OCipherContext::Create( CK_MECHANI if (!xResult->m_pSymKey) { SAL_WARN("xmlsecurity.nss", "PK11_ImportSymKey failed"); - throw uno::RuntimeException("PK11_ImportSymKey failed"); + throw uno::RuntimeException(u"PK11_ImportSymKey failed"_ustr); } if (nNSSCipherID == CKM_AES_GCM) @@ -68,7 +68,7 @@ uno::Reference< xml::crypto::XCipherContext > OCipherContext::Create( CK_MECHANI if (!xResult->m_pSecParam) { SAL_WARN("xmlsecurity.nss", "SECITEM_AllocItem failed"); - throw uno::RuntimeException("SECITEM_AllocItem failed"); + throw uno::RuntimeException(u"SECITEM_AllocItem failed"_ustr); } assert(aInitializationVector.getLength() == nAESGCMIVSize); xResult->m_AESGCMIV = aInitializationVector; @@ -92,14 +92,14 @@ uno::Reference< xml::crypto::XCipherContext > OCipherContext::Create( CK_MECHANI if (!xResult->m_pSecParam) { SAL_WARN("xmlsecurity.nss", "PK11_ParamFromIV failed"); - throw uno::RuntimeException("PK11_ParamFromIV failed"); + throw uno::RuntimeException(u"PK11_ParamFromIV failed"_ustr); } xResult->m_pContext = PK11_CreateContextBySymKey( nNSSCipherID, bEncryption ? CKA_ENCRYPT : CKA_DECRYPT, xResult->m_pSymKey, xResult->m_pSecParam); if (!xResult->m_pContext) { SAL_WARN("xmlsecurity.nss", "PK11_CreateContextBySymKey failed"); - throw uno::RuntimeException("PK11_CreateContextBySymKey failed"); + throw uno::RuntimeException(u"PK11_CreateContextBySymKey failed"_ustr); } } @@ -111,7 +111,7 @@ uno::Reference< xml::crypto::XCipherContext > OCipherContext::Create( CK_MECHANI if (SAL_MAX_INT8 < xResult->m_nBlockSize) { SAL_WARN("xmlsecurity.nss", "PK11_GetBlockSize unexpected result"); - throw uno::RuntimeException("PK11_GetBlockSize unexpected result"); + throw uno::RuntimeException(u"PK11_GetBlockSize unexpected result"_ustr); } return xResult; } @@ -160,7 +160,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL OCipherContext::convertWithCipherContext( c if (SAL_MAX_INT32 - nAESGCMIVSize - nAESGCMTagSize <= static_cast<size_t>(m_aLastBlock.getLength()) + static_cast<size_t>(aData.getLength())) { m_bBroken = true; - throw uno::RuntimeException("overflow"); + throw uno::RuntimeException(u"overflow"_ustr); } m_aLastBlock.realloc(m_aLastBlock.getLength() + aData.getLength()); memcpy(m_aLastBlock.getArray() + m_aLastBlock.getLength() - aData.getLength(), aData.getConstArray(), aData.getLength()); @@ -228,7 +228,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL OCipherContext::convertWithCipherContext( c { m_bBroken = true; Dispose(); - throw uno::RuntimeException("PK11_CipherOp failed"); + throw uno::RuntimeException(u"PK11_CipherOp failed"_ustr); } m_nConverted += aToConvert.getLength(); @@ -268,7 +268,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL OCipherContext::finalizeCipherContextAndDis { m_bBroken = true; Dispose(); - throw uno::RuntimeException("PK11_Encrypt failed"); + throw uno::RuntimeException(u"PK11_Encrypt failed"_ustr); } assert(outLen == sal::static_int_cast<unsigned>(aResult.getLength() - nAESGCMIVSize)); } @@ -278,7 +278,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL OCipherContext::finalizeCipherContextAndDis { m_bBroken = true; Dispose(); - throw uno::RuntimeException("inconsistent IV"); + throw uno::RuntimeException(u"inconsistent IV"_ustr); } aResult.realloc(m_aLastBlock.getLength() - nAESGCMIVSize - nAESGCMTagSize); if (PK11_Decrypt(m_pSymKey, CKM_AES_GCM, m_pSecParam, @@ -289,7 +289,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL OCipherContext::finalizeCipherContextAndDis { m_bBroken = true; Dispose(); - throw uno::RuntimeException("PK11_Decrypt failed"); + throw uno::RuntimeException(u"PK11_Decrypt failed"_ustr); } assert(outLen == sal::static_int_cast<unsigned>(aResult.getLength())); } @@ -297,7 +297,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL OCipherContext::finalizeCipherContextAndDis { m_bBroken = true; Dispose(); - throw uno::RuntimeException("incorrect size of input"); + throw uno::RuntimeException(u"incorrect size of input"_ustr); } Dispose(); return aResult; @@ -309,7 +309,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL OCipherContext::finalizeCipherContextAndDis // if it is decryption, the amount of data should be rounded to the block size even in case of padding if ( ( !m_bPadding || !m_bEncryption ) && nSizeForPadding ) - throw uno::RuntimeException("The data should contain complete blocks only." ); + throw uno::RuntimeException(u"The data should contain complete blocks only."_ustr ); if ( m_bW3CPadding && m_bEncryption ) { @@ -327,7 +327,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL OCipherContext::finalizeCipherContextAndDis { if (rtl_random_getBytes(nullptr, pLastBlock + nOldLastBlockLen, nPaddingSize - 1) != rtl_Random_E_None) { - throw uno::RuntimeException("rtl_random_getBytes failed"); + throw uno::RuntimeException(u"rtl_random_getBytes failed"_ustr); } } pLastBlock[m_aLastBlock.getLength() - 1] = static_cast< sal_Int8 >( nPaddingSize ); @@ -345,7 +345,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL OCipherContext::finalizeCipherContextAndDis { m_bBroken = true; Dispose(); - throw uno::RuntimeException("PK11_CipherOp failed"); + throw uno::RuntimeException(u"PK11_CipherOp failed"_ustr); } aResult.realloc( nPrefResLen ); @@ -359,7 +359,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL OCipherContext::finalizeCipherContextAndDis { m_bBroken = true; Dispose(); - throw uno::RuntimeException("PK11_DigestFinal failed"); + throw uno::RuntimeException(u"PK11_DigestFinal failed"_ustr); } aResult.realloc( nPrefixLen + nFinalLen ); @@ -376,7 +376,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL OCipherContext::finalizeCipherContextAndDis { m_bBroken = true; Dispose(); - throw uno::RuntimeException("incorrect size of padding"); + throw uno::RuntimeException(u"incorrect size of padding"_ustr); } aResult.realloc(aResult.getLength() - aResult[aResult.getLength()-1]); diff --git a/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx b/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx index 6bffc8ed2800..2647f7991657 100644 --- a/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx +++ b/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx @@ -214,7 +214,7 @@ const OUString & ONSSInitializer::getMozillaCurrentProfile(const css::uno::Refer mozilla::MozillaProductType_Firefox, mozilla::MozillaProductType_Mozilla }; - uno::Reference<uno::XInterface> xInstance = rxContext->getServiceManager()->createInstanceWithContext("com.sun.star.mozilla.MozillaBootstrap", rxContext); + uno::Reference<uno::XInterface> xInstance = rxContext->getServiceManager()->createInstanceWithContext(u"com.sun.star.mozilla.MozillaBootstrap"_ustr, rxContext); OSL_ENSURE( xInstance.is(), "failed to create instance" ); uno::Reference<mozilla::XMozillaBootstrap> xMozillaBootstrap(xInstance,uno::UNO_QUERY); @@ -255,7 +255,7 @@ css::uno::Sequence<css::xml::crypto::NSSProfile> SAL_CALL ONSSInitializer::getNS mozilla::MozillaProductType_Firefox, mozilla::MozillaProductType_Mozilla }; - uno::Reference<uno::XInterface> xInstance = m_xContext->getServiceManager()->createInstanceWithContext("com.sun.star.mozilla.MozillaBootstrap", m_xContext); + uno::Reference<uno::XInterface> xInstance = m_xContext->getServiceManager()->createInstanceWithContext(u"com.sun.star.mozilla.MozillaBootstrap"_ustr, m_xContext); OSL_ENSURE(xInstance.is(), "failed to create instance" ); uno::Reference<mozilla::XMozillaBootstrap> xMozillaBootstrap(xInstance,uno::UNO_QUERY); @@ -282,10 +282,10 @@ css::uno::Sequence<css::xml::crypto::NSSProfile> SAL_CALL ONSSInitializer::getNS { TOOLS_WARN_EXCEPTION("xmlsecurity.xmlsec", "getMozillaCurrentProfile:"); } - aProfileList.push_back({"MANUAL", sUserSelect, mozilla::MozillaProductType_Default}); + aProfileList.push_back({u"MANUAL"_ustr, sUserSelect, mozilla::MozillaProductType_Default}); const char* pEnv = getenv("MOZILLA_CERTIFICATE_FOLDER"); - aProfileList.push_back({"MOZILLA_CERTIFICATE_FOLDER", + aProfileList.push_back({u"MOZILLA_CERTIFICATE_FOLDER"_ustr, pEnv ? OStringToOUString(pEnv, osl_getThreadTextEncoding()) : OUString(), mozilla::MozillaProductType_Default}); @@ -436,7 +436,7 @@ bool nsscrypto_initialize(css::uno::Reference<css::uno::XComponentContext> const if (true) #else #if defined SYSTEM_NSS || defined ANDROID - OUString rootModule("libnssckbi" SAL_DLLEXTENSION); + OUString rootModule(u"libnssckbi" SAL_DLLEXTENSION ""_ustr); #else OUString rootModule("${LO_LIB_DIR}/libnssckbi" SAL_DLLEXTENSION); #endif @@ -565,10 +565,10 @@ css::uno::Reference< css::xml::crypto::XDigestContext > SAL_CALL ONSSInitializer b1KData = ( nDigestID == css::xml::crypto::DigestID::SHA512_1K ); } else - throw css::lang::IllegalArgumentException("Unexpected digest requested.", css::uno::Reference< css::uno::XInterface >(), 1 ); + throw css::lang::IllegalArgumentException(u"Unexpected digest requested."_ustr, css::uno::Reference< css::uno::XInterface >(), 1 ); if ( aParams.hasElements() ) - throw css::lang::IllegalArgumentException("Unexpected arguments provided for digest creation.", css::uno::Reference< css::uno::XInterface >(), 2 ); + throw css::lang::IllegalArgumentException(u"Unexpected arguments provided for digest creation."_ustr, css::uno::Reference< css::uno::XInterface >(), 2 ); css::uno::Reference< css::xml::crypto::XDigestContext > xResult; if( initNSS( m_xContext ) ) @@ -595,20 +595,20 @@ css::uno::Reference< css::xml::crypto::XCipherContext > SAL_CALL ONSSInitializer nNSSCipherID = CKM_AES_GCM; break; default: - throw css::lang::IllegalArgumentException("Unexpected cipher requested.", css::uno::Reference< css::uno::XInterface >(), 1); + throw css::lang::IllegalArgumentException(u"Unexpected cipher requested."_ustr, css::uno::Reference< css::uno::XInterface >(), 1); } if ( aKey.getLength() != 16 && aKey.getLength() != 24 && aKey.getLength() != 32 ) - throw css::lang::IllegalArgumentException("Unexpected key length.", css::uno::Reference< css::uno::XInterface >(), 2 ); + throw css::lang::IllegalArgumentException(u"Unexpected key length."_ustr, css::uno::Reference< css::uno::XInterface >(), 2 ); if ( aParams.hasElements() ) - throw css::lang::IllegalArgumentException("Unexpected arguments provided for cipher creation.", css::uno::Reference< css::uno::XInterface >(), 5 ); + throw css::lang::IllegalArgumentException(u"Unexpected arguments provided for cipher creation."_ustr, css::uno::Reference< css::uno::XInterface >(), 5 ); css::uno::Reference< css::xml::crypto::XCipherContext > xResult; if( initNSS( m_xContext ) ) { if ( aInitializationVector.getLength() != PK11_GetIVLength( nNSSCipherID ) ) - throw css::lang::IllegalArgumentException("Unexpected length of initialization vector.", css::uno::Reference< css::uno::XInterface >(), 3 ); + throw css::lang::IllegalArgumentException(u"Unexpected length of initialization vector."_ustr, css::uno::Reference< css::uno::XInterface >(), 3 ); xResult = OCipherContext::Create( nNSSCipherID, aKey, aInitializationVector, bEncryption, bW3CPadding ); assert(xResult.is()); @@ -620,7 +620,7 @@ css::uno::Reference< css::xml::crypto::XCipherContext > SAL_CALL ONSSInitializer /* XServiceInfo */ OUString SAL_CALL ONSSInitializer::getImplementationName() { - return "com.sun.star.xml.crypto.NSSInitializer"; + return u"com.sun.star.xml.crypto.NSSInitializer"_ustr; } sal_Bool SAL_CALL ONSSInitializer::supportsService( const OUString& rServiceName ) diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx index e35fe7ca0c78..bbdef624742f 100644 --- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx @@ -138,7 +138,7 @@ SecurityEnvironment_NssImpl::~SecurityEnvironment_NssImpl() { /* XServiceInfo */ OUString SAL_CALL SecurityEnvironment_NssImpl::getImplementationName() { - return "com.sun.star.xml.crypto.SecurityEnvironment"; + return u"com.sun.star.xml.crypto.SecurityEnvironment"_ustr; } /* XServiceInfo */ @@ -148,7 +148,7 @@ sal_Bool SAL_CALL SecurityEnvironment_NssImpl::supportsService( const OUString& /* XServiceInfo */ Sequence< OUString > SAL_CALL SecurityEnvironment_NssImpl::getSupportedServiceNames() { - Sequence<OUString> seqServiceNames{ "com.sun.star.xml.crypto.SecurityEnvironment" }; + Sequence<OUString> seqServiceNames{ u"com.sun.star.xml.crypto.SecurityEnvironment"_ustr }; return seqServiceNames; } diff --git a/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx index d8b0b0e6e16a..8a3c5551ad7a 100644 --- a/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx @@ -88,7 +88,7 @@ void SAL_CALL SEInitializer_NssImpl::freeSecurityContext( const uno::Reference< /* XServiceInfo */ OUString SAL_CALL SEInitializer_NssImpl::getImplementationName( ) { - return "com.sun.star.xml.crypto.SEInitializer"; + return u"com.sun.star.xml.crypto.SEInitializer"_ustr; } sal_Bool SAL_CALL SEInitializer_NssImpl::supportsService( const OUString& rServiceName ) { @@ -96,7 +96,7 @@ sal_Bool SAL_CALL SEInitializer_NssImpl::supportsService( const OUString& rServi } uno::Sequence< OUString > SAL_CALL SEInitializer_NssImpl::getSupportedServiceNames( ) { - return { "com.sun.star.xml.crypto.SEInitializer" }; + return { u"com.sun.star.xml.crypto.SEInitializer"_ustr }; } namespace { @@ -118,12 +118,12 @@ NSSInitializer_NssImpl::NSSInitializer_NssImpl(const uno::Reference<uno::XCompon OUString NSSInitializer_NssImpl::getImplementationName() { - return "com.sun.star.xml.crypto.NSSInitializer"; + return u"com.sun.star.xml.crypto.NSSInitializer"_ustr; } uno::Sequence<OUString> SAL_CALL NSSInitializer_NssImpl::getSupportedServiceNames() { - return { "com.sun.star.xml.crypto.NSSInitializer" }; + return { u"com.sun.star.xml.crypto.NSSInitializer"_ustr }; } extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface* diff --git a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx index b8bfa1311dc6..c0fc6a4fc7c4 100644 --- a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx @@ -481,7 +481,7 @@ sal_Int32 SAL_CALL X509Certificate_NssImpl::getCertificateUsage( ) /* XServiceInfo */ OUString SAL_CALL X509Certificate_NssImpl::getImplementationName() { - return "com.sun.star.xml.security.gpg.XCertificate_NssImpl"; + return u"com.sun.star.xml.security.gpg.XCertificate_NssImpl"_ustr; } /* XServiceInfo */ diff --git a/xmlsecurity/source/xmlsec/nss/xmlsecuritycontext_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/xmlsecuritycontext_nssimpl.cxx index 9ccf0ab982e6..92e8cfd7b6ca 100644 --- a/xmlsecurity/source/xmlsec/nss/xmlsecuritycontext_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/xmlsecuritycontext_nssimpl.cxx @@ -127,7 +127,7 @@ void SAL_CALL XMLSecurityContext_NssImpl::setDefaultSecurityEnvironmentIndex( sa /* XServiceInfo */ OUString SAL_CALL XMLSecurityContext_NssImpl::getImplementationName() { - return "com.sun.star.xml.crypto.XMLSecurityContext"; + return u"com.sun.star.xml.crypto.XMLSecurityContext"_ustr; } /* XServiceInfo */ @@ -137,7 +137,7 @@ sal_Bool SAL_CALL XMLSecurityContext_NssImpl::supportsService( const OUString& s /* XServiceInfo */ uno::Sequence< OUString > SAL_CALL XMLSecurityContext_NssImpl::getSupportedServiceNames() { - return { "com.sun.star.xml.crypto.XMLSecurityContext" }; + return { u"com.sun.star.xml.crypto.XMLSecurityContext"_ustr }; } extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface* diff --git a/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx index 23b6ddac84c2..ce61942dda27 100644 --- a/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx @@ -238,7 +238,7 @@ SAL_CALL XMLSignature_NssImpl::validate( // limit possible key data to valid X509 certificates only, no KeyValues if (xmlSecPtrListAdd(&(pDsigCtx->keyInfoReadCtx.enabledKeyData), BAD_CAST xmlSecNssKeyDataX509GetKlass()) < 0) - throw RuntimeException("failed to limit allowed key data"); + throw RuntimeException(u"failed to limit allowed key data"_ustr); xmlBufferPtr pBuf = xmlBufferCreate(); xmlNodeDump(pBuf, nullptr, pNode, 0, 0); @@ -289,7 +289,7 @@ SAL_CALL XMLSignature_NssImpl::validate( /* XServiceInfo */ OUString SAL_CALL XMLSignature_NssImpl::getImplementationName() { - return "com.sun.star.xml.crypto.XMLSignature"; + return u"com.sun.star.xml.crypto.XMLSignature"_ustr; } /* XServiceInfo */ @@ -307,7 +307,7 @@ sal_Bool SAL_CALL XMLSignature_NssImpl::supportsService(const OUString& rService /* XServiceInfo */ Sequence<OUString> SAL_CALL XMLSignature_NssImpl::getSupportedServiceNames() { - return { "com.sun.star.xml.crypto.XMLSignature" }; + return { u"com.sun.star.xml.crypto.XMLSignature"_ustr }; } extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface* diff --git a/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx b/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx index 724cd5f24539..87c84471549c 100644 --- a/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx +++ b/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx @@ -185,7 +185,7 @@ void XMLDocumentWrapper_XmlSecImpl::sendStartElement( if (pNsDef->prefix == nullptr) { pAttributeList->AddAttribute( - STRXMLNS, + u"" STRXMLNS ""_ustr, OUString::fromUtf8(reinterpret_cast<char const *>(pNsHref))); } else @@ -877,7 +877,7 @@ void SAL_CALL XMLDocumentWrapper_XmlSecImpl::compressedSetDocumentLocator( sal_I /* XServiceInfo */ OUString SAL_CALL XMLDocumentWrapper_XmlSecImpl::getImplementationName( ) { - return "com.sun.star.xml.wrapper.XMLDocumentWrapper"; + return u"com.sun.star.xml.wrapper.XMLDocumentWrapper"_ustr; } sal_Bool SAL_CALL XMLDocumentWrapper_XmlSecImpl::supportsService( const OUString& rServiceName ) @@ -887,7 +887,7 @@ sal_Bool SAL_CALL XMLDocumentWrapper_XmlSecImpl::supportsService( const OUString uno::Sequence< OUString > SAL_CALL XMLDocumentWrapper_XmlSecImpl::getSupportedServiceNames( ) { - return { "com.sun.star.xml.wrapper.XMLDocumentWrapper" }; + return { u"com.sun.star.xml.wrapper.XMLDocumentWrapper"_ustr }; } extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface* diff --git a/xmlsecurity/source/xmlsec/xmlelementwrapper_xmlsecimpl.cxx b/xmlsecurity/source/xmlsec/xmlelementwrapper_xmlsecimpl.cxx index 295dcab98083..ce15d08472b7 100644 --- a/xmlsecurity/source/xmlsec/xmlelementwrapper_xmlsecimpl.cxx +++ b/xmlsecurity/source/xmlsec/xmlelementwrapper_xmlsecimpl.cxx @@ -32,7 +32,7 @@ XMLElementWrapper_XmlSecImpl::XMLElementWrapper_XmlSecImpl(const xmlNodePtr pNod /* XServiceInfo */ OUString SAL_CALL XMLElementWrapper_XmlSecImpl::getImplementationName( ) { - return "com.sun.star.xml.wrapper.XMLElementWrapper"; + return u"com.sun.star.xml.wrapper.XMLElementWrapper"_ustr; } sal_Bool SAL_CALL XMLElementWrapper_XmlSecImpl::supportsService( const OUString& rServiceName ) @@ -42,7 +42,7 @@ sal_Bool SAL_CALL XMLElementWrapper_XmlSecImpl::supportsService( const OUString& uno::Sequence< OUString > SAL_CALL XMLElementWrapper_XmlSecImpl::getSupportedServiceNames( ) { - return { "com.sun.star.xml.wrapper.XMLElementWrapper" }; + return { u"com.sun.star.xml.wrapper.XMLElementWrapper"_ustr }; } extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface* diff --git a/xmlsecurity/source/xmlsec/xmlsec_init.cxx b/xmlsecurity/source/xmlsec/xmlsec_init.cxx index c8eefe2c3aa0..3b1ea179550a 100644 --- a/xmlsecurity/source/xmlsec/xmlsec_init.cxx +++ b/xmlsecurity/source/xmlsec/xmlsec_init.cxx @@ -27,7 +27,7 @@ XSECXMLSEC_DLLPUBLIC void initXmlSec() { //Init xmlsec library if( xmlSecInit() < 0 ) { - throw RuntimeException("Failed to initialize XML Security (xmlsec) library") ; + throw RuntimeException(u"Failed to initialize XML Security (xmlsec) library"_ustr) ; } //Init xmlsec crypto engine library @@ -40,7 +40,7 @@ XSECXMLSEC_DLLPUBLIC void initXmlSec() #ifdef XMLSEC_CRYPTO_NSS if( xmlSecNssInit() < 0 ) { xmlSecShutdown(); - throw RuntimeException("Failed to Initialize XML Security (xmlsec) NSS crypto engine library"); + throw RuntimeException(u"Failed to Initialize XML Security (xmlsec) NSS crypto engine library"_ustr); } #endif @@ -53,7 +53,7 @@ XSECXMLSEC_DLLPUBLIC void initXmlSec() xmlSecNssShutdown(); #endif xmlSecShutdown() ; - throw RuntimeException("Failed to Initialize XML Security (xmlsec) NSS crypto engine library") ; + throw RuntimeException(u"Failed to Initialize XML Security (xmlsec) NSS crypto engine library"_ustr) ; } } |