Botan
3.8.0
Crypto and TLS for C&
Toggle main menu visibility
Main Page
Related Pages
Topics
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Variables
Typedefs
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
Enumerations
a
c
d
e
f
g
h
k
l
m
n
o
p
r
s
t
u
v
w
Enumerator
c
d
f
i
m
n
r
s
t
Concepts
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
f
h
i
m
n
o
p
r
s
t
u
v
w
Enumerations
b
c
d
e
k
m
n
o
p
s
t
x
Enumerator
_
a
b
c
d
e
f
g
h
k
l
m
n
p
q
r
s
t
u
v
w
x
Related Symbols
b
c
d
e
f
k
o
p
s
t
x
Files
File List
File Members
All
_
a
b
c
d
e
f
k
m
n
p
t
w
Functions
b
c
Typedefs
b
c
e
p
t
Enumerations
Enumerator
b
c
d
e
k
n
Macros
_
a
b
c
f
m
n
t
w
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
if
(
auto
iso_dn =
is_sub_element_of
(oid, {2, 5, 4})) {
21
switch
(*iso_dn) {
22
case
3:
23
// X520.CommonName
24
return
64;
25
case
4:
26
// X520.Surname
27
return
40;
28
case
5:
29
// X520.SerialNumber
30
return
64;
31
case
6:
32
// X520.Country
33
return
3;
34
case
7:
35
// X520.Locality
36
return
128;
37
case
8:
38
// X520.State
39
return
128;
40
case
9:
41
// X520.StreetAddress
42
return
128;
43
case
10:
44
// X520.Organization
45
return
64;
46
case
11:
47
// X520.OrganizationalUnit
48
return
64;
49
case
12:
50
// X520.Title
51
return
64;
52
case
42:
53
// X520.GivenName
54
return
16;
55
case
43:
56
// X520.Initials
57
return
5;
58
case
44:
59
// X520.GenerationalQualifier
60
return
3;
61
case
46:
62
// X520.DNQualifier
63
return
64;
64
case
65:
65
// X520.Pseudonym
66
return
128;
67
default
:
68
return
0;
69
}
70
}
71
72
return
0;
73
}
16
size_t
X509_DN::lookup_ub
(
const
OID
& oid) {
…
}
74
75
}
// namespace Botan
Botan::OID
Definition
asn1_obj.h:216
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.13.2