C++ Essence Library 0.1.0
A Utility Library for Modern C++ Programming
Loading...
Searching...
No Matches
common_types.hpp
1/*
2 * Copyright (c) 2024 The RefValue Project
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 * THE SOFTWARE.
21 */
22
23#pragma once
24
25#include "../abi/string.hpp"
26
27#include <concepts>
28#include <cstddef>
29#include <functional>
30
31namespace essence::crypto {
32 struct use_public_tag {};
33 struct use_private_tag {};
34
35 inline static constexpr use_public_tag use_public{};
36 inline static constexpr use_private_tag use_private{};
37
41 enum class cipher_padding_mode {
42 none,
43 pkcs7,
44 };
45
49 enum class digest_mode {
50 sha1,
51 sha224,
52 sha256,
53 sha384,
54 sha512,
55 sha512_224,
56 sha512_256,
57 sha3_224,
58 sha3_256,
59 sha3_384,
60 sha3_512,
61 shake128,
62 shake256,
63 md5,
64 sm3,
65 };
66
69 enum class rsa_padding_mode {
70 pkcs1 = 1,
71 none = 3,
72 pkcs1_oaep,
73 x931,
74 pkcs1_pss,
75 pkcs1_with_tls,
76 };
77
78 enum class rsa_pss_saltlen {
79 automatic = -2,
80 digest,
81 max = -3,
82 };
83
84 enum class dh_cofactor_mode {
85 none = -1,
86 disabled,
87 enabled,
88 };
89
90 enum class dh_kdf_type {
91 none = 1,
92 x9_63,
93 };
94
95 enum dh_nid {
96 none,
97 ffdhe2048 = 1126,
98 ffdhe3072,
99 ffdhe4096,
100 ffdhe6144,
101 ffdhe8192,
102 modp_1536 = 1212,
103 modp_2048,
104 modp_3072,
105 modp_4096,
106 modp_6144,
107 modp_8192,
108 };
109
110 enum class dhx_rfc5114 {
111 none,
112 section_2_1,
113 section_2_2,
114 section_2_3,
115 };
116
120 enum class asymmetric_key_type {
121 pub,
122 pair,
123 };
124
125 template <typename T>
126 concept pubkey_keygen_param = requires(const T obj) {
127 { obj.generate_key_blob() } -> std::convertible_to<void*>;
128 };
129
130 using password_request_handler = std::function<abi::string(std::size_t max_size, bool& cancelled)>;
131} // namespace essence::crypto
Definition common_types.hpp:126
Definition common_types.hpp:33
Definition common_types.hpp:32