summaryrefslogtreecommitdiff
path: root/xmlsecurity/inc/xmlsecurity
diff options
context:
space:
mode:
Diffstat (limited to 'xmlsecurity/inc/xmlsecurity')
-rw-r--r--xmlsecurity/inc/xmlsecurity/certificatechooser.hxx126
-rw-r--r--xmlsecurity/inc/xmlsecurity/certificateviewer.hxx185
-rw-r--r--xmlsecurity/inc/xmlsecurity/digitalsignaturesdialog.hxx152
-rw-r--r--xmlsecurity/inc/xmlsecurity/sigstruct.hxx120
-rw-r--r--xmlsecurity/inc/xmlsecurity/stbcontrl.hxx91
-rw-r--r--xmlsecurity/inc/xmlsecurity/xmlsignaturehelper.hxx214
6 files changed, 888 insertions, 0 deletions
diff --git a/xmlsecurity/inc/xmlsecurity/certificatechooser.hxx b/xmlsecurity/inc/xmlsecurity/certificatechooser.hxx
new file mode 100644
index 000000000000..9df1445849e8
--- /dev/null
+++ b/xmlsecurity/inc/xmlsecurity/certificatechooser.hxx
@@ -0,0 +1,126 @@
+/*************************************************************************
+ *
+ * $RCSfile: certificatechooser.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: mt $ $Date: 2004-07-12 13:15:20 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLSECURITY_CERTIFICATECHOOSER_HXX
+#define _XMLSECURITY_CERTIFICATECHOOSER_HXX
+
+#include <vcl/dialog.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/button.hxx>
+#include <svx/simptabl.hxx>
+
+namespace com {
+namespace sun {
+namespace star {
+namespace security {
+ class XCertificate; }
+namespace xml { namespace crypto {
+ class XSecurityEnvironment; }}
+}}}
+
+#include <com/sun/star/uno/Sequence.hxx>
+
+#ifndef _SIGSTRUCT_HXX
+#include <xmlsecurity/sigstruct.hxx>
+#endif
+
+namespace css = com::sun::star;
+namespace cssu = com::sun::star::uno;
+namespace dcss = ::com::sun::star;
+
+class HeaderBar;
+
+class CertificateChooser : public ModalDialog
+{
+private:
+ // XSecurityEnvironment is needed for building the certification path
+ cssu::Reference< dcss::xml::crypto::XSecurityEnvironment > mxSecurityEnvironment;
+
+ // Show info for this certificate
+ cssu::Sequence< cssu::Reference< dcss::security::XCertificate > > maCerts;
+
+ FixedText maHintFT;
+ SvxSimpleTable maCertLB;
+
+ PushButton maViewBtn;
+
+ FixedLine maBottomSepFL;
+ OKButton maOKBtn;
+ CancelButton maCancelBtn;
+ HelpButton maHelpBtn;
+
+ USHORT GetSelectedEntryPos( void ) const;
+ DECL_LINK( ViewButtonHdl, Button* );
+ DECL_LINK( CertificateHighlightHdl, void* );
+ DECL_LINK( CertificateSelectHdl, void* );
+
+ void ImplShowCertificateDetails();
+
+public:
+ CertificateChooser( Window* pParent, cssu::Reference< dcss::xml::crypto::XSecurityEnvironment >& rxSecurityEnvironment, const SignatureInformations& rCertsToIgnore );
+ ~CertificateChooser();
+
+ cssu::Reference< dcss::security::XCertificate > GetSelectedCertificate();
+
+};
+
+#endif // _XMLSECURITY_CERTIFICATECHOOSER_HXX
+
diff --git a/xmlsecurity/inc/xmlsecurity/certificateviewer.hxx b/xmlsecurity/inc/xmlsecurity/certificateviewer.hxx
new file mode 100644
index 000000000000..200e9373e423
--- /dev/null
+++ b/xmlsecurity/inc/xmlsecurity/certificateviewer.hxx
@@ -0,0 +1,185 @@
+/*************************************************************************
+ *
+ * $RCSfile: certificateviewer.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: mt $ $Date: 2004-07-12 13:15:20 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLSECURITY_CERTIFICATEVIEWER_HXX
+#define _XMLSECURITY_CERTIFICATEVIEWER_HXX
+
+#include <vcl/fixed.hxx>
+#include <vcl/button.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/tabdlg.hxx>
+#include <vcl/tabctrl.hxx>
+#include <vcl/tabpage.hxx>
+#include <svtools/stdctrl.hxx>
+#include <svx/simptabl.hxx>
+#include <svtools/svmedit.hxx>
+
+namespace com {
+namespace sun {
+namespace star {
+namespace security {
+ class XCertificate; }
+namespace xml { namespace crypto {
+ class XSecurityEnvironment; }}
+}}}
+
+namespace css = com::sun::star;
+namespace cssu = com::sun::star::uno;
+namespace dcss = ::com::sun::star;
+
+class CertificateViewer : public TabDialog
+{
+private:
+ friend class CertificateViewerGeneralTP;
+ friend class CertificateViewerDetailsTP;
+ friend class CertificateViewerCertPathTP;
+
+ TabControl maTabCtrl;
+ OKButton maOkBtn;
+ HelpButton maHelpBtn;
+
+ cssu::Reference< dcss::xml::crypto::XSecurityEnvironment > mxSecurityEnvironment;
+ cssu::Reference< dcss::security::XCertificate > mxCert;
+public:
+ CertificateViewer( Window* pParent, cssu::Reference< dcss::xml::crypto::XSecurityEnvironment >& rxSecurityEnvironment, cssu::Reference< dcss::security::XCertificate >& rXCert );
+ virtual ~CertificateViewer();
+};
+
+
+class CertificateViewerTP : public TabPage
+{
+protected:
+ CertificateViewer* mpDlg;
+public:
+ CertificateViewerTP( Window* _pParent, const ResId& _rResId, CertificateViewer* _pDlg );
+ inline void SetTabDlg( CertificateViewer* pTabDlg );
+};
+
+inline void CertificateViewerTP::SetTabDlg( CertificateViewer* _pTabDlg )
+{
+ mpDlg = _pTabDlg;
+}
+
+
+class CertificateViewerGeneralTP : public CertificateViewerTP
+{
+private:
+ Window maFrameWin;
+ FixedImage maCertImg;
+ FixedInfo maCertInfoFI;
+ FixedLine maSep1FL;
+ FixedInfo maHintNotTrustedFI;
+ FixedLine maSep2FL;
+ FixedInfo maIssuedToLabelFI;
+ FixedInfo maIssuedToFI;
+ FixedInfo maIssuedByLabelFI;
+ FixedInfo maIssuedByFI;
+ FixedInfo maValidFromLabelFI;
+ FixedInfo maValidFromFI;
+ FixedInfo maValidToLabelFI;
+ FixedInfo maValidToFI;
+ FixedImage maKeyImg;
+ FixedInfo maHintCorrespPrivKeyFI;
+public:
+ CertificateViewerGeneralTP( Window* pParent, CertificateViewer* _pDlg );
+
+ virtual void ActivatePage();
+};
+
+
+class CertificateViewerDetailsTP : public CertificateViewerTP
+{
+private:
+ SvxSimpleTable maElementsLB;
+ MultiLineEdit maElementML;
+
+ DECL_LINK( ElementSelectHdl, void* );
+ void Clear( void );
+ void InsertElement( const String& _rField, const String& _rValue, const String& _rDetails );
+public:
+ CertificateViewerDetailsTP( Window* pParent, CertificateViewer* _pDlg );
+ virtual ~CertificateViewerDetailsTP();
+
+ virtual void ActivatePage();
+};
+
+
+class CertificateViewerCertPathTP : public CertificateViewerTP
+{
+private:
+ FixedText maCertPathFT;
+ SvTreeListBox maCertPathLB;
+ FixedText maCertStatusFT;
+ MultiLineEdit maCertStatusML;
+
+ DECL_LINK( CertSelectHdl, void* );
+ void Clear( void );
+ void InsertCert( int _nLevel, const String& _rName, const String& _rStatus );
+public:
+ CertificateViewerCertPathTP( Window* pParent, CertificateViewer* _pDlg );
+ virtual ~CertificateViewerCertPathTP();
+
+ virtual void ActivatePage();
+};
+
+
+#endif // _XMLSECURITY_CERTIFICATEVIEWER_HXX
+
diff --git a/xmlsecurity/inc/xmlsecurity/digitalsignaturesdialog.hxx b/xmlsecurity/inc/xmlsecurity/digitalsignaturesdialog.hxx
new file mode 100644
index 000000000000..45c72023546a
--- /dev/null
+++ b/xmlsecurity/inc/xmlsecurity/digitalsignaturesdialog.hxx
@@ -0,0 +1,152 @@
+/*************************************************************************
+ *
+ * $RCSfile: digitalsignaturesdialog.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: mt $ $Date: 2004-07-12 13:15:20 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLSECURITY_DIGITALSIGNATURESDIALOG_HXX
+#define _XMLSECURITY_DIGITALSIGNATURESDIALOG_HXX
+
+#include <vcl/dialog.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/button.hxx>
+#include <svx/simptabl.hxx>
+
+#include <xmlsecurity/xmlsignaturehelper.hxx>
+
+#ifndef _STLP_VECTOR
+#include <vector>
+#endif
+
+namespace com {
+namespace sun {
+namespace star {
+namespace lang {
+ class XMultiServiceFactory; }
+namespace embed {
+ class XStorage; }
+}}}
+
+namespace css = com::sun::star;
+namespace cssu = com::sun::star::uno;
+namespace dcss = ::com::sun::star;
+
+class HeaderBar;
+
+enum DocumentSignatureMode { SignatureModeDocumentContent, SignatureModeMacros, SignatureModePackage };
+
+class DigitalSignaturesDialog : public ModalDialog
+{
+private:
+
+ XMLSignatureHelper maSignatureHelper;
+
+ css::uno::Reference < css::embed::XStorage > mxStore;
+ SignatureInformations aCurrentSignatureInformations;
+ bool mbVerifySignatures;
+ DocumentSignatureMode meSignatureMode;
+
+ // HACK, until sig in storage works
+ rtl::OUString maSigFileName;
+
+ FixedText maHintDocFT;
+ FixedText maHintBasicFT;
+ FixedText maHintPackageFT;
+ SvxSimpleTable maSignaturesLB;
+
+ PushButton maViewBtn;
+ PushButton maAddBtn;
+ PushButton maRemoveBtn;
+
+ FixedLine maBottomSepFL;
+ OKButton maOKBtn;
+ CancelButton maCancelBtn;
+ HelpButton maHelpBtn;
+
+ DECL_LINK( ViewButtonHdl, Button* );
+ DECL_LINK( AddButtonHdl, Button* );
+ DECL_LINK( RemoveButtonHdl, Button* );
+ DECL_LINK( SignatureHighlightHdl, void* );
+ DECL_LINK( SignatureSelectHdl, void* );
+ DECL_LINK( StartVerifySignatureHdl, void* );
+
+ void ImplGetSignatureInformations();
+ void ImplFillSignaturesBox();
+ void ImplShowSignaturesDetails();
+
+public:
+ DigitalSignaturesDialog( Window* pParent, cssu::Reference< css::lang::XMultiServiceFactory >& rxMSF, DocumentSignatureMode eMode );
+ ~DigitalSignaturesDialog();
+
+ // Initialize the dialog and the security environment, returns TRUE on success
+ BOOL Init( const rtl::OUString& rTokenName );
+
+ // Set the storage which should be signed or verified
+ void SetStorage( const cssu::Reference < css::embed::XStorage >& rxStore );
+
+ // HACK: Set a signature file name, use this until sig in storage works!
+ void SetSignatureFileName( const rtl::OUString& rName ) { maSigFileName = rName; }
+
+ // Execute the dialog...
+ short Execute();
+
+ static std::vector< rtl::OUString > CreateElementList( css::uno::Reference < css::embed::XStorage >& rxStore, const ::rtl::OUString rRootStorageName, DocumentSignatureMode eMode );
+};
+
+#endif // _XMLSECURITY_DIGITALSIGNATURESDIALOG_HXX
+
diff --git a/xmlsecurity/inc/xmlsecurity/sigstruct.hxx b/xmlsecurity/inc/xmlsecurity/sigstruct.hxx
new file mode 100644
index 000000000000..72b5d2231fae
--- /dev/null
+++ b/xmlsecurity/inc/xmlsecurity/sigstruct.hxx
@@ -0,0 +1,120 @@
+/*************************************************************************
+ *
+ * $RCSfile: sigstruct.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: mt $ $Date: 2004-07-12 13:15:20 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SIGSTRUCT_HXX
+#define _SIGSTRUCT_HXX
+
+#include <rtl/ustring.hxx>
+
+#ifndef INCLUDED_VECTOR
+#include <vector>
+#define INCLUDED_VECTOR
+#endif
+
+/*
+ * signature status
+ */
+#define STATUS_INIT 0
+#define STATUS_CREATION_SUCCEED 1
+#define STATUS_CREATION_FAIL 2
+#define STATUS_VERIFY_SUCCEED 3
+#define STATUS_VERIFY_FAIL 4
+
+struct SignatureReferenceInformation
+{
+ sal_Int32 nType;
+ rtl::OUString ouURI;
+ rtl::OUString ouDigestValue;
+
+ SignatureReferenceInformation( sal_Int32 type, rtl::OUString uri )
+ {
+ nType = type;
+ ouURI = uri;
+ }
+};
+
+typedef ::std::vector< SignatureReferenceInformation > SignatureReferenceInformations;
+
+struct SignatureInformation
+{
+ sal_Int32 nSecurityId;
+ sal_Int32 nStatus;
+ SignatureReferenceInformations vSignatureReferenceInfors;
+ rtl::OUString ouX509IssuerName;
+ rtl::OUString ouX509SerialNumber;
+ rtl::OUString ouX509Certificate;
+ rtl::OUString ouSignatureValue;
+ rtl::OUString ouDate;
+ rtl::OUString ouTime;
+ rtl::OUString ouSignatureId;
+ rtl::OUString ouPropertyId;
+
+ SignatureInformation( sal_Int32 nId )
+ {
+ nSecurityId = nId;
+ nStatus = STATUS_INIT;
+ }
+};
+
+typedef ::std::vector< SignatureInformation > SignatureInformations;
+
+#endif
+
diff --git a/xmlsecurity/inc/xmlsecurity/stbcontrl.hxx b/xmlsecurity/inc/xmlsecurity/stbcontrl.hxx
new file mode 100644
index 000000000000..14200eaf1f11
--- /dev/null
+++ b/xmlsecurity/inc/xmlsecurity/stbcontrl.hxx
@@ -0,0 +1,91 @@
+/*************************************************************************
+ *
+ * $RCSfile: stbcontrl.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: mt $ $Date: 2004-07-12 13:15:20 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLSECURITY_STBCONTRL_HXX
+#define _XMLSECURITY_STBCONTRL_HXX
+
+#include <sfx2/stbitem.hxx>
+
+
+class SvxSizeItem;
+
+// class SvxPosSizeToolBoxControl ----------------------------------------
+
+class XmlSecStatusBarControl : public SfxStatusBarControl
+{
+private:
+ struct XmlSecStatusBarControl_Impl;
+
+ XmlSecStatusBarControl_Impl* mpImpl;
+
+public:
+ SFX_DECL_STATUSBAR_CONTROL();
+
+ XmlSecStatusBarControl( USHORT _nId, StatusBar& _rStb, SfxBindings& _rBind );
+ ~XmlSecStatusBarControl();
+
+ virtual void StateChanged( USHORT nSID, SfxItemState eState, const SfxPoolItem* pState );
+ virtual void Paint( const UserDrawEvent& rEvt );
+ virtual void Command( const CommandEvent& rCEvt );
+};
+
+#endif
+
diff --git a/xmlsecurity/inc/xmlsecurity/xmlsignaturehelper.hxx b/xmlsecurity/inc/xmlsecurity/xmlsignaturehelper.hxx
new file mode 100644
index 000000000000..63130f9a5baa
--- /dev/null
+++ b/xmlsecurity/inc/xmlsecurity/xmlsignaturehelper.hxx
@@ -0,0 +1,214 @@
+/*************************************************************************
+ *
+ * $RCSfile: xmlsignaturehelper.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: mt $ $Date: 2004-07-12 13:15:20 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLSECURITY_XMLSIGNATUREHELPER_HXX
+#define _XMLSECURITY_XMLSIGNATUREHELPER_HXX
+
+#ifndef _STLP_VECTOR
+#include <vector>
+#endif
+
+#include <tools/link.hxx>
+
+#include <rtl/ustring.hxx>
+
+#include <xmlsecurity/sigstruct.hxx>
+
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/xml/crypto/XUriBinding.hpp>
+#include <com/sun/star/xml/crypto/XSEInitializer.hpp>
+#include <com/sun/star/xml/crypto/sax/XSecurityController.hpp>
+#include <com/sun/star/xml/crypto/sax/XSignatureCreationResultListener.hpp>
+#include <com/sun/star/xml/crypto/sax/XSignatureVerifyResultListener.hpp>
+
+extern rtl::OUString bigIntegerToNumericString( ::com::sun::star::uno::Sequence< sal_Int8 > serial );
+extern ::com::sun::star::uno::Sequence< sal_Int8 > numericStringToBigInteger ( rtl::OUString serialNumber );
+
+class XSecController;
+
+namespace com {
+namespace sun {
+namespace star {
+namespace lang {
+ class XMultiServiceFactory; }
+namespace io {
+ class XOutputStream;
+ class XInputStream; }
+namespace embed {
+ class XStorage; }
+}}}
+
+struct XMLSignatureCreationResult
+{
+ sal_Int32 nSecurityId;
+ com::sun::star::xml::crypto::sax::SignatureCreationResult nSignatureCreationResult;
+
+ XMLSignatureCreationResult( sal_Int32 nId, com::sun::star::xml::crypto::sax::SignatureCreationResult nResult )
+ {
+ nSecurityId = nId;
+ nSignatureCreationResult = nResult;
+ }
+};
+
+struct XMLSignatureVerifyResult
+{
+ sal_Int32 nSecurityId;
+ com::sun::star::xml::crypto::sax::SignatureVerifyResult nSignatureVerifyResult;
+
+ XMLSignatureVerifyResult( sal_Int32 nId, com::sun::star::xml::crypto::sax::SignatureVerifyResult nResult )
+ {
+ nSecurityId = nId;
+ nSignatureVerifyResult = nResult;
+ }
+};
+
+typedef ::std::vector<XMLSignatureCreationResult> XMLSignatureCreationResults;
+typedef ::std::vector<XMLSignatureVerifyResult> XMLSignatureVerifyResults;
+
+
+
+/**********************************************************
+ XMLSignatureHelper
+
+ Helper class for the XML Security framework
+
+ Functions:
+ 1. help to create a security context;
+ 2. help to listen signature creation result;
+ 3. help to listen signature verify result;
+ 4. help to indicate which signature to verify.
+
+ **********************************************************/
+
+class XMLSignatureHelper
+{
+private:
+ ::com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory> mxMSF;
+ ::com::sun::star::uno::Reference< com::sun::star::xml::crypto::sax::XSecurityController > mxSecurityController;
+ ::com::sun::star::uno::Reference< com::sun::star::xml::crypto::XUriBinding > mxUriBinding;
+
+ ::com::sun::star::uno::Reference< com::sun::star::xml::crypto::XSEInitializer > mxSEInitializer;
+ ::com::sun::star::uno::Reference< com::sun::star::xml::crypto::XXMLSecurityContext > mxSecurityContext;
+
+ XMLSignatureCreationResults maCreationResults;
+ XMLSignatureVerifyResults maVerifyResults;
+ XSecController* mpXSecController;
+ bool mbError;
+ Link maStartVerifySignatureHdl;
+
+private:
+ void ImplCreateSEInitializer();
+ DECL_LINK( SignatureCreationResultListener, XMLSignatureCreationResult*);
+ DECL_LINK( SignatureVerifyResultListener, XMLSignatureVerifyResult* );
+ DECL_LINK( StartVerifySignatureElement, const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >* );
+
+ // Not allowed:
+ XMLSignatureHelper(const XMLSignatureHelper&);
+
+public:
+ XMLSignatureHelper(const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory>& rxMSF );
+ ~XMLSignatureHelper();
+
+ // Initialize the security context with given crypto token.
+ // Empty string means default crypto token.
+ // Returns true for success.
+ bool Init( const rtl::OUString& rTokenPath );
+
+ // Set UriBinding to create input streams to open files.
+ // Default implementation is capable to open files from disk.
+ void SetUriBinding( com::sun::star::uno::Reference< com::sun::star::xml::crypto::XUriBinding >& rxUriBinding );
+
+ // Set the storage which should be used by the default UriBinding
+ // Must be set before StatrtMission().
+ void SetStorage( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& rxStorage );
+
+ // Argument for the Link is a uno::Reference< xml::sax::XAttributeList >*
+ // Return 1 to verify, 0 to skip.
+ // Default will verify all.
+ void SetStartVerifySignatureHdl( const Link& rLink );
+
+ // Get the security environment
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XSecurityEnvironment > GetSecurityEnvironment();
+
+ // After signing/veryfieng, get information about signatures
+ SignatureInformations GetSignatureInformations() const;
+
+ // See XSecController for documentation
+ void StartMission();
+ void EndMission();
+ sal_Int32 GetNewSecurityId();
+ void SetX509Certificate( sal_Int32 nSecurityId, const rtl::OUString& ouX509IssuerName, const rtl::OUString& ouX509SerialNumber);
+ void SetDateTime( sal_Int32 nSecurityId, const rtl::OUString& ouDate, const rtl::OUString& ouTime);
+
+ void AddForSigning( sal_Int32 securityId, const rtl::OUString& uri, const rtl::OUString& objectURL, sal_Bool bBinary );
+ bool CreateAndWriteSignatue( const com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler >& xDocumentHandler );
+ bool CreateAndWriteSignatue( const com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >& xOutputStream );
+ bool ReadAndVerifySignatue( const com::sun::star::uno::Reference< com::sun::star::io::XInputStream >& xInputStream );
+
+ // MT: ??? I think only for adding/removing, not for new signatures...
+ // MM: Yes, but if you want to insert a new signature into an existing signature file, those function
+ // will be very usefull, see Mission 3 in the new "multisigdemo" program :-)
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler> CreateDocumentHandlerWithHeader( const com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >& xOutputStream );
+ void CloseDocumentHandler( const ::com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler>& xDocumentHandler );
+ void ExportSignature( const com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler >& xDocumentHandler, const SignatureInformation& signatureInfo );
+};
+
+#endif // _XMLSECURITY_XMLSIGNATUREHELPER_HXX