00001 /* 00002 * Copyright 2002-2004 The Apache Software Foundation. 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * imitations under the License. 00015 */ 00016 00017 /* 00018 * XSEC 00019 * 00020 * DSIGSignature := Class for checking and setting up signature nodes in a DSIG signature 00021 * 00022 * Author(s): Berin Lautenbach 00023 * 00024 * $Id: DSIGSignedInfo.hpp,v 1.11 2004/02/08 10:20:51 blautenb Exp $ 00025 * 00026 */ 00027 00028 #ifndef DSIGSIGNEDINFO_INCLUDE 00029 #define DSIGSIGNEDINFO_INCLUDE 00030 00031 // XSEC Includes 00032 #include <xsec/framework/XSECDefs.hpp> 00033 #include <xsec/utils/XSECSafeBufferFormatter.hpp> 00034 #include <xsec/dsig/DSIGConstants.hpp> 00035 #include <xsec/dsig/DSIGReferenceList.hpp> 00036 00037 // Xerces Includes 00038 00039 XSEC_DECLARE_XERCES_CLASS(DOMDocument); 00040 XSEC_DECLARE_XERCES_CLASS(DOMNode); 00041 XSEC_DECLARE_XERCES_CLASS(DOMElement); 00042 00043 // General includes 00044 00045 #include <vector> 00046 00047 class XSECEnv; 00048 00065 class DSIG_EXPORT DSIGSignedInfo { 00066 00067 public: 00068 00071 00084 DSIGSignedInfo(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc, 00085 XSECSafeBufferFormatter * pFormatter, 00086 XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *signedInfoNode, 00087 const XSECEnv * env); 00088 00089 00101 DSIGSignedInfo(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc, 00102 XSECSafeBufferFormatter * pFormatter, 00103 const XSECEnv * env); 00104 00112 ~DSIGSignedInfo(); 00113 00115 00118 00128 void load(void); 00129 00139 bool verify(safeBuffer &errStr); 00140 00149 void hash(void); // Setup hashes for each Reference element 00150 00164 XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * 00165 createBlankSignedInfo(canonicalizationMethod cm, 00166 signatureMethod sm, 00167 hashMethod hm 00168 ); 00169 00180 DSIGReference * createReference(const XMLCh * URI, 00181 hashMethod hm, char * type); 00182 00184 00187 00194 XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *getDOMNode(void); 00195 00202 canonicalizationMethod getCanonicalizationMethod(void); 00203 00210 hashMethod getHashMethod(void); 00211 00218 signatureMethod getSignatureMethod(void); 00219 00227 int getHMACOutputLength(void); 00228 00236 DSIGReferenceList *getReferenceList (void) {return mp_referenceList;} 00237 00239 00240 00241 private: 00242 00243 XSECSafeBufferFormatter * mp_formatter; 00244 bool m_loaded; // Have we already loaded? 00245 XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument 00246 * mp_doc; 00247 XERCES_CPP_NAMESPACE_QUALIFIER DOMNode 00248 * mp_signedInfoNode; 00249 canonicalizationMethod m_canonicalizationMethod; 00250 signatureMethod m_signatureMethod; 00251 hashMethod m_hashMethod; 00252 DSIGReferenceList * mp_referenceList; 00253 int m_HMACOutputLength; 00254 const XSECEnv * mp_env; 00255 00256 // Not implemented constructors 00257 00258 DSIGSignedInfo(); 00259 // DSIGSignedInfo & operator= (const DSIGSignedInfo &); 00260 00261 }; 00262 00263 00264 #endif /* DSIGSIGNEDINFO_INCLUDE */