1#
2# This file is part of pyasn1-modules software.
3#
4# Created by Russ Housley with some assistance from asn1ate v.0.6.0.
5#
6# Copyright (c) 2019, Vigil Security, LLC
7# License: http://snmplabs.com/pyasn1/license.html
8#
9# Internationalized Email Addresses in X.509 Certificates
10#
11# ASN.1 source from:
12# https://www.rfc-editor.org/rfc/rfc8398.txt
13# https://www.rfc-editor.org/errata/eid5418
14#
15
16from pyasn1.type import char
17from pyasn1.type import constraint
18from pyasn1.type import univ
19
20from pyasn1_modules import rfc5280
21
22MAX = float('inf')
23
24
25# SmtpUTF8Mailbox contains Mailbox as specified in Section 3.3 of RFC 6531
26
27id_pkix = rfc5280.id_pkix
28
29id_on = id_pkix + (8, )
30
31id_on_SmtpUTF8Mailbox = id_on + (9, )
32
33
34class SmtpUTF8Mailbox(char.UTF8String):
35    pass
36
37SmtpUTF8Mailbox.subtypeSpec = constraint.ValueSizeConstraint(1, MAX)
38
39
40on_SmtpUTF8Mailbox = rfc5280.AnotherName()
41on_SmtpUTF8Mailbox['type-id'] = id_on_SmtpUTF8Mailbox
42on_SmtpUTF8Mailbox['value'] = SmtpUTF8Mailbox()
43
44
45# Map of Other Name OIDs to Other Name is added to the
46# ones that are in rfc5280.py
47
48_anotherNameMapUpdate = {
49    id_on_SmtpUTF8Mailbox: SmtpUTF8Mailbox(),
50}
51
52rfc5280.anotherNameMap.update(_anotherNameMapUpdate)
53