PKIFTrustRoot.h

Go to the documentation of this file.
00001 
00011 #ifndef __PKIFTRUSTROOT_H__
00012 #define __PKIFTRUSTROOT_H__
00013 
00014 #include "PKIFdll.h"
00015 #include "IPKIFTrustAnchor.h"
00016 #include "IPKIFHasExtensions.h"
00017 
00018 FD_SMART_PTR(CPKIFCertificate);
00019 FD_SMART_PTR(CPKIFName);
00020 
00021 // forward declaration
00022 struct CPKIFTrustRootImp;
00023 
00024 #include <vector>
00025 //using namespace std;
00026 
00034 class CAC_API CPKIFTrustRoot : public IPKIFTrustAnchor, public IPKIFHasExtensions
00035 {
00036 public:
00037     CPKIFTrustRoot();
00038     virtual ~CPKIFTrustRoot();
00039 
00040     //IPKIFTrustAnchor interface
00041     CPKIFCertificatePtr GetCertificate() const;
00042     CPKIFSubjectKeyIdentifierPtr GetKeyIdentifier() const;
00043 
00044     void SetCert(const CPKIFCertificatePtr& cert);
00045     void GetCert(CPKIFCertificatePtr& cert)const;
00046 
00047     void GetName(CPKIFNamePtr& name)const;
00048     CPKIFNamePtr GetSubjectName()const;
00049     CPKIFNamePtr GetIssuerName()const;
00050     CPKIFBufferPtr GetKey() const;
00051     virtual CPKIFSubjectPublicKeyInfoPtr GetSubjectPublicKeyInfo() const;
00052 
00053     bool operator==(const CPKIFTrustRoot& tr);
00054     bool operator==(const IPKIFTrustAnchor& tr);
00055 
00056     //IPKIFHasExtensions
00057     template <typename T> boost::shared_ptr<T> GetExtension();
00058     void GetExtensions (IPKIFParseExtensions* m, std::vector<CPKIFX509ExtensionPtr>& exts);
00059     
00060     void GetExtensionByOID(const CPKIFOID& oid, CPKIFX509ExtensionPtr& ref);
00061     void GetEncodedExtensions (CPKIFBufferPtr& buf);
00062 
00063     virtual CPKIFBufferPtr Encoded();
00064 
00065 private:
00067     CPKIFTrustRoot(const CPKIFTrustRoot& copy);
00069     CPKIFTrustRoot& operator=(const CPKIFTrustRoot& rhs); //added 4/6/2004
00070 
00071     struct CPKIFTrustRootImp *m_impl;
00072 };
00073 DECLARE_SMART_POINTERS(CPKIFTrustRoot);
00074 typedef std::vector<CPKIFTrustRootPtr, PKIFAlloc<CPKIFTrustRootPtr> > CPKIFTrustRootList; 
00075 DECLARE_SMART_POINTERS(CPKIFTrustRootList);
00076 
00077 #include "Certificate.h"
00078 
00088 template <typename T> 
00089 boost::shared_ptr<T> CPKIFTrustRoot::GetExtension()
00090 {
00091     boost::shared_ptr<T> empty;
00092     CPKIFCertificatePtr cert;
00093     GetCert(cert);
00094     if(!cert)
00095     {
00096         return empty;
00097     }
00098     else
00099     {
00100         return cert->GetExtension<T>();
00101     }
00102 }
00103 
00104 #endif

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