Botan
3.11.0
Crypto and TLS for C&
src
lib
x509
x509_utils.h
Go to the documentation of this file.
1
/*
2
* (C) 2025 Jack Lloyd
3
*
4
* Botan is released under the Simplified BSD License (see license.txt)
5
*/
6
7
#ifndef BOTAN_X509_UTILS_H_
8
#define BOTAN_X509_UTILS_H_
9
10
#include <botan/asn1_obj.h>
11
#include <initializer_list>
12
#include <optional>
13
14
namespace
Botan
{
15
16
inline
std::optional<uint32_t>
is_sub_element_of
(
const
OID
& oid, std::initializer_list<uint32_t> prefix) {
17
const
auto
& c = oid.
get_components
();
18
19
if
(c.size() != prefix.size() + 1) {
20
return
{};
21
}
22
23
if
(!std::equal(c.begin(), c.end() - 1, prefix.begin(), prefix.end())) {
24
return
{};
25
}
26
27
return
c[c.size() - 1];
28
}
29
30
/*
31
* X.500 String Comparison
32
*/
33
bool
x500_name_cmp
(std::string_view name1, std::string_view name2);
34
35
}
// namespace Botan
36
37
#endif
Botan::OID
Definition
asn1_obj.h:215
Botan::OID::get_components
const std::vector< uint32_t > & get_components() const
Definition
asn1_obj.h:321
Botan
Definition
alg_id.cpp:13
Botan::x500_name_cmp
bool x500_name_cmp(std::string_view name1, std::string_view name2)
Definition
x509_dn.cpp:32
Botan::is_sub_element_of
std::optional< uint32_t > is_sub_element_of(const OID &oid, std::initializer_list< uint32_t > prefix)
Definition
x509_utils.h:16
Generated by
1.15.0