00001 #ifndef _CRYPTO_UTIL_H
00002 #define _CRYPTO_UTIL_H
00003
00004 #include <string>
00005 #include <openssl/evp.h>
00006
00007 #include "ScopedLock.h"
00008
00009 class CryptoUtil {
00010 public:
00011 static void sign(const std::string& buf, std::string& signature);
00012 static bool verify(const std::string& buf, const std::string& signature,
00013 EVP_PKEY* pubkey);
00014
00015 private:
00016 static void loadPrivateKey();
00017
00018 static pthread_mutex_t slock;
00019 static EVP_PKEY* privateKey;
00020 };
00021
00022 #endif // _CRYPTO_UTIL_H