blob: daf1d6175d03b4585dc23952acd8add6f5c593a3 [file] [log] [blame]
Jeff Thompsonc0573432013-09-19 17:41:36 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
2/**
3 * Copyright (C) 2013 Regents of the University of California.
4 * @author: Yingdi Yu <yingdi@cs.ucla.edu>
5 * @author: Jeff Thompson <jefft0@remap.ucla.edu>
6 * See COPYING for copyright and distribution information.
7 */
8
9#ifndef NDN_SECURITY_EXCEPTION_HPP
Jeff Thompsone589c3f2013-10-12 17:30:50 -070010#define NDN_SECURITY_EXCEPTION_HPP
Jeff Thompsonc0573432013-09-19 17:41:36 -070011
12#include <exception>
13#include <string>
14
15namespace ndn {
16
17class SecurityException : public std::exception {
18public:
19 SecurityException(const std::string& errorMessage) throw();
20
21 virtual ~SecurityException() throw();
22
Jeff Thompson69dd03e2013-09-20 10:15:56 -070023 std::string Msg() { return errorMessage_; }
24
Jeff Thompsonf0a01c32013-09-23 15:58:06 -070025 virtual const char* what() const throw() { return errorMessage_.c_str(); }
Jeff Thompsonc0573432013-09-19 17:41:36 -070026
27private:
28 const std::string errorMessage_;
29};
30
31class UnrecognizedKeyFormatException : public SecurityException {
32public:
33 UnrecognizedKeyFormatException(const std::string& errorMessage)
34 : SecurityException(errorMessage)
35 {
36 }
37};
38
39class UnrecognizedDigestAlgorithmException : public SecurityException {
40public:
41 UnrecognizedDigestAlgorithmException(const std::string& errorMessage)
42 : SecurityException(errorMessage)
43 {
44 }
45};
46
47}
48
49#endif