diff options
Diffstat (limited to 'xmlsecurity/source/helper/xsecctl.hxx')
-rw-r--r-- | xmlsecurity/source/helper/xsecctl.hxx | 248 |
1 files changed, 124 insertions, 124 deletions
diff --git a/xmlsecurity/source/helper/xsecctl.hxx b/xmlsecurity/source/helper/xsecctl.hxx index 5fafb4c51fa9..73d6e0d198a0 100644 --- a/xmlsecurity/source/helper/xsecctl.hxx +++ b/xmlsecurity/source/helper/xsecctl.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -70,49 +70,49 @@ /* * all stringS in signature element */ -#define TAG_SIGNATURE "Signature" -#define TAG_SIGNEDINFO "SignedInfo" -#define TAG_CANONICALIZATIONMETHOD "CanonicalizationMethod" -#define TAG_SIGNATUREMETHOD "SignatureMethod" -#define TAG_REFERENCE "Reference" -#define TAG_TRANSFORMS "Transforms" -#define TAG_TRANSFORM "Transform" -#define TAG_DIGESTMETHOD "DigestMethod" -#define TAG_DIGESTVALUE "DigestValue" -#define TAG_SIGNATUREVALUE "SignatureValue" -#define TAG_KEYINFO "KeyInfo" -#define TAG_X509DATA "X509Data" -#define TAG_X509ISSUERSERIAL "X509IssuerSerial" -#define TAG_X509ISSUERNAME "X509IssuerName" -#define TAG_X509SERIALNUMBER "X509SerialNumber" -#define TAG_X509CERTIFICATE "X509Certificate" -#define TAG_OBJECT "Object" -#define TAG_SIGNATUREPROPERTIES "SignatureProperties" -#define TAG_SIGNATUREPROPERTY "SignatureProperty" -#define TAG_TIMESTAMP "timestamp" -#define TAG_DATE "date" -//#define TAG_TIME "time" - -#define ATTR_XMLNS "xmlns" -#define ATTR_ALGORITHM "Algorithm" -#define ATTR_URI "URI" -#define ATTR_ID "Id" -#define ATTR_TARGET "Target" - -#define NSTAG_DC "dc" - -#define NS_XMLDSIG "http://www.w3.org/2000/09/xmldsig#" -//#define NS_DATETIME "http://www.ietf.org/rfcXXXX.txt" -#define NS_DC "http://purl.org/dc/elements/1.1/" - -#define ALGO_C14N "http://www.w3.org/TR/2001/REC-xml-c14n-20010315" -#define ALGO_RSASHA1 "http://www.w3.org/2000/09/xmldsig#rsa-sha1" -#define ALGO_XMLDSIGSHA1 "http://www.w3.org/2000/09/xmldsig#sha1" - -#define CHAR_FRAGMENT "#" -#define CHAR_BLANK " " - - +#define TAG_SIGNATURE "Signature" +#define TAG_SIGNEDINFO "SignedInfo" +#define TAG_CANONICALIZATIONMETHOD "CanonicalizationMethod" +#define TAG_SIGNATUREMETHOD "SignatureMethod" +#define TAG_REFERENCE "Reference" +#define TAG_TRANSFORMS "Transforms" +#define TAG_TRANSFORM "Transform" +#define TAG_DIGESTMETHOD "DigestMethod" +#define TAG_DIGESTVALUE "DigestValue" +#define TAG_SIGNATUREVALUE "SignatureValue" +#define TAG_KEYINFO "KeyInfo" +#define TAG_X509DATA "X509Data" +#define TAG_X509ISSUERSERIAL "X509IssuerSerial" +#define TAG_X509ISSUERNAME "X509IssuerName" +#define TAG_X509SERIALNUMBER "X509SerialNumber" +#define TAG_X509CERTIFICATE "X509Certificate" +#define TAG_OBJECT "Object" +#define TAG_SIGNATUREPROPERTIES "SignatureProperties" +#define TAG_SIGNATUREPROPERTY "SignatureProperty" +#define TAG_TIMESTAMP "timestamp" +#define TAG_DATE "date" +//#define TAG_TIME "time" + +#define ATTR_XMLNS "xmlns" +#define ATTR_ALGORITHM "Algorithm" +#define ATTR_URI "URI" +#define ATTR_ID "Id" +#define ATTR_TARGET "Target" + +#define NSTAG_DC "dc" + +#define NS_XMLDSIG "http://www.w3.org/2000/09/xmldsig#" +//#define NS_DATETIME "http://www.ietf.org/rfcXXXX.txt" +#define NS_DC "http://purl.org/dc/elements/1.1/" + +#define ALGO_C14N "http://www.w3.org/TR/2001/REC-xml-c14n-20010315" +#define ALGO_RSASHA1 "http://www.w3.org/2000/09/xmldsig#rsa-sha1" +#define ALGO_XMLDSIGSHA1 "http://www.w3.org/2000/09/xmldsig#sha1" + +#define CHAR_FRAGMENT "#" +#define CHAR_BLANK " " + + /* * status of security related components */ @@ -129,22 +129,22 @@ class InternalSignatureInformation { public: SignatureInformation signatureInfor; - + com::sun::star::uno::Reference< - com::sun::star::xml::crypto::sax::XReferenceResolvedListener > + com::sun::star::xml::crypto::sax::XReferenceResolvedListener > xReferenceResolvedListener; - + ::std::vector< sal_Int32 > vKeeperIds; - + InternalSignatureInformation( - sal_Int32 nId, + sal_Int32 nId, com::sun::star::uno::Reference< com::sun::star::xml::crypto::sax::XReferenceResolvedListener > xListener) :signatureInfor(nId) { xReferenceResolvedListener = xListener; } - + void addReference( sal_Int32 type, rtl::OUString uri, sal_Int32 keeperId ) { signatureInfor.vSignatureReferenceInfors.push_back( @@ -155,62 +155,62 @@ public: typedef ::std::vector< InternalSignatureInformation > InternalSignatureInformations; -class XSecController : public cppu::WeakImplHelper4 -< +class XSecController : public cppu::WeakImplHelper4 +< com::sun::star::xml::crypto::sax::XSecurityController, //com::sun::star::beans::XFastPropertySet, com::sun::star::xml::crypto::sax::XSAXEventKeeperStatusChangeListener, com::sun::star::xml::crypto::sax::XSignatureCreationResultListener, - com::sun::star::xml::crypto::sax::XSignatureVerifyResultListener + com::sun::star::xml::crypto::sax::XSignatureVerifyResultListener > /****** XSecController.hxx/CLASS XSecController ******************************* * * NAME - * XSecController -- the xml security framework controller + * XSecController -- the xml security framework controller * * FUNCTION - * Controlls the whole xml security framework to create signatures or to - * verify signatures. + * Controlls the whole xml security framework to create signatures or to + * verify signatures. * * HISTORY - * 05.01.2004 - Interface supported: XSecurityController, - * XFastPropertySet, XSAXEventKeeperStatusChangeListener, - * XSignatureCreationResultListener, - * XSignatureVerifyResultListener + * 05.01.2004 - Interface supported: XSecurityController, + * XFastPropertySet, XSAXEventKeeperStatusChangeListener, + * XSignatureCreationResultListener, + * XSignatureVerifyResultListener * * NOTES - * The XFastPropertySet interface is used to transfer common values to - * classes in other module, for instance, the signature id for all - * sessions is transferred to xmloff module through this interface. + * The XFastPropertySet interface is used to transfer common values to + * classes in other module, for instance, the signature id for all + * sessions is transferred to xmloff module through this interface. * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { friend class XSecParser; private: com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext> mxCtx; - + /* * used to buffer SAX events */ - com::sun::star::uno::Reference< + com::sun::star::uno::Reference< com::sun::star::xml::wrapper::XXMLDocumentWrapper > m_xXMLDocumentWrapper; - + /* * the SAX events keeper */ - com::sun::star::uno::Reference< + com::sun::star::uno::Reference< com::sun::star::xml::crypto::sax::XSecuritySAXEventKeeper > m_xSAXEventKeeper; - + /* * the bridge component which creates/verifies signature */ - com::sun::star::uno::Reference< + com::sun::star::uno::Reference< com::sun::star::xml::crypto::XXMLSignature > m_xXMLSignature; - + /* * the Security Context */ @@ -228,8 +228,8 @@ private: */ com::sun::star::uno::Reference< com::sun::star::xml::crypto::sax::XSignatureVerifyResultListener > m_xSignatureVerifyResultListener; -#endif - +#endif + /* * the security id incrementer, in order to make any security id unique * to the SAXEventKeeper. @@ -242,7 +242,7 @@ private: * Signature information */ InternalSignatureInformations m_vInternalSignatureInformations; - + /* * the previous node on the SAX chain. * The reason that use a Reference<XInterface> type variable @@ -250,22 +250,22 @@ private: * and importing, and there is no other common interface they * can provided. */ - com::sun::star::uno::Reference< + com::sun::star::uno::Reference< com::sun::star::uno::XInterface > m_xPreviousNodeOnSAXChain; /* - * whether the preivous node can provide an XInitiazlize interface, - * use this variable in order to typecast the XInterface to the + * whether the preivous node can provide an XInitiazlize interface, + * use this variable in order to typecast the XInterface to the * correct interface type. */ bool m_bIsPreviousNodeInitializable; - + /* * the next node on the SAX chain. * it can always provide an XDocumentHandler interface. */ - com::sun::star::uno::Reference< + com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler > m_xNextNodeOnSAXChain; - + /* * the ElementStackKeeper is used to reserve the key SAX events. * when the SAXEventKeeper is chained on the SAX chain, it need @@ -282,7 +282,7 @@ private: * <A> * <B/> * <C> - * <D> + * <D> * <E/> * </D> * </C> @@ -290,7 +290,7 @@ private: * * If we consider the SAX event section from startElement(<A>) to * startElement(<D>), then the key SAX events are: - * + * * startElement(<A>), startElement(<C>), startElement(<D>) * * The startElement(<B>) and endElement(<B>) is ignored, because @@ -299,38 +299,38 @@ private: * If we consider the SAX event section from startElement(<D>) to * endElement(<A>), the key SAX events are: * - * startElement(<D>), endElement(<D>), endElement(<C>), + * startElement(<D>), endElement(<D>), endElement(<C>), * endElement(<A>). - */ - com::sun::star::uno::Reference< + */ + com::sun::star::uno::Reference< com::sun::star::xml::crypto::sax::XElementStackKeeper > m_xElementStackKeeper; - + /* * a flag representing whether the SAXEventKeeper is now on the * SAX chain. */ bool m_bIsSAXEventKeeperConnected; - + /* - * a flag representing whether it is collecting some element, + * a flag representing whether it is collecting some element, * which means that the SAXEventKeeper can't be chained off the * SAX chain. */ bool m_bIsCollectingElement; - + /* * a flag representing whether the SAX event stream is blocking, * which also means that the SAXEventKeeper can't be chained off * the SAX chain. */ bool m_bIsBlocking; - + /* * a flag representing the current status of security related * components. */ sal_Int32 m_nStatusOfSecurityComponents; - + /* * a flag representing whether the SAXEventKeeper need to be * on the SAX chain all the time. @@ -348,12 +348,12 @@ private: * error message pointer */ const char *m_pErrorMessage; - + /* * the XSecParser which is used to parse the signature stream */ XSecParser *m_pXSecParser; - + /* * the caller assigned signature id for the next signature in the * signature stream @@ -364,7 +364,7 @@ private: * representing whether to verify the current signature */ bool m_bVerifyCurrentSignature; -public: +public: /* * An xUriBinding is provided to map Uris to XInputStream interfaces. */ @@ -379,7 +379,7 @@ private: sal_Bool convertNumber( sal_Int32& rValue, const rtl::OUString& rString, sal_Int32 nMin, sal_Int32 nMax ); void convertDateTime( ::rtl::OUStringBuffer& rBuffer, const com::sun::star::util::DateTime& rDateTime ); sal_Bool convertDateTime( com::sun::star::util::DateTime& rDateTime, const ::rtl::OUString& rString ); - + void createXSecComponent( ); int findSignatureInfor( sal_Int32 nSecurityId ) const; bool chainOn( bool bRetrievingLastEvent ); @@ -389,7 +389,7 @@ private: com::sun::star::uno::Reference< com::sun::star::io::XInputStream > getObjectInputStream( const rtl::OUString& objectURL ); - + //sal_Int32 getFastPropertyIndex(sal_Int32 nHandle) const; /* @@ -399,7 +399,7 @@ private: com::sun::star::uno::Reference< com::sun::star::xml::crypto::sax::XReferenceResolvedListener > prepareSignatureToWrite( InternalSignatureInformation& signatureInfo ); - + /* * For signature verification */ @@ -409,47 +409,47 @@ private: const rtl::OUString& ouUri, bool isBinary ); void setReferenceCount() const; - + void setX509IssuerName( rtl::OUString& ouX509IssuerName ); void setX509SerialNumber( rtl::OUString& ouX509SerialNumber ); void setX509Certificate( rtl::OUString& ouX509Certificate ); void setSignatureValue( rtl::OUString& ouSignatureValue ); void setDigestValue( rtl::OUString& ouDigestValue ); - + void setDate( rtl::OUString& ouDate ); void setId( rtl::OUString& ouId ); void setPropertyId( rtl::OUString& ouPropertyId ); - - com::sun::star::uno::Reference< + + com::sun::star::uno::Reference< com::sun::star::xml::crypto::sax::XReferenceResolvedListener > prepareSignatureToRead( sal_Int32 nSecurityId ); - + public: XSecController(const com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext>& rxCtx); ~XSecController(); - + sal_Int32 getNewSecurityId( ); - void startMission( const com::sun::star::uno::Reference< + void startMission( const com::sun::star::uno::Reference< com::sun::star::xml::crypto::XUriBinding >& xUriBinding, const com::sun::star::uno::Reference< com::sun::star::xml::crypto::XXMLSecurityContext >& xSecurityContext ); - + void setSAXChainConnector( - const com::sun::star::uno::Reference< + const com::sun::star::uno::Reference< com::sun::star::lang::XInitialization >& xInitialization, - const com::sun::star::uno::Reference< + const com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler >& xDocumentHandler, - const com::sun::star::uno::Reference< + const com::sun::star::uno::Reference< com::sun::star::xml::crypto::sax::XElementStackKeeper >& xElementStackKeeper); void setSAXChainConnector( - const com::sun::star::uno::Reference< + const com::sun::star::uno::Reference< com::sun::star::xml::sax::XParser >& xParser, - const com::sun::star::uno::Reference< + const com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler >& xDocumentHandler, - const com::sun::star::uno::Reference< + const com::sun::star::uno::Reference< com::sun::star::xml::crypto::sax::XElementStackKeeper >& xElementStackKeeper); void clearSAXChainConnector(); @@ -458,13 +458,13 @@ public: SignatureInformation getSignatureInformation( sal_Int32 nSecurityId ) const; SignatureInformations getSignatureInformations() const; - + void exportSignature( - const com::sun::star::uno::Reference< + const com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler >& xDocumentHandler, const SignatureInformation& signatureInfo ); - + /* * For signature generation */ @@ -495,10 +495,10 @@ public: const rtl::OUString& ouX509IssuerName, const rtl::OUString& ouX509SerialNumber, const rtl::OUString& ouX509Cert); - // see the other setX509Certifcate function + // see the other setX509Certifcate function void setX509Certificate( sal_Int32 nSecurityId, - const sal_Int32 nSecurityEnvironmentIndex, + const sal_Int32 nSecurityEnvironmentIndex, const rtl::OUString& ouX509IssuerName, const rtl::OUString& ouX509SerialNumber, const rtl::OUString& ouX509Cert); @@ -506,12 +506,12 @@ public: void setDate( sal_Int32 nSecurityId, const ::com::sun::star::util::DateTime& rDateTime ); - - + + bool WriteSignature( - const com::sun::star::uno::Reference< + const com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler >& xDocumentHandler ); - + /* * For signature verification */ @@ -555,7 +555,7 @@ public: */ virtual void SAL_CALL blockingStatusChanged( sal_Bool isBlocking ) throw (com::sun::star::uno::RuntimeException); - virtual void SAL_CALL collectionStatusChanged( + virtual void SAL_CALL collectionStatusChanged( sal_Bool isInsideCollectedElement ) throw (com::sun::star::uno::RuntimeException); virtual void SAL_CALL bufferStatusChanged( sal_Bool isBufferEmpty ) @@ -574,7 +574,7 @@ public: throw (com::sun::star::uno::RuntimeException); }; -#endif - +#endif + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |