libcryptosec
Pkcs12Exception.h
Go to the documentation of this file.
1 #ifndef PKCS12EXCEPTION_H_
2 #define PKCS12EXCEPTION_H_
3 
5 
7 {
8 public:
10  virtual ~Pkcs12Exception() throw() {};
11 
12  enum ErrorCode
13  {
18  };
19 
20  Pkcs12Exception(std::string where)
21  {
22  this->where = where;
24  }
26  {
27  this->where = where;
28  this->errorCode = errorCode;
29  }
30 
31  virtual std::string getMessage() const
32  {
34  }
35 
36  virtual std::string toString() const
37  {
38  std::string ret;
40  {
41  ret = "Pkcs12Exception. Called by: " + this->where + ".";
42  }
43  else
44  {
45  ret = "Pkcs12Exception: " + Pkcs12Exception::errorCode2Message(this->errorCode) + ". Called by: " + this->where + ".";
46  }
47  if (this->details != "")
48  {
49  ret += " More details:\n" + this->details + ".";
50  }
51  return ret;
52  }
53 
55  {
56  return this->errorCode;
57  }
58 
60  {
61  std::string ret;
62  switch (errorCode)
63  {
65  ret = "Unknown error";
66  break;
68  ret = "Key and certificate do not match";
69  break;
71  ret = "MAC verification failure";
72  break;
74  ret = "Parse error";
75  break;
76  // case Pkcs12Exception:::
77  // ret = "";
78  // break;
79  // case Pkcs12Exception:::
80  // ret = "";
81  // break;
82  }
83  return ret;
84  }
85 
86 protected:
88 };
89 
90 #endif /*PKCS12EXCEPTION_H_*/
Definition: Pkcs12Exception.h:17
Pkcs12Exception::ErrorCode errorCode
Definition: Pkcs12Exception.h:87
virtual std::string getMessage() const
Definition: Pkcs12Exception.h:31
virtual Pkcs12Exception::ErrorCode getErrorCode()
Definition: Pkcs12Exception.h:54
Pkcs12Exception(Pkcs12Exception::ErrorCode errorCode, std::string where)
Definition: Pkcs12Exception.h:25
static std::string errorCode2Message(Pkcs12Exception::ErrorCode errorCode)
Definition: Pkcs12Exception.h:59
Definition: Pkcs12Exception.h:16
Definition: Pkcs12Exception.h:14
ErrorCode
Definition: Pkcs12Exception.h:12
Definition: Pkcs12Exception.h:6
Definition: LibCryptoSecException.h:8
std::string where
Definition: LibCryptoSecException.h:23
virtual std::string toString() const
Definition: Pkcs12Exception.h:36
std::string details
Definition: LibCryptoSecException.h:24
Pkcs12Exception(std::string where)
Definition: Pkcs12Exception.h:20
Definition: Pkcs12Exception.h:15
virtual ~Pkcs12Exception()
Definition: Pkcs12Exception.h:10