00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074 #include <xsec/framework/XSECDefs.hpp>
00075
00076
00077
00078 #include <xercesc/dom/DOM.hpp>
00079 #include <xercesc/dom/DOMNamedNodeMap.hpp>
00080
00081
00082 #include <xsec/utils/XSECSafeBufferFormatter.hpp>
00083 #include <xsec/dsig/DSIGTransform.hpp>
00084 #include <xsec/dsig/DSIGReferenceList.hpp>
00085 #include <xsec/dsig/DSIGConstants.hpp>
00086
00087 class DSIGTransformList;
00088 class DSIGTransformBase64;
00089 class DSIGTransformC14n;
00090 class DSIGTransformEnvelope;
00091 class DSIGTransformXPath;
00092 class DSIGTransformXSL;
00093 class DSIGSignature;
00094
00095 class TXFMBase;
00096 class TXFMChain;
00097 class XSECBinTXFMInputStream;
00098 class XSECURIResolver;
00099
00113 class DSIG_EXPORT DSIGReference {
00114
00115 public:
00116
00119
00136 DSIGReference(DSIGSignature * sig, DOMNode *dom);
00137
00152 DSIGReference(DSIGSignature * sig);
00153
00163 ~DSIGReference();
00164
00166
00169
00178 void load();
00179
00198 DOMElement * createBlankReference(const XMLCh * URI, hashMethod hm, char * type);
00199
00210 DSIGTransformEnvelope * appendEnvelopedSignatureTransform();
00211
00218 DSIGTransformBase64 * appendBase64Transform();
00219
00231 DSIGTransformXPath * appendXPathTransform(char * expr);
00232
00243 DSIGTransformXSL * appendXSLTransform(DOMNode *stylesheet);
00244
00252 DSIGTransformC14n * appendCanonicalizationTransform(canonicalizationMethod cm);
00253
00267 void setPreHashTXFM(TXFMBase * t);
00268
00269
00271
00274
00287 XSECBinTXFMInputStream * makeBinInputStream(void) const;
00288
00296 const XMLCh * getURI();
00297
00304 bool isManifest();
00305
00313 DSIGReferenceList * getManifestReferenceList();
00314
00315
00317
00320
00333 unsigned int calculateHash(XMLByte * toFill,
00334 unsigned int maxToFill);
00335
00348 unsigned int readHash(XMLByte *toFill,
00349 unsigned int maxToFill);
00350
00361 bool checkHash();
00362
00371 void setHash();
00372
00374
00377
00397 static TXFMChain * DSIGReference::createTXFMChainFromList(TXFMBase * input,
00398 DSIGTransformList * lst);
00399
00412 static DSIGTransformList * loadTransforms(
00413 DOMNode *transformsNode,
00414 XSECSafeBufferFormatter * formatter,
00415 DSIGSignature * sig);
00416
00430 static TXFMBase * getURIBaseTXFM(DOMDocument * doc,
00431 const XMLCh * URI,
00432 XSECURIResolver * resolver);
00433
00447 static DSIGReferenceList *loadReferenceListFromXML(DSIGSignature * sig,
00448 DOMNode *firstReference);
00449
00461 static bool verifyReferenceList(DSIGReferenceList * lst, safeBuffer &errorStr);
00462
00478 static void hashReferenceList(DSIGReferenceList * list, bool interlocking = true);
00479
00481
00482 private:
00483
00484
00485 void createTransformList(void);
00486 void addTransform(DSIGTransform * txfm, DOMElement * txfmElt);
00487
00488
00489 XSECSafeBufferFormatter * mp_formatter;
00490 bool formatterLocal;
00491 DOMNode * mp_referenceNode;
00492 TXFMBase * mp_preHash;
00493 DSIGReferenceList * mp_manifestList;
00494 const XMLCh * mp_URI;
00495 bool m_isManifest;
00496 DOMNode * mp_transformsNode;
00497 hashMethod me_hashMethod;
00498 DOMNode * mp_hashValueNode;
00499 DSIGSignature * mp_parentSignature;
00500 DSIGTransformList * mp_transformList;
00501
00502 DSIGReference();
00503
00504
00505 };
00506
00507
00508
00509