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

DSIGKeyInfoList.hpp

Go to the documentation of this file.
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  * DSIGKeyInfoList := Class for Loading and storing a list of KeyInfo elements
00021  *                   
00022  * $Id: DSIGKeyInfoList.hpp,v 1.9 2004/02/08 10:20:51 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 
00062 class DSIG_EXPORT DSIGKeyInfoList {
00063 
00064 public:
00065 
00066 #if defined(XSEC_NO_NAMESPACES)
00067     typedef vector<DSIGKeyInfo *>           KeyInfoListVectorType;
00068 #else
00069     typedef std::vector<DSIGKeyInfo *>      KeyInfoListVectorType;
00070 #endif
00071 
00072 #if defined(XSEC_SIZE_T_IN_NAMESPACE_STD)
00073     typedef std::size_t     size_type;
00074 #else
00075     typedef size_t          size_type;
00076 #endif
00077 
00080 
00091     DSIGKeyInfoList(const XSECEnv * env);
00092 
00097     ~DSIGKeyInfoList();
00098 
00100 
00103 
00110     size_t getSize();
00111 
00112     /*
00113      * \brief Get an item
00114      *
00115      * Returns the item at index point in the list
00116      *
00117      * @note This is an internal function and should not be called directly
00118      *
00119      * @param index Pointer into the list
00120      * @returns The indicated element or 0 if it does not exist.
00121      */
00122 
00123     DSIGKeyInfo * item(size_type index);
00124 
00126 
00129 
00141     void addKeyInfo(DSIGKeyInfo * ref);
00142 
00154     void addAndInsertKeyInfo(DSIGKeyInfo * ref);    
00155     
00168     bool addXMLKeyInfo(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *ki);
00169 
00182     bool loadListFromXML(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode * node);
00183 
00184     /*
00185      * \brief Remove a KeyInfo from the list
00186      *
00187      * Removes the KeyInfo element at the indicated index point in the list
00188      *
00189      * @param index Pointer in the list to remove element from
00190      * @returns The removed KeyInfo element
00191      */
00192 
00193     DSIGKeyInfo * removeKeyInfo(size_type index);
00194 
00203     void setEnvironment(const XSECEnv * env) {mp_env = env;}
00204 
00213     void empty();
00214     
00221     bool isEmpty();
00222 
00224 
00227 
00235     XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * 
00236         DSIGKeyInfoList::createKeyInfo(void);
00237 
00250     DSIGKeyInfoValue * appendDSAKeyValue(const XMLCh * P, 
00251                            const XMLCh * Q, 
00252                            const XMLCh * G, 
00253                            const XMLCh * Y);
00254 
00265     DSIGKeyInfoValue * appendRSAKeyValue(const XMLCh * modulus, 
00266                            const XMLCh * exponent);
00267 
00279     DSIGKeyInfoX509 * appendX509Data(void);
00280 
00291     DSIGKeyInfoName * appendKeyName(const XMLCh * name, bool isDName = false);
00292 
00304     DSIGKeyInfoPGPData * appendPGPData(const XMLCh * id, const XMLCh * packet);
00305 
00315     DSIGKeyInfoSPKIData * appendSPKIData(const XMLCh * sexp);
00316 
00326     DSIGKeyInfoMgmtData * appendMgmtData(const XMLCh * data);
00327 
00329 
00330 private:
00331 
00332     DSIGKeyInfoList();
00333 
00334     KeyInfoListVectorType                   m_keyInfoList;
00335     const XSECEnv                           * mp_env;
00336     XERCES_CPP_NAMESPACE_QUALIFIER DOMNode  * mp_keyInfoNode;
00337     // KeyInfoListVectorType::iterator          m_iterator;
00338 };
00339 
00340 
00341 #endif /* DSIGKEYINFOLIST_INCLUDE */

Generated on Sun Mar 14 20:20:34 2004 for XML-Security-C by doxygen 1.3.2