00001 /* 00002 * Insert Appropriate Copyright header here.... 00003 * Also, the license should specify that it is LGPL ;) 00004 * ppatterson@carillonis.com 00005 */ 00006 00007 #ifndef __WVX509 00008 #define __WVX509 00009 00010 #include "wvcrypto.h" 00011 #include "wvlog.h" 00012 #include "wvstringlist.h" 00013 #include "strutils.h" 00014 00015 // Structures to make the compiler happy so we don't have to include x509v3.h ;) 00016 struct x509_st; 00017 typedef struct x509_st X509; 00018 00023 class WvX509Mgr 00024 { 00025 public: 00026 00031 WvX509Mgr(X509 *cert = NULL); 00032 00050 WvX509Mgr(WvString dName, int bits, WvRSAKey *_keypair = NULL); 00051 00055 virtual ~WvX509Mgr(); 00056 00057 00061 X509 *cert; 00062 00068 WvRSAKey *keypair; 00069 00076 WvString enccert; 00077 00083 void createSScert(WvString dName, int keysize); 00084 00093 WvString createcertreq(WvString dName, int keysize); 00094 00098 void decodecert(WvString encodedcert); 00099 00104 void encodecert(); 00105 00112 bool validate(); 00113 00118 bool signedbyCAindir(WvString certdir); 00119 00124 bool signedbyCAinfile(WvString certfile); 00125 00129 void signcert(WvRSAKey CAKeypair); 00130 00136 bool isinCRL(); 00137 00141 void dumpcert(WvString outfile, bool append = false); 00142 00146 void dumpkeypair(WvString outfile, bool append = false); 00147 00151 void dumprawkeypair(WvString outfile, bool append = false); 00152 00153 WvLog debug; 00154 00158 bool err; 00159 WvString errstr; 00160 00161 void seterr(const WvString &s) 00162 { err = true; errstr = s; } 00163 00164 protected: 00165 00166 private: 00167 00168 00169 }; 00170 00171 #endif // __WVX509