00001 /* 00002 * Copyright 2002-2005 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 * limitations 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.14 2005/06/04 11:30:25 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 00064 class DSIG_EXPORT DSIGSignedInfo { 00065 00066 public: 00067 00070 00083 DSIGSignedInfo(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc, 00084 XSECSafeBufferFormatter * pFormatter, 00085 XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *signedInfoNode, 00086 const XSECEnv * env); 00087 00088 00100 DSIGSignedInfo(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc, 00101 XSECSafeBufferFormatter * pFormatter, 00102 const XSECEnv * env); 00103 00111 ~DSIGSignedInfo(); 00112 00114 00117 00127 void load(void); 00128 00138 bool verify(safeBuffer &errStr); 00139 00148 void hash(void); // Setup hashes for each Reference element 00149 00163 XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * 00164 createBlankSignedInfo(canonicalizationMethod cm, 00165 signatureMethod sm, 00166 hashMethod hm 00167 ); 00168 00179 DSIGReference * createReference(const XMLCh * URI, 00180 hashMethod hm, char * type); 00181 00183 00186 00193 XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *getDOMNode(void); 00194 00201 canonicalizationMethod getCanonicalizationMethod(void); 00202 00209 hashMethod getHashMethod(void); 00210 00217 signatureMethod getSignatureMethod(void); 00218 00226 int getHMACOutputLength(void); 00227 00235 DSIGReferenceList *getReferenceList (void) {return mp_referenceList;} 00236 00238 00239 00240 private: 00241 00242 XSECSafeBufferFormatter * mp_formatter; 00243 bool m_loaded; // Have we already loaded? 00244 XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument 00245 * mp_doc; 00246 XERCES_CPP_NAMESPACE_QUALIFIER DOMNode 00247 * mp_signedInfoNode; 00248 canonicalizationMethod m_canonicalizationMethod; 00249 signatureMethod m_signatureMethod; 00250 hashMethod m_hashMethod; 00251 DSIGReferenceList * mp_referenceList; 00252 int m_HMACOutputLength; 00253 const XSECEnv * mp_env; 00254 00255 // Not implemented constructors 00256 00257 DSIGSignedInfo(); 00258 // DSIGSignedInfo & operator= (const DSIGSignedInfo &); 00259 00260 }; 00261 00262 00263 #endif /* DSIGSIGNEDINFO_INCLUDE */