1#
2# This file is part of pyasn1-modules software.
3#
4# Created by Russ Housley.
5#
6# Copyright (c) 2019, Vigil Security, LLC
7# License: http://snmplabs.com/pyasn1/license.html
8#
9# Expression of Service Names in X.509 Certificates
10#
11# ASN.1 source from:
12# https://www.rfc-editor.org/rfc/rfc4985.txt
13#
14
15from pyasn1.type import char
16from pyasn1.type import constraint
17from pyasn1.type import univ
18
19from pyasn1_modules import rfc5280
20
21MAX = float('inf')
22
23
24# As specified in Appendix A.2 of RFC 4985
25
26id_pkix = rfc5280.id_pkix
27
28id_on = id_pkix + (8, )
29
30id_on_dnsSRV = id_on + (7, )
31
32
33class SRVName(char.IA5String):
34    subtypeSpec = constraint.ValueSizeConstraint(1, MAX)
35
36
37srvName = rfc5280.AnotherName()
38srvName['type-id'] = id_on_dnsSRV
39srvName['value'] = SRVName()
40
41
42# Map of Other Name OIDs to Other Name is added to the
43# ones that are in rfc5280.py
44
45_anotherNameMapUpdate = {
46    id_on_dnsSRV: SRVName(),
47}
48
49rfc5280.anotherNameMap.update(_anotherNameMapUpdate)
50