TSTInfo.h

Go to the documentation of this file.
00001 
00009 #ifndef __TSTINFO_H__
00010 #define __TSTINFO_H__
00011 
00012 #include "PKIFdll.h"
00013 #include "PKIFTSPDLL.h"
00014 #include "IPKIFHasExtensions.h"
00015 
00016 // forward declarations
00017 struct CPKIFTSTInfoImpl;
00018 
00019 FD_SMART_PTR(CPKIFAccuracy);
00020 FD_SMART_PTR(CPKIFGeneralName);
00021 FD_SMART_PTR(CPKIFOID);
00022 FD_SMART_PTR(CPKIFMessageImprint);
00023 FD_SMART_PTR(CPKIFTime);
00024 FD_SMART_PTR(CPKIFBuffer);
00025 FD_SMART_PTR(CPKIFX509Extension);
00026 
00050 class ASN1CGeneralizedTime; //defined in ASN1CGeneralizedTime.h
00051 class PKIFTSP_API CPKIFTSTInfo: public IPKIFHasExtensions
00052 {
00053 public:
00054     CPKIFTSTInfo();
00055     virtual ~CPKIFTSTInfo(void);
00056 
00057     //version - always set to 1
00058     int GetVersion() const;
00059 
00060     //policy
00061     void SetPolicy(CPKIFOIDPtr& policy);
00062     CPKIFOIDPtr GetPolicy() const;
00063 
00064     //message imprint
00065     void SetMessageImprint(CPKIFMessageImprintPtr& messageImprint);
00066     CPKIFMessageImprintPtr GetMessageImprint() const;
00067 
00068     //serialNumber
00069     void SetSerialNumber(CPKIFStringPtr& serialNumber);
00070     const char* GetSerialNumber() const; 
00071 
00072     //genTime
00073     void SetGeneralizedTime(CPKIFTimePtr& genTime);
00074 
00075     void GetExtensionByOID(const CPKIFOID& oid, CPKIFX509ExtensionPtr& ref);
00076     void GetEncodedExtensions (CPKIFBufferPtr& buf);
00077 
00078     CPKIFTimePtr GetGeneralizedTime() const; 
00079 
00080     //accuracy
00081     void SetAccuracy(CPKIFAccuracyPtr& accuracy);
00082     CPKIFAccuracyPtr GetAccuracy() const;
00083 
00084     //ordering
00085     void SetOrdering(bool ordering);
00086     bool GetOrdering() const;
00087 
00088     //nonce
00089     void SetNonce(CPKIFStringPtr& nonce);
00090     const char* GetNonce() const;
00091     
00092     //tsa
00093     void SetTSA(CPKIFGeneralNamePtr& tsa);
00094     CPKIFGeneralNamePtr GetTSA() const;
00095 
00096     //optional field - this version of PKIF does not support encoding extensions in TSP structures
00097     //void AddExtension(CPKIFX509ExtensionPtr& ext);
00098 
00099     //encode
00100     CPKIFBufferPtr Encode();
00101     void Decode(CPKIFBufferPtr& bp);
00102 
00103     bool ExtensionsPresent() const;
00104 
00105     template <class T> boost::shared_ptr<T> GetExtension();
00106 
00107 
00108 private:
00110     CPKIFTSTInfo(const CPKIFTSTInfo& copy);
00112     CPKIFTSTInfo& operator=(const CPKIFTSTInfo& rhs); //added 4/6/2004
00113 
00114     struct CPKIFTSTInfoImpl *m_impl;
00115 };
00116 DECLARE_SMART_POINTERS(CPKIFTSTInfo);
00117 
00119 //@b Interface: External
00120 //
00121 //This function is used to get an extension contained by a TSTInfo object.
00122 //
00123 //@return A smart pointer to an appropriate extension
00124 //*/
00125 //template <typename T>
00126 //shared_ptr<T> CPKIFTSTInfo::GetExtension()
00127 //{
00128 //    CPKIFX509ExtensionPtr ext;
00129 //    CPKIFStringPtr oidStr(new std::string(T::extOID));
00130 //    CPKIFOID oid(oidStr);
00131 //    GetExtensionByOID(oid,ext);
00132 //
00133 //    if(ext && 0 != dynamic_cast<T*>(ext.get())){
00134 //  return *((shared_ptr<T>*)&(ext));
00135 //    }
00136 //
00137 //    shared_ptr<T> nullExt;
00138 //    return nullExt;
00139 //}
00140 
00141 /*template <class T> shared_ptr<T> CPKIFTSTInfo::GetExtension()
00142 
00143 {
00144     if(m_exts.empty() && 0 != m_signedCert->toBeSigned.extensions.count)
00145         populateExtensionsVector();
00146 
00147     CPKIFStringPtr oidStr(new std::string(T::extOID));
00148     CPKIFOID oid(oidStr);
00149 
00150     CPKIFX509Extension* p = NULL;
00151     vector<CPKIFX509ExtensionPtr>::iterator pos;
00152     vector<CPKIFX509ExtensionPtr>::iterator end = m_exts.end();
00153     for(pos = m_exts.begin(); pos != end; ++pos)
00154     {
00155         p = &(*(*pos));
00156         if(oid == (*pos)->oid() && NULL != dynamic_cast<T*>(p))
00157         {
00158 
00159             return *((shared_ptr<T>*)&(*pos));
00160 
00161         }
00162     }       
00163 
00164 
00165     shared_ptr<T> nullExt;
00166 
00167     return nullExt;
00168 }
00169 */
00170 #endif //TSTInfo
00171 

Generated on Mon Nov 15 11:15:57 2010 for PublicKeyInfrastructureFramework(PKIF) by  doxygen 1.5.6