Virgil Security Crypto library  2.4.6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
VirgilCryptoError.h
1 
37 #ifndef VIRGIL_CRYPTO_ERROR_H
38 #define VIRGIL_CRYPTO_ERROR_H
39 
40 #include <limits>
41 #include <system_error>
42 
43 #include "VirgilCryptoException.h"
44 
45 namespace virgil { namespace crypto {
46 
51 enum class VirgilCryptoError {
52  Reserved = 0,
61  InvalidState,
62  InvalidAuth,
67  NotSecure,
69  Undefined = std::numeric_limits<int>::max()
70 };
71 
76 class VirgilCryptoErrorCategory : public std::error_category {
77 public:
81  const char* name() const noexcept override;
82 
89  std::string message(int ev) const noexcept override;
90 };
91 
98 
107  return VirgilCryptoException(static_cast<int>(ev), crypto_category());
108 }
109 
118 inline VirgilCryptoException make_error(VirgilCryptoError ev, const std::string& what) {
119  return VirgilCryptoException(static_cast<int>(ev), crypto_category(), what);
120 }
121 
130 inline VirgilCryptoException make_error(VirgilCryptoError ev, const char* what) {
131  return VirgilCryptoException(static_cast<int>(ev), crypto_category(), what);
132 }
133 }}
134 
135 
136 #endif //VIRGIL_CRYPTO_ERROR_H
Invalid format of the Public Key.
VirgilCryptoError
Specific error codes for the crypto library.
Definition: VirgilCryptoError.h:51
Security prerequisite is broken.
Structure maximum size was exceeded.
Algorithm is not supported in the current build.
Recipient with given identifier is not found.
Function call prerequisite is broken.
const VirgilCryptoErrorCategory & crypto_category() noexcept
Return singleton instance of the crypto error category.
This is specific error category that contains information about crypto library errors.
Definition: VirgilCryptoError.h:76
Argument given to a function is invalid.
VirgilCryptoException make_error(VirgilCryptoError ev)
Build exception with given error value and corresond error category.
Definition: VirgilCryptoError.h:106
Object is not initialized with specific algorithm, so can't be used.
This only exception that crypto library can produce.
Definition: VirgilCryptoException.h:54
const char * name() const noexceptoverride
std::string message(int ev) const noexceptoverride
Invalid format of the Private Key.
Recipient with given password is not found.
Given parameter is null or empty.