00001 00009 #ifndef __KeyUsage_H__ 00010 #define __KeyUsage_H__ 00011 00012 #if _MSC_VER > 1000 00013 #pragma once 00014 #endif // _MSC_VER > 1000 00015 00016 00017 #include "PKIFdll.h" 00018 #define CAC_API_FACTORY 00019 00020 #include "X509Extension.h" 00021 #include <bitset> 00022 00023 #include <iosfwd> 00024 00025 struct CPKIFKeyUsageImpl; 00026 00052 class CAC_API CPKIFKeyUsage : public CPKIFX509Extension 00053 { 00054 public: 00055 CPKIFKeyUsage(); 00056 //CPKIFKeyUsage(const CACX509V3Extension& ext); 00057 CPKIFKeyUsage(const bool& criticality, const CPKIFBufferPtr& ext); 00058 virtual ~CPKIFKeyUsage(); 00063 static char extOID[]; 00064 const CPKIFOIDPtr oid() const; 00065 00066 bool DigitalSignature() const; 00067 bool NonRepudiation() const; 00068 bool KeyEncipherment() const; 00069 bool DataEncipherment() const; 00070 bool KeyAgreement() const; 00071 bool KeyCertSign() const; 00072 bool CRLSign() const; 00073 bool EncipherOnly() const; 00074 bool DecipherOnly() const; 00075 00076 void SetDigitalSignature(); 00077 void SetNonRepudiation(); 00078 void SetKeyEncipherment(); 00079 void SetDataEncipherment(); 00080 void SetKeyAgreement(); 00081 void SetKeyCertSign(); 00082 void SetCRLSign(); 00083 void SetEncipherOnly(); 00084 void SetDecipherOnly(); 00085 00086 std::bitset<9> GetKeyUsage(); 00087 00088 CPKIFBufferPtr value() const; 00089 00090 private: 00091 CPKIFKeyUsage(const CPKIFKeyUsage& ext); 00092 CPKIFKeyUsage& operator=(const CPKIFKeyUsage& rhs); //added 4/6/2004 00093 00094 struct CPKIFKeyUsageImpl *m_impl; 00095 }; 00096 00097 DECLARE_SMART_POINTERS(CPKIFKeyUsage); 00098 00099 typedef std::vector<CPKIFKeyUsagePtr, PKIFAlloc<CPKIFKeyUsagePtr> > CPKIFKeyUsageList; 00100 DECLARE_SMART_POINTERS(CPKIFKeyUsageList); 00101 00102 CAC_API std::ostream& operator<<(std::ostream & os, const CPKIFKeyUsagePtr & extension); 00103 CAC_API std::ostream& operator<<(std::ostream & os, const CPKIFKeyUsage & extension); 00104 00105 #endif