SignatureReader.h

00001 //
00002 //  Copyright (c) 2006 by Autodesk, Inc.
00003 //
00004 //  By using this code, you are agreeing to the terms and conditions of
00005 //  the License Agreement included in the documentation for this code.
00006 //
00007 //  AUTODESK MAKES NO WARRANTIES, EXPRESS OR IMPLIED, AS TO THE CORRECTNESS
00008 //  OF THIS CODE OR ANY DERIVATIVE WORKS WHICH INCORPORATE IT. AUTODESK
00009 //  PROVIDES THE CODE ON AN "AS-IS" BASIS AND EXPLICITLY DISCLAIMS ANY
00010 //  LIABILITY, INCLUDING CONSEQUENTIAL AND INCIDENTAL DAMAGES FOR ERRORS,
00011 //  OMISSIONS, AND OTHER PROBLEMS IN THE CODE.
00012 //
00013 //  Use, duplication, or disclosure by the U.S. Government is subject to
00014 //  restrictions set forth in FAR 52.227-19 (Commercial Computer Software
00015 //  Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) (Rights in Technical
00016 //  Data and Computer Software), as applicable.
00017 //
00018 //  $Header: //DWF/Development/Components/Internal/DWF Toolkit/v7.6/develop/global/src/dwf/package/reader/SignatureReader.h#2 $
00019 //  $DateTime: 2008/06/18 18:08:14 $
00020 //  $Author: gaoje $
00021 //  $Change: 101166 $
00022 //  $Revision: #2 $
00023 //
00024 
00025 #ifndef _DWFTK_SIGNATURE_READER_H
00026 #define _DWFTK_SIGNATURE_READER_H
00027 
00032 
00033 #include <stack>
00034 #include "dwfcore/STL.h"
00035 #include "dwfcore/XML.h"
00036 using namespace DWFCore;
00037 
00038 #include "dwf/Toolkit.h"
00039 #include "dwf/package/XML.h"
00040 #include "dwf/package/X509.h"
00041 
00042 namespace DWFToolkit
00043 {
00044 
00045 // forward decls
00046 class DWFSignature;
00047 
00048 
00061 class DWFSignatureReader : public DWFCore::DWFXMLCallback
00062                                  _DWFTK_EXPORT_API_MEMORY_CONTROL_BASE_MEMBER
00063 {
00064 
00065 public:
00066 
00073     typedef enum teProviderType
00074     {
00078         eProvideNone                =   0x00,
00079 
00083         eProvideSignatureID         =   0x01,
00084 
00088         eProvideSignature           =   0x10,
00089 
00093         eProvideAttributes          =   0x0F,
00094 
00098         eProvideElements            =   0xF0,
00099 
00103         eProvideAll                 =   0xFF
00104 
00105     } teProviderType;
00106 
00110     typedef DWFXMLBuildable::tUnresolvedList            tUnresolvedList;
00111 
00112 
00113     struct RSAKeyValueStrings
00114     {
00115         DWFString _zModulus;
00116         DWFString _zExponent;
00117     };
00118 
00119     struct DSAKeyValueStrings
00120     {
00121         DWFString _zP;
00122         DWFString _zQ;
00123         DWFString _zG;
00124         DWFString _zY;
00125         DWFString _zJ;
00126         DWFString _zSeed;
00127         DWFString _zPgenCounter;
00128     };
00129 
00130 public:
00131 
00139     _DWFTK_API
00140     DWFSignatureReader( DWFPackageReader* pPackageReader = NULL,
00141                         unsigned int      nProviderFlags = eProvideAll )
00142         throw();
00143 
00149     _DWFTK_API
00150     virtual ~DWFSignatureReader()
00151         throw();
00152     
00161     _DWFTK_API
00162     void setResourceObjectID( const DWFString& zObjectID )
00163         throw();
00164 
00173     _DWFTK_API
00174     DWFSignatureReader* filter() const
00175         throw()
00176     {
00177         return _pFilter;
00178     }
00179 
00185     _DWFTK_API
00186     void setFilter( DWFSignatureReader* pFilter )
00187         throw();
00188 
00190 
00194     _DWFTK_API
00195     void notifyStartElement( const char*   zName,
00196                              const char**  ppAttributeList )
00197         throw();
00198 
00202     _DWFTK_API
00203     void notifyEndElement( const char*     zName )
00204         throw();
00205 
00209     _DWFTK_API
00210     void notifyStartNamespace( const char* /*zPrefix*/,
00211                                const char* /*zURI*/ )
00212         throw()
00213     {;}
00214 
00218     _DWFTK_API
00219     void notifyEndNamespace( const char*   /*zPrefix*/ )
00220         throw()
00221     {;}
00222 
00226     _DWFTK_API
00227     void notifyCharacterData( const char* zCData,
00228                               int         nLength )
00229         throw();
00230 
00238     _DWFTK_API
00239     virtual const char* provideSignatureID( const char* zId )
00240         throw( DWFException );
00241 
00249     _DWFTK_API
00250     virtual const DWFString& provideReference( const DWFString& zReferenceURI )
00251         throw( DWFException );
00252 
00260     _DWFTK_API
00261     virtual const DWFString& provideSignatureMethod( const DWFString& zSigMethod )
00262         throw( DWFException );
00263 
00271     _DWFTK_API
00272     virtual const DWFString& provideSignatureValue( const DWFString& zSigValue )
00273         throw( DWFException );
00274 
00285     _DWFTK_API
00286     virtual X509Data* provideX509Data( X509Data* pX509Data )
00287         throw( DWFException );
00288 
00296     _DWFTK_API
00297     virtual const DWFString& provideDigestMethod( const DWFString& zDigestMethod )
00298         throw( DWFException );
00299 
00307     _DWFTK_API
00308     virtual const DWFString& provideDigestValue( const DWFString& zDigestValue )
00309         throw( DWFException );
00310 
00318     _DWFTK_API
00319     virtual const DWFSignatureReader::RSAKeyValueStrings& provideRSAKeyValueStrings( const DWFSignatureReader::RSAKeyValueStrings& rRSAKeyValueStrings )
00320         throw( DWFException );
00321 
00329     _DWFTK_API
00330     virtual const DWFSignatureReader::DSAKeyValueStrings& provideDSAKeyValueStrings( const DWFSignatureReader::DSAKeyValueStrings& pDSAKeyValueStrings )
00331         throw( DWFException );
00332 
00340     _DWFTK_API
00341     virtual const DWFString& provideKeyName( const DWFString& zKeyName )
00342         throw( DWFException );
00343 
00344 private:
00345 
00346     _DWFTK_API
00347     void _provideSignatureID( const char* zId )
00348         throw( DWFException );
00349 
00350     _DWFTK_API
00351     void _provideReference( const DWFString& zReferenceURI )
00352         throw( DWFException );
00353 
00354     _DWFTK_API
00355     void _provideSignatureMethod( const DWFString& zSigMethod )
00356         throw( DWFException );
00357 
00358     _DWFTK_API
00359     void _provideSignatureValue( const DWFString& zSigValue )
00360         throw( DWFException );
00361 
00362     _DWFTK_API
00363     void _provideX509Data( X509Data *pX509Data )
00364         throw( DWFException );
00365 
00366     _DWFTK_API
00367     void _provideDigestMethod( const DWFString& zDigestMethod )
00368         throw( DWFException );
00369 
00370     _DWFTK_API
00371     void _provideDigestValue( const DWFString& zDigestValue )
00372         throw( DWFException );
00373 
00374     _DWFTK_API
00375     void _provideRSAKeyValueStrings( const DWFSignatureReader::RSAKeyValueStrings& rRSAKeyValueStrings )
00376         throw( DWFException );
00377 
00378     _DWFTK_API
00379     void _provideDSAKeyValueStrings( const DWFSignatureReader::DSAKeyValueStrings& rDSAKeyValueStrings )
00380         throw( DWFException );
00381 
00382     _DWFTK_API
00383     void _provideKeyName( const DWFString& zKeyName )
00384         throw( DWFException );
00385 
00386 
00387     _DWFTK_API
00388     DWFString _findAttributeValue( const char*  pAttributeName,
00389                                    const char** ppAttributeList )
00390         throw();
00391 
00392 protected:
00393 
00394     DWFPackageReader*           _pPackageReader;
00395 
00400     DWFXMLElementBuilder        _oDefaultElementBuilder;
00401 
00407     DWFXMLElementBuilder*       _pElementBuilder;
00408 
00409 private:
00410 
00411     unsigned int                _nCurrentCollectionProvider;
00412     unsigned int                _nProviderFlags;
00413 
00414     DWFSignatureReader*         _pFilter;
00415 
00416     DWFString                   _zResourceObjectID;
00417     DWFString                   _zCDataAccumulator;
00418 
00419     DWFSignatureReader::DSAKeyValueStrings _oCurrentDSAKeyValueStrings;
00420     DWFSignatureReader::RSAKeyValueStrings _oCurrentRSAKeyValueStrings;
00421 
00422     X509Data*                   _pCurrentX509Data;
00423     X509IssuerSerial*           _pCurrentX509IssuerSerial;
00424 
00425 private:
00426 
00427     //
00428     // Not implemented
00429     //
00430     DWFSignatureReader( const DWFSignatureReader& );
00431     DWFSignatureReader& operator=( const DWFSignatureReader& );
00432 
00433 };
00434 
00435 }
00436 
00437 
00438 #endif
00439 
00440 

Generated on Tue Jan 6 22:40:05 2009 for Autodesk DWF Toolkit by  doxygen 1.4.5