Main Page | Modules | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

DSIGKeyInfoList.hpp

Go to the documentation of this file.
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  * DSIGKeyInfoList := Class for Loading and storing a list of KeyInfo elements
00021  *                   
00022  * $Id: DSIGKeyInfoList.hpp,v 1.12 2005/06/04 11:30:25 blautenb Exp $
00023  *
00024  */
00025 
00026 #ifndef DSIGKEYINFOLIST_INCLUDE
00027 #define DSIGKEYINFOLIST_INCLUDE
00028 
00029 
00030 // XSEC Includes
00031 #include <xsec/framework/XSECDefs.hpp>
00032 #include <xsec/dsig/DSIGKeyInfo.hpp>
00033 #include <xsec/utils/XSECSafeBufferFormatter.hpp>
00034 #include <xsec/enc/XSECCryptoKey.hpp>
00035 
00036 // Xerces
00037 #include <xercesc/dom/DOM.hpp>
00038 
00039 // General includes
00040 #include <vector>
00041 
00042 // Forward definitions
00043 class DSIGKeyInfoValue;
00044 class DSIGKeyInfoX509;
00045 class DSIGKeyInfoName;
00046 class DSIGKeyInfoPGPData;
00047 class DSIGKeyInfoSPKIData;
00048 class DSIGKeyInfoMgmtData;
00049 class DSIGSignature;
00050 
00061 class DSIG_EXPORT DSIGKeyInfoList {
00062 
00063 public:
00064 
00065 #if defined(XSEC_NO_NAMESPACES)
00066     typedef vector<DSIGKeyInfo *>           KeyInfoListVectorType;
00067 #else
00068     typedef std::vector<DSIGKeyInfo *>      KeyInfoListVectorType;
00069 #endif
00070 
00071 #if defined(XSEC_SIZE_T_IN_NAMESPACE_STD)
00072     typedef std::size_t     size_type;
00073 #else
00074     typedef size_t          size_type;
00075 #endif
00076 
00079 
00090     DSIGKeyInfoList(const XSECEnv * env);
00091 
00096     ~DSIGKeyInfoList();
00097 
00099 
00102 
00109     size_t getSize();
00110 
00111     /*
00112      * \brief Get an item
00113      *
00114      * Returns the item at index point in the list
00115      *
00116      * @note This is an internal function and should not be called directly
00117      *
00118      * @param index Pointer into the list
00119      * @returns The indicated element or 0 if it does not exist.
00120      */
00121 
00122     DSIGKeyInfo * item(size_type index);
00123 
00125 
00128 
00140     void addKeyInfo(DSIGKeyInfo * ref);
00141 
00153     void addAndInsertKeyInfo(DSIGKeyInfo * ref);    
00154     
00167     bool addXMLKeyInfo(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *ki);
00168 
00181     bool loadListFromXML(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode * node);
00182 
00183     /*
00184      * \brief Remove a KeyInfo from the list
00185      *
00186      * Removes the KeyInfo element at the indicated index point in the list
00187      *
00188      * @param index Pointer in the list to remove element from
00189      * @returns The removed KeyInfo element
00190      */
00191 
00192     DSIGKeyInfo * removeKeyInfo(size_type index);
00193 
00202     void setEnvironment(const XSECEnv * env) {mp_env = env;}
00203 
00212     void empty();
00213     
00220     bool isEmpty();
00221 
00223 
00226 
00234     XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * 
00235         DSIGKeyInfoList::createKeyInfo(void);
00236 
00249     DSIGKeyInfoValue * appendDSAKeyValue(const XMLCh * P, 
00250                            const XMLCh * Q, 
00251                            const XMLCh * G, 
00252                            const XMLCh * Y);
00253 
00264     DSIGKeyInfoValue * appendRSAKeyValue(const XMLCh * modulus, 
00265                            const XMLCh * exponent);
00266 
00278     DSIGKeyInfoX509 * appendX509Data(void);
00279 
00290     DSIGKeyInfoName * appendKeyName(const XMLCh * name, bool isDName = false);
00291 
00303     DSIGKeyInfoPGPData * appendPGPData(const XMLCh * id, const XMLCh * packet);
00304 
00314     DSIGKeyInfoSPKIData * appendSPKIData(const XMLCh * sexp);
00315 
00325     DSIGKeyInfoMgmtData * appendMgmtData(const XMLCh * data);
00326 
00328 
00329 private:
00330 
00331     DSIGKeyInfoList();
00332 
00333     KeyInfoListVectorType                   m_keyInfoList;
00334     const XSECEnv                           * mp_env;
00335     XERCES_CPP_NAMESPACE_QUALIFIER DOMNode  * mp_keyInfoNode;
00336     // KeyInfoListVectorType::iterator          m_iterator;
00337 };
00338 
00339 
00340 #endif /* DSIGKEYINFOLIST_INCLUDE */

Generated on Sun Jul 3 17:37:25 2005 for XML-Security-C by  doxygen 1.4.2