blob: 28d87f5ee4479708a3113c541dd743ad71022e85 [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
10#define NDN_SECURITY_EXCEPTION_HPP
11
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
25 std::string what() { return errorMessage_; }
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