userver: userver/crypto/basic_types.hpp Source File
Loading...
Searching...
No Matches
basic_types.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file userver/crypto/basic_types.hpp
4/// @brief Common types for crypto module
5
6#include <string>
7
8#include <userver/crypto/exception.hpp>
9
10/// @cond
11struct evp_pkey_st;
12struct x509_st;
13/// @endcond
14
15USERVER_NAMESPACE_BEGIN
16
17/// @brief Cryptographic primitives: hashing, signatures, certificates, and randomness.
18namespace crypto {
19
20/// @cond
21using EVP_PKEY = struct evp_pkey_st;
22using X509 = struct x509_st;
23/// @endcond
24
25/// SHA digest size in bits
26enum class DigestSize { k160, k256, k384, k512 };
27
28/// Digital signature type
29enum class DsaType { kRsa, kEc, kRsaPss };
30
31/// Base class for a crypto algorithm implementation
32class NamedAlgo {
33public:
34 explicit NamedAlgo(std::string name);
35 virtual ~NamedAlgo();
36
37 const std::string& Name() const;
38
39private:
40 const std::string name_;
41};
42
43} // namespace crypto
44
45USERVER_NAMESPACE_END