123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208 |
- #ifndef _ISC_CRYPTO_H
- #define _ISC_CRYPTO_H
- #include <string>
- #include <util/buffer.h>
- #include <exceptions/exceptions.h>
- #include <boost/noncopyable.hpp>
- #include <boost/scoped_ptr.hpp>
- #include <memory>
- namespace isc {
- namespace cryptolink {
- enum HashAlgorithm {
- UNKNOWN_HASH = 0,
-
-
-
-
-
- MD5 = 1,
- SHA1 = 2,
- SHA256 = 3,
- SHA224 = 4,
- SHA384 = 5,
- SHA512 = 6
- };
- class HMAC;
- class CryptoLinkError : public Exception {
- public:
- CryptoLinkError(const char* file, size_t line, const char* what) :
- isc::Exception(file, line, what) {}
- };
- class InitializationError : public CryptoLinkError {
- public:
- InitializationError(const char* file, size_t line, const char* what) :
- CryptoLinkError(file, line, what) {}
- };
- class UnsupportedAlgorithm : public CryptoLinkError {
- public:
- UnsupportedAlgorithm(const char* file, size_t line, const char* what) :
- CryptoLinkError(file, line, what) {}
- };
- class BadKey : public CryptoLinkError {
- public:
- BadKey(const char* file, size_t line, const char* what) :
- CryptoLinkError(file, line, what) {}
- };
- class LibraryError : public CryptoLinkError {
- public:
- LibraryError(const char* file, size_t line, const char* what) :
- CryptoLinkError(file, line, what) {}
- };
- class CryptoLinkImpl;
- class CryptoLink : private boost::noncopyable {
- public:
-
-
-
-
-
-
-
-
-
-
-
- static CryptoLink& getCryptoLink();
-
-
-
-
-
-
-
-
-
-
-
- static void initialize();
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- HMAC* createHMAC(const void* secret, size_t secret_len,
- const HashAlgorithm hash_algorithm);
- private:
-
-
- static CryptoLink& getCryptoLinkInternal();
-
-
- CryptoLink() : impl_(NULL) {}
- ~CryptoLink();
- CryptoLinkImpl* impl_;
- };
- }
- }
- #endif
|