Botan
3.9.0
Crypto and TLS for C&
src
lib
x509
x509_dn_ub.cpp
Go to the documentation of this file.
1
/*
2
* (C) 2017 Fabian Weissberg, Rohde & Schwarz Cybersecurity
3
* 2025 Jack Lloyd
4
*
5
* Botan is released under the Simplified BSD License (see license.txt)
6
*/
7
8
#include <botan/pkix_types.h>
9
10
#include <botan/asn1_obj.h>
11
#include <botan/internal/x509_utils.h>
12
13
namespace
Botan
{
14
15
//static
16
size_t
X509_DN::lookup_ub
(
const
OID
& oid) {
17
/*
18
* See RFC 5280 Appendix A.1 starting with comment "-- Upper Bounds"
19
*/
20
21
// NOLINTBEGIN(*-branch-clone)
22
if
(
auto
iso_dn =
is_sub_element_of
(oid, {2, 5, 4})) {
23
switch
(*iso_dn) {
24
case
3:
25
// X520.CommonName
26
return
64;
27
case
4:
28
// X520.Surname
29
return
40;
30
case
5:
31
// X520.SerialNumber
32
return
64;
33
case
6:
34
// X520.Country
35
return
3;
36
case
7:
37
// X520.Locality
38
return
128;
39
case
8:
40
// X520.State
41
return
128;
42
case
9:
43
// X520.StreetAddress
44
return
128;
45
case
10:
46
// X520.Organization
47
return
64;
48
case
11:
49
// X520.OrganizationalUnit
50
return
64;
51
case
12:
52
// X520.Title
53
return
64;
54
case
42:
55
// X520.GivenName
56
return
16;
57
case
43:
58
// X520.Initials
59
return
5;
60
case
44:
61
// X520.GenerationalQualifier
62
return
3;
63
case
46:
64
// X520.DNQualifier
65
return
64;
66
case
65:
67
// X520.Pseudonym
68
return
128;
69
default
:
70
return
0;
71
}
72
}
73
74
// NOLINTEND(*-branch-clone)
75
76
return
0;
77
}
78
79
}
// namespace Botan
Botan::OID
Definition
asn1_obj.h:215
Botan::X509_DN::lookup_ub
static size_t lookup_ub(const OID &oid)
Definition
x509_dn_ub.cpp:16
Botan
Definition
alg_id.cpp:13
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.14.0