00001 #ifndef __CERT_H__ 00002 #define __CERT_H__ 00003 00004 #include <openssl/rsa.h> 00005 #include <openssl/crypto.h> 00006 #include <openssl/x509.h> 00007 #include <openssl/pem.h> 00008 #include <openssl/ssl.h> 00009 #include <openssl/err.h> 00010 #include <openssl/rand.h> 00011 #include <openssl/x509v3.h> 00012 00013 class Cert 00014 { 00015 public: 00016 Cert(); 00017 ~Cert(); 00018 00019 bool load(char* file); 00020 00021 bool verify(Cert &signed_cert); 00022 00023 X509* getCert(void); 00024 00025 static bool generateRandomCerts(char* working_dir, 00026 char* openssl_conf, 00027 char* cert, 00028 char* priv, 00029 char* priv_passwd); 00030 private: 00031 static bool createFile(char* file_name, char* contents); 00032 00033 static void deleteFile(char* file_name); 00034 00035 private: 00036 X509* m_cert; 00037 }; 00038 00039 #endif // __CERT_H__