ZTWHHH commited on
Commit
4891c3e
·
verified ·
1 Parent(s): a80ab82

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. evalkit_cambrian/lib/python3.10/site-packages/aiohappyeyeballs/__init__.py +13 -0
  2. evalkit_cambrian/lib/python3.10/site-packages/aiohappyeyeballs/__pycache__/__init__.cpython-310.pyc +0 -0
  3. evalkit_cambrian/lib/python3.10/site-packages/aiohappyeyeballs/__pycache__/_staggered.cpython-310.pyc +0 -0
  4. evalkit_cambrian/lib/python3.10/site-packages/aiohappyeyeballs/__pycache__/impl.cpython-310.pyc +0 -0
  5. evalkit_cambrian/lib/python3.10/site-packages/aiohappyeyeballs/__pycache__/types.cpython-310.pyc +0 -0
  6. evalkit_cambrian/lib/python3.10/site-packages/aiohappyeyeballs/__pycache__/utils.cpython-310.pyc +0 -0
  7. evalkit_cambrian/lib/python3.10/site-packages/aiohappyeyeballs/_staggered.py +202 -0
  8. evalkit_cambrian/lib/python3.10/site-packages/aiohappyeyeballs/impl.py +221 -0
  9. evalkit_cambrian/lib/python3.10/site-packages/aiohappyeyeballs/py.typed +0 -0
  10. evalkit_cambrian/lib/python3.10/site-packages/aiohappyeyeballs/types.py +12 -0
  11. evalkit_cambrian/lib/python3.10/site-packages/aiohappyeyeballs/utils.py +97 -0
  12. evalkit_cambrian/lib/python3.10/site-packages/aiohttp/__pycache__/__init__.cpython-310.pyc +0 -0
  13. evalkit_cambrian/lib/python3.10/site-packages/aiohttp/__pycache__/base_protocol.cpython-310.pyc +0 -0
  14. evalkit_cambrian/lib/python3.10/site-packages/aiohttp/__pycache__/http_parser.cpython-310.pyc +0 -0
  15. evalkit_cambrian/lib/python3.10/site-packages/aiohttp/__pycache__/http_websocket.cpython-310.pyc +0 -0
  16. evalkit_cambrian/lib/python3.10/site-packages/aiohttp/__pycache__/multipart.cpython-310.pyc +0 -0
  17. evalkit_cambrian/lib/python3.10/site-packages/aiohttp/__pycache__/tcp_helpers.cpython-310.pyc +0 -0
  18. evalkit_cambrian/lib/python3.10/site-packages/aiohttp/__pycache__/tracing.cpython-310.pyc +0 -0
  19. evalkit_cambrian/lib/python3.10/site-packages/aiohttp/__pycache__/web_runner.cpython-310.pyc +0 -0
  20. evalkit_cambrian/lib/python3.10/site-packages/aiohttp/__pycache__/worker.cpython-310.pyc +0 -0
  21. evalkit_cambrian/lib/python3.10/site-packages/aiohttp/_websocket/__init__.py +1 -0
  22. evalkit_cambrian/lib/python3.10/site-packages/aiohttp/_websocket/__pycache__/__init__.cpython-310.pyc +0 -0
  23. evalkit_cambrian/lib/python3.10/site-packages/aiohttp/_websocket/__pycache__/helpers.cpython-310.pyc +0 -0
  24. evalkit_cambrian/lib/python3.10/site-packages/aiohttp/_websocket/__pycache__/reader_c.cpython-310.pyc +0 -0
  25. evalkit_cambrian/lib/python3.10/site-packages/aiohttp/_websocket/__pycache__/writer.cpython-310.pyc +0 -0
  26. evalkit_cambrian/lib/python3.10/site-packages/aiohttp/_websocket/reader_c.py +468 -0
  27. evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/__init__.py +2 -0
  28. evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc1157.py +126 -0
  29. evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc2437.py +69 -0
  30. evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc2511.py +258 -0
  31. evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc2986.py +75 -0
  32. evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc3414.py +28 -0
  33. evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc3657.py +66 -0
  34. evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc3779.py +137 -0
  35. evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc4387.py +23 -0
  36. evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc4490.py +113 -0
  37. evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc5035.py +199 -0
  38. evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc5083.py +52 -0
  39. evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc5280.py +1658 -0
  40. evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc5480.py +190 -0
  41. evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc5914.py +119 -0
  42. evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc5916.py +35 -0
  43. evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc5934.py +786 -0
  44. evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc6010.py +88 -0
  45. evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc6402.py +628 -0
  46. evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc7030.py +66 -0
  47. evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc7773.py +52 -0
  48. evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc8419.py +68 -0
  49. evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc8520.py +63 -0
  50. evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc8696.py +104 -0
evalkit_cambrian/lib/python3.10/site-packages/aiohappyeyeballs/__init__.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ __version__ = "2.4.4"
2
+
3
+ from .impl import start_connection
4
+ from .types import AddrInfoType
5
+ from .utils import addr_to_addr_infos, pop_addr_infos_interleave, remove_addr_infos
6
+
7
+ __all__ = (
8
+ "AddrInfoType",
9
+ "addr_to_addr_infos",
10
+ "pop_addr_infos_interleave",
11
+ "remove_addr_infos",
12
+ "start_connection",
13
+ )
evalkit_cambrian/lib/python3.10/site-packages/aiohappyeyeballs/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (445 Bytes). View file
 
evalkit_cambrian/lib/python3.10/site-packages/aiohappyeyeballs/__pycache__/_staggered.cpython-310.pyc ADDED
Binary file (5.48 kB). View file
 
evalkit_cambrian/lib/python3.10/site-packages/aiohappyeyeballs/__pycache__/impl.cpython-310.pyc ADDED
Binary file (5.55 kB). View file
 
evalkit_cambrian/lib/python3.10/site-packages/aiohappyeyeballs/__pycache__/types.cpython-310.pyc ADDED
Binary file (394 Bytes). View file
 
evalkit_cambrian/lib/python3.10/site-packages/aiohappyeyeballs/__pycache__/utils.cpython-310.pyc ADDED
Binary file (2.54 kB). View file
 
evalkit_cambrian/lib/python3.10/site-packages/aiohappyeyeballs/_staggered.py ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import asyncio
2
+ import contextlib
3
+ from typing import (
4
+ TYPE_CHECKING,
5
+ Any,
6
+ Awaitable,
7
+ Callable,
8
+ Iterable,
9
+ List,
10
+ Optional,
11
+ Set,
12
+ Tuple,
13
+ TypeVar,
14
+ Union,
15
+ )
16
+
17
+ _T = TypeVar("_T")
18
+
19
+
20
+ def _set_result(wait_next: "asyncio.Future[None]") -> None:
21
+ """Set the result of a future if it is not already done."""
22
+ if not wait_next.done():
23
+ wait_next.set_result(None)
24
+
25
+
26
+ async def _wait_one(
27
+ futures: "Iterable[asyncio.Future[Any]]",
28
+ loop: asyncio.AbstractEventLoop,
29
+ ) -> _T:
30
+ """Wait for the first future to complete."""
31
+ wait_next = loop.create_future()
32
+
33
+ def _on_completion(fut: "asyncio.Future[Any]") -> None:
34
+ if not wait_next.done():
35
+ wait_next.set_result(fut)
36
+
37
+ for f in futures:
38
+ f.add_done_callback(_on_completion)
39
+
40
+ try:
41
+ return await wait_next
42
+ finally:
43
+ for f in futures:
44
+ f.remove_done_callback(_on_completion)
45
+
46
+
47
+ async def staggered_race(
48
+ coro_fns: Iterable[Callable[[], Awaitable[_T]]],
49
+ delay: Optional[float],
50
+ *,
51
+ loop: Optional[asyncio.AbstractEventLoop] = None,
52
+ ) -> Tuple[Optional[_T], Optional[int], List[Optional[BaseException]]]:
53
+ """
54
+ Run coroutines with staggered start times and take the first to finish.
55
+
56
+ This method takes an iterable of coroutine functions. The first one is
57
+ started immediately. From then on, whenever the immediately preceding one
58
+ fails (raises an exception), or when *delay* seconds has passed, the next
59
+ coroutine is started. This continues until one of the coroutines complete
60
+ successfully, in which case all others are cancelled, or until all
61
+ coroutines fail.
62
+
63
+ The coroutines provided should be well-behaved in the following way:
64
+
65
+ * They should only ``return`` if completed successfully.
66
+
67
+ * They should always raise an exception if they did not complete
68
+ successfully. In particular, if they handle cancellation, they should
69
+ probably reraise, like this::
70
+
71
+ try:
72
+ # do work
73
+ except asyncio.CancelledError:
74
+ # undo partially completed work
75
+ raise
76
+
77
+ Args:
78
+ ----
79
+ coro_fns: an iterable of coroutine functions, i.e. callables that
80
+ return a coroutine object when called. Use ``functools.partial`` or
81
+ lambdas to pass arguments.
82
+
83
+ delay: amount of time, in seconds, between starting coroutines. If
84
+ ``None``, the coroutines will run sequentially.
85
+
86
+ loop: the event loop to use. If ``None``, the running loop is used.
87
+
88
+ Returns:
89
+ -------
90
+ tuple *(winner_result, winner_index, exceptions)* where
91
+
92
+ - *winner_result*: the result of the winning coroutine, or ``None``
93
+ if no coroutines won.
94
+
95
+ - *winner_index*: the index of the winning coroutine in
96
+ ``coro_fns``, or ``None`` if no coroutines won. If the winning
97
+ coroutine may return None on success, *winner_index* can be used
98
+ to definitively determine whether any coroutine won.
99
+
100
+ - *exceptions*: list of exceptions returned by the coroutines.
101
+ ``len(exceptions)`` is equal to the number of coroutines actually
102
+ started, and the order is the same as in ``coro_fns``. The winning
103
+ coroutine's entry is ``None``.
104
+
105
+ """
106
+ loop = loop or asyncio.get_running_loop()
107
+ exceptions: List[Optional[BaseException]] = []
108
+ tasks: Set[asyncio.Task[Optional[Tuple[_T, int]]]] = set()
109
+
110
+ async def run_one_coro(
111
+ coro_fn: Callable[[], Awaitable[_T]],
112
+ this_index: int,
113
+ start_next: "asyncio.Future[None]",
114
+ ) -> Optional[Tuple[_T, int]]:
115
+ """
116
+ Run a single coroutine.
117
+
118
+ If the coroutine fails, set the exception in the exceptions list and
119
+ start the next coroutine by setting the result of the start_next.
120
+
121
+ If the coroutine succeeds, return the result and the index of the
122
+ coroutine in the coro_fns list.
123
+
124
+ If SystemExit or KeyboardInterrupt is raised, re-raise it.
125
+ """
126
+ try:
127
+ result = await coro_fn()
128
+ except (SystemExit, KeyboardInterrupt):
129
+ raise
130
+ except BaseException as e:
131
+ exceptions[this_index] = e
132
+ _set_result(start_next) # Kickstart the next coroutine
133
+ return None
134
+
135
+ return result, this_index
136
+
137
+ start_next_timer: Optional[asyncio.TimerHandle] = None
138
+ start_next: Optional[asyncio.Future[None]]
139
+ task: asyncio.Task[Optional[Tuple[_T, int]]]
140
+ done: Union[asyncio.Future[None], asyncio.Task[Optional[Tuple[_T, int]]]]
141
+ coro_iter = iter(coro_fns)
142
+ this_index = -1
143
+ try:
144
+ while True:
145
+ if coro_fn := next(coro_iter, None):
146
+ this_index += 1
147
+ exceptions.append(None)
148
+ start_next = loop.create_future()
149
+ task = loop.create_task(run_one_coro(coro_fn, this_index, start_next))
150
+ tasks.add(task)
151
+ start_next_timer = (
152
+ loop.call_later(delay, _set_result, start_next) if delay else None
153
+ )
154
+ elif not tasks:
155
+ # We exhausted the coro_fns list and no tasks are running
156
+ # so we have no winner and all coroutines failed.
157
+ break
158
+
159
+ while tasks:
160
+ done = await _wait_one(
161
+ [*tasks, start_next] if start_next else tasks, loop
162
+ )
163
+ if done is start_next:
164
+ # The current task has failed or the timer has expired
165
+ # so we need to start the next task.
166
+ start_next = None
167
+ if start_next_timer:
168
+ start_next_timer.cancel()
169
+ start_next_timer = None
170
+
171
+ # Break out of the task waiting loop to start the next
172
+ # task.
173
+ break
174
+
175
+ if TYPE_CHECKING:
176
+ assert isinstance(done, asyncio.Task)
177
+
178
+ tasks.remove(done)
179
+ if winner := done.result():
180
+ return *winner, exceptions
181
+ finally:
182
+ # We either have:
183
+ # - a winner
184
+ # - all tasks failed
185
+ # - a KeyboardInterrupt or SystemExit.
186
+
187
+ #
188
+ # If the timer is still running, cancel it.
189
+ #
190
+ if start_next_timer:
191
+ start_next_timer.cancel()
192
+
193
+ #
194
+ # If there are any tasks left, cancel them and than
195
+ # wait them so they fill the exceptions list.
196
+ #
197
+ for task in tasks:
198
+ task.cancel()
199
+ with contextlib.suppress(asyncio.CancelledError):
200
+ await task
201
+
202
+ return None, None, exceptions
evalkit_cambrian/lib/python3.10/site-packages/aiohappyeyeballs/impl.py ADDED
@@ -0,0 +1,221 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Base implementation."""
2
+
3
+ import asyncio
4
+ import collections
5
+ import functools
6
+ import itertools
7
+ import socket
8
+ import sys
9
+ from typing import List, Optional, Sequence, Union
10
+
11
+ from . import _staggered
12
+ from .types import AddrInfoType
13
+
14
+ if sys.version_info < (3, 8, 2): # noqa: UP036
15
+ # asyncio.staggered is broken in Python 3.8.0 and 3.8.1
16
+ # so it must be patched:
17
+ # https://github.com/aio-libs/aiohttp/issues/8556
18
+ # https://bugs.python.org/issue39129
19
+ # https://github.com/python/cpython/pull/17693
20
+ import asyncio.futures
21
+
22
+ asyncio.futures.TimeoutError = asyncio.TimeoutError # type: ignore[attr-defined]
23
+
24
+
25
+ async def start_connection(
26
+ addr_infos: Sequence[AddrInfoType],
27
+ *,
28
+ local_addr_infos: Optional[Sequence[AddrInfoType]] = None,
29
+ happy_eyeballs_delay: Optional[float] = None,
30
+ interleave: Optional[int] = None,
31
+ loop: Optional[asyncio.AbstractEventLoop] = None,
32
+ ) -> socket.socket:
33
+ """
34
+ Connect to a TCP server.
35
+
36
+ Create a socket connection to a specified destination. The
37
+ destination is specified as a list of AddrInfoType tuples as
38
+ returned from getaddrinfo().
39
+
40
+ The arguments are, in order:
41
+
42
+ * ``family``: the address family, e.g. ``socket.AF_INET`` or
43
+ ``socket.AF_INET6``.
44
+ * ``type``: the socket type, e.g. ``socket.SOCK_STREAM`` or
45
+ ``socket.SOCK_DGRAM``.
46
+ * ``proto``: the protocol, e.g. ``socket.IPPROTO_TCP`` or
47
+ ``socket.IPPROTO_UDP``.
48
+ * ``canonname``: the canonical name of the address, e.g.
49
+ ``"www.python.org"``.
50
+ * ``sockaddr``: the socket address
51
+
52
+ This method is a coroutine which will try to establish the connection
53
+ in the background. When successful, the coroutine returns a
54
+ socket.
55
+
56
+ The expected use case is to use this method in conjunction with
57
+ loop.create_connection() to establish a connection to a server::
58
+
59
+ socket = await start_connection(addr_infos)
60
+ transport, protocol = await loop.create_connection(
61
+ MyProtocol, sock=socket, ...)
62
+ """
63
+ if not (current_loop := loop):
64
+ current_loop = asyncio.get_running_loop()
65
+
66
+ single_addr_info = len(addr_infos) == 1
67
+
68
+ if happy_eyeballs_delay is not None and interleave is None:
69
+ # If using happy eyeballs, default to interleave addresses by family
70
+ interleave = 1
71
+
72
+ if interleave and not single_addr_info:
73
+ addr_infos = _interleave_addrinfos(addr_infos, interleave)
74
+
75
+ sock: Optional[socket.socket] = None
76
+ # uvloop can raise RuntimeError instead of OSError
77
+ exceptions: List[List[Union[OSError, RuntimeError]]] = []
78
+ if happy_eyeballs_delay is None or single_addr_info:
79
+ # not using happy eyeballs
80
+ for addrinfo in addr_infos:
81
+ try:
82
+ sock = await _connect_sock(
83
+ current_loop, exceptions, addrinfo, local_addr_infos
84
+ )
85
+ break
86
+ except (RuntimeError, OSError):
87
+ continue
88
+ else: # using happy eyeballs
89
+ sock, _, _ = await _staggered.staggered_race(
90
+ (
91
+ functools.partial(
92
+ _connect_sock, current_loop, exceptions, addrinfo, local_addr_infos
93
+ )
94
+ for addrinfo in addr_infos
95
+ ),
96
+ happy_eyeballs_delay,
97
+ )
98
+
99
+ if sock is None:
100
+ all_exceptions = [exc for sub in exceptions for exc in sub]
101
+ try:
102
+ first_exception = all_exceptions[0]
103
+ if len(all_exceptions) == 1:
104
+ raise first_exception
105
+ else:
106
+ # If they all have the same str(), raise one.
107
+ model = str(first_exception)
108
+ if all(str(exc) == model for exc in all_exceptions):
109
+ raise first_exception
110
+ # Raise a combined exception so the user can see all
111
+ # the various error messages.
112
+ msg = "Multiple exceptions: {}".format(
113
+ ", ".join(str(exc) for exc in all_exceptions)
114
+ )
115
+ # If the errno is the same for all exceptions, raise
116
+ # an OSError with that errno.
117
+ if isinstance(first_exception, OSError):
118
+ first_errno = first_exception.errno
119
+ if all(
120
+ isinstance(exc, OSError) and exc.errno == first_errno
121
+ for exc in all_exceptions
122
+ ):
123
+ raise OSError(first_errno, msg)
124
+ elif isinstance(first_exception, RuntimeError) and all(
125
+ isinstance(exc, RuntimeError) for exc in all_exceptions
126
+ ):
127
+ raise RuntimeError(msg)
128
+ # We have a mix of OSError and RuntimeError
129
+ # so we have to pick which one to raise.
130
+ # and we raise OSError for compatibility
131
+ raise OSError(msg)
132
+ finally:
133
+ all_exceptions = None # type: ignore[assignment]
134
+ exceptions = None # type: ignore[assignment]
135
+
136
+ return sock
137
+
138
+
139
+ async def _connect_sock(
140
+ loop: asyncio.AbstractEventLoop,
141
+ exceptions: List[List[Union[OSError, RuntimeError]]],
142
+ addr_info: AddrInfoType,
143
+ local_addr_infos: Optional[Sequence[AddrInfoType]] = None,
144
+ ) -> socket.socket:
145
+ """Create, bind and connect one socket."""
146
+ my_exceptions: List[Union[OSError, RuntimeError]] = []
147
+ exceptions.append(my_exceptions)
148
+ family, type_, proto, _, address = addr_info
149
+ sock = None
150
+ try:
151
+ sock = socket.socket(family=family, type=type_, proto=proto)
152
+ sock.setblocking(False)
153
+ if local_addr_infos is not None:
154
+ for lfamily, _, _, _, laddr in local_addr_infos:
155
+ # skip local addresses of different family
156
+ if lfamily != family:
157
+ continue
158
+ try:
159
+ sock.bind(laddr)
160
+ break
161
+ except OSError as exc:
162
+ msg = (
163
+ f"error while attempting to bind on "
164
+ f"address {laddr!r}: "
165
+ f"{exc.strerror.lower()}"
166
+ )
167
+ exc = OSError(exc.errno, msg)
168
+ my_exceptions.append(exc)
169
+ else: # all bind attempts failed
170
+ if my_exceptions:
171
+ raise my_exceptions.pop()
172
+ else:
173
+ raise OSError(f"no matching local address with {family=} found")
174
+ await loop.sock_connect(sock, address)
175
+ return sock
176
+ except (RuntimeError, OSError) as exc:
177
+ my_exceptions.append(exc)
178
+ if sock is not None:
179
+ try:
180
+ sock.close()
181
+ except OSError as e:
182
+ my_exceptions.append(e)
183
+ raise
184
+ raise
185
+ except:
186
+ if sock is not None:
187
+ try:
188
+ sock.close()
189
+ except OSError as e:
190
+ my_exceptions.append(e)
191
+ raise
192
+ raise
193
+ finally:
194
+ exceptions = my_exceptions = None # type: ignore[assignment]
195
+
196
+
197
+ def _interleave_addrinfos(
198
+ addrinfos: Sequence[AddrInfoType], first_address_family_count: int = 1
199
+ ) -> List[AddrInfoType]:
200
+ """Interleave list of addrinfo tuples by family."""
201
+ # Group addresses by family
202
+ addrinfos_by_family: collections.OrderedDict[int, List[AddrInfoType]] = (
203
+ collections.OrderedDict()
204
+ )
205
+ for addr in addrinfos:
206
+ family = addr[0]
207
+ if family not in addrinfos_by_family:
208
+ addrinfos_by_family[family] = []
209
+ addrinfos_by_family[family].append(addr)
210
+ addrinfos_lists = list(addrinfos_by_family.values())
211
+
212
+ reordered: List[AddrInfoType] = []
213
+ if first_address_family_count > 1:
214
+ reordered.extend(addrinfos_lists[0][: first_address_family_count - 1])
215
+ del addrinfos_lists[0][: first_address_family_count - 1]
216
+ reordered.extend(
217
+ a
218
+ for a in itertools.chain.from_iterable(itertools.zip_longest(*addrinfos_lists))
219
+ if a is not None
220
+ )
221
+ return reordered
evalkit_cambrian/lib/python3.10/site-packages/aiohappyeyeballs/py.typed ADDED
File without changes
evalkit_cambrian/lib/python3.10/site-packages/aiohappyeyeballs/types.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Types for aiohappyeyeballs."""
2
+
3
+ import socket
4
+ from typing import Tuple, Union
5
+
6
+ AddrInfoType = Tuple[
7
+ Union[int, socket.AddressFamily],
8
+ Union[int, socket.SocketKind],
9
+ int,
10
+ str,
11
+ Tuple, # type: ignore[type-arg]
12
+ ]
evalkit_cambrian/lib/python3.10/site-packages/aiohappyeyeballs/utils.py ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Utility functions for aiohappyeyeballs."""
2
+
3
+ import ipaddress
4
+ import socket
5
+ from typing import Dict, List, Optional, Tuple, Union
6
+
7
+ from .types import AddrInfoType
8
+
9
+
10
+ def addr_to_addr_infos(
11
+ addr: Optional[
12
+ Union[Tuple[str, int, int, int], Tuple[str, int, int], Tuple[str, int]]
13
+ ],
14
+ ) -> Optional[List[AddrInfoType]]:
15
+ """Convert an address tuple to a list of addr_info tuples."""
16
+ if addr is None:
17
+ return None
18
+ host = addr[0]
19
+ port = addr[1]
20
+ is_ipv6 = ":" in host
21
+ if is_ipv6:
22
+ flowinfo = 0
23
+ scopeid = 0
24
+ addr_len = len(addr)
25
+ if addr_len >= 4:
26
+ scopeid = addr[3] # type: ignore[misc]
27
+ if addr_len >= 3:
28
+ flowinfo = addr[2] # type: ignore[misc]
29
+ addr = (host, port, flowinfo, scopeid)
30
+ family = socket.AF_INET6
31
+ else:
32
+ addr = (host, port)
33
+ family = socket.AF_INET
34
+ return [(family, socket.SOCK_STREAM, socket.IPPROTO_TCP, "", addr)]
35
+
36
+
37
+ def pop_addr_infos_interleave(
38
+ addr_infos: List[AddrInfoType], interleave: Optional[int] = None
39
+ ) -> None:
40
+ """
41
+ Pop addr_info from the list of addr_infos by family up to interleave times.
42
+
43
+ The interleave parameter is used to know how many addr_infos for
44
+ each family should be popped of the top of the list.
45
+ """
46
+ seen: Dict[int, int] = {}
47
+ if interleave is None:
48
+ interleave = 1
49
+ to_remove: List[AddrInfoType] = []
50
+ for addr_info in addr_infos:
51
+ family = addr_info[0]
52
+ if family not in seen:
53
+ seen[family] = 0
54
+ if seen[family] < interleave:
55
+ to_remove.append(addr_info)
56
+ seen[family] += 1
57
+ for addr_info in to_remove:
58
+ addr_infos.remove(addr_info)
59
+
60
+
61
+ def _addr_tuple_to_ip_address(
62
+ addr: Union[Tuple[str, int], Tuple[str, int, int, int]],
63
+ ) -> Union[
64
+ Tuple[ipaddress.IPv4Address, int], Tuple[ipaddress.IPv6Address, int, int, int]
65
+ ]:
66
+ """Convert an address tuple to an IPv4Address."""
67
+ return (ipaddress.ip_address(addr[0]), *addr[1:])
68
+
69
+
70
+ def remove_addr_infos(
71
+ addr_infos: List[AddrInfoType],
72
+ addr: Union[Tuple[str, int], Tuple[str, int, int, int]],
73
+ ) -> None:
74
+ """
75
+ Remove an address from the list of addr_infos.
76
+
77
+ The addr value is typically the return value of
78
+ sock.getpeername().
79
+ """
80
+ bad_addrs_infos: List[AddrInfoType] = []
81
+ for addr_info in addr_infos:
82
+ if addr_info[-1] == addr:
83
+ bad_addrs_infos.append(addr_info)
84
+ if bad_addrs_infos:
85
+ for bad_addr_info in bad_addrs_infos:
86
+ addr_infos.remove(bad_addr_info)
87
+ return
88
+ # Slow path in case addr is formatted differently
89
+ match_addr = _addr_tuple_to_ip_address(addr)
90
+ for addr_info in addr_infos:
91
+ if match_addr == _addr_tuple_to_ip_address(addr_info[-1]):
92
+ bad_addrs_infos.append(addr_info)
93
+ if bad_addrs_infos:
94
+ for bad_addr_info in bad_addrs_infos:
95
+ addr_infos.remove(bad_addr_info)
96
+ return
97
+ raise ValueError(f"Address {addr} not found in addr_infos")
evalkit_cambrian/lib/python3.10/site-packages/aiohttp/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (4.6 kB). View file
 
evalkit_cambrian/lib/python3.10/site-packages/aiohttp/__pycache__/base_protocol.cpython-310.pyc ADDED
Binary file (3.08 kB). View file
 
evalkit_cambrian/lib/python3.10/site-packages/aiohttp/__pycache__/http_parser.cpython-310.pyc ADDED
Binary file (20.2 kB). View file
 
evalkit_cambrian/lib/python3.10/site-packages/aiohttp/__pycache__/http_websocket.cpython-310.pyc ADDED
Binary file (814 Bytes). View file
 
evalkit_cambrian/lib/python3.10/site-packages/aiohttp/__pycache__/multipart.cpython-310.pyc ADDED
Binary file (28.7 kB). View file
 
evalkit_cambrian/lib/python3.10/site-packages/aiohttp/__pycache__/tcp_helpers.cpython-310.pyc ADDED
Binary file (1.14 kB). View file
 
evalkit_cambrian/lib/python3.10/site-packages/aiohttp/__pycache__/tracing.cpython-310.pyc ADDED
Binary file (14.3 kB). View file
 
evalkit_cambrian/lib/python3.10/site-packages/aiohttp/__pycache__/web_runner.cpython-310.pyc ADDED
Binary file (12 kB). View file
 
evalkit_cambrian/lib/python3.10/site-packages/aiohttp/__pycache__/worker.cpython-310.pyc ADDED
Binary file (6.52 kB). View file
 
evalkit_cambrian/lib/python3.10/site-packages/aiohttp/_websocket/__init__.py ADDED
@@ -0,0 +1 @@
 
 
1
+ """WebSocket protocol versions 13 and 8."""
evalkit_cambrian/lib/python3.10/site-packages/aiohttp/_websocket/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (229 Bytes). View file
 
evalkit_cambrian/lib/python3.10/site-packages/aiohttp/_websocket/__pycache__/helpers.cpython-310.pyc ADDED
Binary file (4.05 kB). View file
 
evalkit_cambrian/lib/python3.10/site-packages/aiohttp/_websocket/__pycache__/reader_c.cpython-310.pyc ADDED
Binary file (9.45 kB). View file
 
evalkit_cambrian/lib/python3.10/site-packages/aiohttp/_websocket/__pycache__/writer.cpython-310.pyc ADDED
Binary file (3.98 kB). View file
 
evalkit_cambrian/lib/python3.10/site-packages/aiohttp/_websocket/reader_c.py ADDED
@@ -0,0 +1,468 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Reader for WebSocket protocol versions 13 and 8."""
2
+
3
+ import asyncio
4
+ import builtins
5
+ from collections import deque
6
+ from typing import Deque, Final, List, Optional, Set, Tuple, Union
7
+
8
+ from ..base_protocol import BaseProtocol
9
+ from ..compression_utils import ZLibDecompressor
10
+ from ..helpers import _EXC_SENTINEL, set_exception
11
+ from ..streams import EofStream
12
+ from .helpers import UNPACK_CLOSE_CODE, UNPACK_LEN3, websocket_mask
13
+ from .models import (
14
+ WS_DEFLATE_TRAILING,
15
+ WebSocketError,
16
+ WSCloseCode,
17
+ WSMessage,
18
+ WSMsgType,
19
+ )
20
+
21
+ ALLOWED_CLOSE_CODES: Final[Set[int]] = {int(i) for i in WSCloseCode}
22
+
23
+ # States for the reader, used to parse the WebSocket frame
24
+ # integer values are used so they can be cythonized
25
+ READ_HEADER = 1
26
+ READ_PAYLOAD_LENGTH = 2
27
+ READ_PAYLOAD_MASK = 3
28
+ READ_PAYLOAD = 4
29
+
30
+ WS_MSG_TYPE_BINARY = WSMsgType.BINARY
31
+ WS_MSG_TYPE_TEXT = WSMsgType.TEXT
32
+
33
+ # WSMsgType values unpacked so they can by cythonized to ints
34
+ OP_CODE_CONTINUATION = WSMsgType.CONTINUATION.value
35
+ OP_CODE_TEXT = WSMsgType.TEXT.value
36
+ OP_CODE_BINARY = WSMsgType.BINARY.value
37
+ OP_CODE_CLOSE = WSMsgType.CLOSE.value
38
+ OP_CODE_PING = WSMsgType.PING.value
39
+ OP_CODE_PONG = WSMsgType.PONG.value
40
+
41
+ EMPTY_FRAME_ERROR = (True, b"")
42
+ EMPTY_FRAME = (False, b"")
43
+
44
+ TUPLE_NEW = tuple.__new__
45
+
46
+ int_ = int # Prevent Cython from converting to PyInt
47
+
48
+
49
+ class WebSocketDataQueue:
50
+ """WebSocketDataQueue resumes and pauses an underlying stream.
51
+
52
+ It is a destination for WebSocket data.
53
+ """
54
+
55
+ def __init__(
56
+ self, protocol: BaseProtocol, limit: int, *, loop: asyncio.AbstractEventLoop
57
+ ) -> None:
58
+ self._size = 0
59
+ self._protocol = protocol
60
+ self._limit = limit * 2
61
+ self._loop = loop
62
+ self._eof = False
63
+ self._waiter: Optional[asyncio.Future[None]] = None
64
+ self._exception: Union[BaseException, None] = None
65
+ self._buffer: Deque[Tuple[WSMessage, int]] = deque()
66
+ self._get_buffer = self._buffer.popleft
67
+ self._put_buffer = self._buffer.append
68
+
69
+ def is_eof(self) -> bool:
70
+ return self._eof
71
+
72
+ def exception(self) -> Optional[BaseException]:
73
+ return self._exception
74
+
75
+ def set_exception(
76
+ self,
77
+ exc: "BaseException",
78
+ exc_cause: builtins.BaseException = _EXC_SENTINEL,
79
+ ) -> None:
80
+ self._eof = True
81
+ self._exception = exc
82
+ if (waiter := self._waiter) is not None:
83
+ self._waiter = None
84
+ set_exception(waiter, exc, exc_cause)
85
+
86
+ def _release_waiter(self) -> None:
87
+ if (waiter := self._waiter) is None:
88
+ return
89
+ self._waiter = None
90
+ if not waiter.done():
91
+ waiter.set_result(None)
92
+
93
+ def feed_eof(self) -> None:
94
+ self._eof = True
95
+ self._release_waiter()
96
+
97
+ def feed_data(self, data: "WSMessage", size: "int_") -> None:
98
+ self._size += size
99
+ self._put_buffer((data, size))
100
+ self._release_waiter()
101
+ if self._size > self._limit and not self._protocol._reading_paused:
102
+ self._protocol.pause_reading()
103
+
104
+ async def read(self) -> WSMessage:
105
+ if not self._buffer and not self._eof:
106
+ assert not self._waiter
107
+ self._waiter = self._loop.create_future()
108
+ try:
109
+ await self._waiter
110
+ except (asyncio.CancelledError, asyncio.TimeoutError):
111
+ self._waiter = None
112
+ raise
113
+ return self._read_from_buffer()
114
+
115
+ def _read_from_buffer(self) -> WSMessage:
116
+ if self._buffer:
117
+ data, size = self._get_buffer()
118
+ self._size -= size
119
+ if self._size < self._limit and self._protocol._reading_paused:
120
+ self._protocol.resume_reading()
121
+ return data
122
+ if self._exception is not None:
123
+ raise self._exception
124
+ raise EofStream
125
+
126
+
127
+ class WebSocketReader:
128
+ def __init__(
129
+ self, queue: WebSocketDataQueue, max_msg_size: int, compress: bool = True
130
+ ) -> None:
131
+ self.queue = queue
132
+ self._max_msg_size = max_msg_size
133
+
134
+ self._exc: Optional[Exception] = None
135
+ self._partial = bytearray()
136
+ self._state = READ_HEADER
137
+
138
+ self._opcode: Optional[int] = None
139
+ self._frame_fin = False
140
+ self._frame_opcode: Optional[int] = None
141
+ self._frame_payload: Union[bytes, bytearray] = b""
142
+ self._frame_payload_len = 0
143
+
144
+ self._tail: bytes = b""
145
+ self._has_mask = False
146
+ self._frame_mask: Optional[bytes] = None
147
+ self._payload_length = 0
148
+ self._payload_length_flag = 0
149
+ self._compressed: Optional[bool] = None
150
+ self._decompressobj: Optional[ZLibDecompressor] = None
151
+ self._compress = compress
152
+
153
+ def feed_eof(self) -> None:
154
+ self.queue.feed_eof()
155
+
156
+ # data can be bytearray on Windows because proactor event loop uses bytearray
157
+ # and asyncio types this to Union[bytes, bytearray, memoryview] so we need
158
+ # coerce data to bytes if it is not
159
+ def feed_data(
160
+ self, data: Union[bytes, bytearray, memoryview]
161
+ ) -> Tuple[bool, bytes]:
162
+ if type(data) is not bytes:
163
+ data = bytes(data)
164
+
165
+ if self._exc is not None:
166
+ return True, data
167
+
168
+ try:
169
+ self._feed_data(data)
170
+ except Exception as exc:
171
+ self._exc = exc
172
+ set_exception(self.queue, exc)
173
+ return EMPTY_FRAME_ERROR
174
+
175
+ return EMPTY_FRAME
176
+
177
+ def _feed_data(self, data: bytes) -> None:
178
+ msg: WSMessage
179
+ for frame in self.parse_frame(data):
180
+ fin = frame[0]
181
+ opcode = frame[1]
182
+ payload = frame[2]
183
+ compressed = frame[3]
184
+
185
+ is_continuation = opcode == OP_CODE_CONTINUATION
186
+ if opcode == OP_CODE_TEXT or opcode == OP_CODE_BINARY or is_continuation:
187
+ # load text/binary
188
+ if not fin:
189
+ # got partial frame payload
190
+ if not is_continuation:
191
+ self._opcode = opcode
192
+ self._partial += payload
193
+ if self._max_msg_size and len(self._partial) >= self._max_msg_size:
194
+ raise WebSocketError(
195
+ WSCloseCode.MESSAGE_TOO_BIG,
196
+ "Message size {} exceeds limit {}".format(
197
+ len(self._partial), self._max_msg_size
198
+ ),
199
+ )
200
+ continue
201
+
202
+ has_partial = bool(self._partial)
203
+ if is_continuation:
204
+ if self._opcode is None:
205
+ raise WebSocketError(
206
+ WSCloseCode.PROTOCOL_ERROR,
207
+ "Continuation frame for non started message",
208
+ )
209
+ opcode = self._opcode
210
+ self._opcode = None
211
+ # previous frame was non finished
212
+ # we should get continuation opcode
213
+ elif has_partial:
214
+ raise WebSocketError(
215
+ WSCloseCode.PROTOCOL_ERROR,
216
+ "The opcode in non-fin frame is expected "
217
+ "to be zero, got {!r}".format(opcode),
218
+ )
219
+
220
+ assembled_payload: Union[bytes, bytearray]
221
+ if has_partial:
222
+ assembled_payload = self._partial + payload
223
+ self._partial.clear()
224
+ else:
225
+ assembled_payload = payload
226
+
227
+ if self._max_msg_size and len(assembled_payload) >= self._max_msg_size:
228
+ raise WebSocketError(
229
+ WSCloseCode.MESSAGE_TOO_BIG,
230
+ "Message size {} exceeds limit {}".format(
231
+ len(assembled_payload), self._max_msg_size
232
+ ),
233
+ )
234
+
235
+ # Decompress process must to be done after all packets
236
+ # received.
237
+ if compressed:
238
+ if not self._decompressobj:
239
+ self._decompressobj = ZLibDecompressor(
240
+ suppress_deflate_header=True
241
+ )
242
+ payload_merged = self._decompressobj.decompress_sync(
243
+ assembled_payload + WS_DEFLATE_TRAILING, self._max_msg_size
244
+ )
245
+ if self._decompressobj.unconsumed_tail:
246
+ left = len(self._decompressobj.unconsumed_tail)
247
+ raise WebSocketError(
248
+ WSCloseCode.MESSAGE_TOO_BIG,
249
+ "Decompressed message size {} exceeds limit {}".format(
250
+ self._max_msg_size + left, self._max_msg_size
251
+ ),
252
+ )
253
+ elif type(assembled_payload) is bytes:
254
+ payload_merged = assembled_payload
255
+ else:
256
+ payload_merged = bytes(assembled_payload)
257
+
258
+ if opcode == OP_CODE_TEXT:
259
+ try:
260
+ text = payload_merged.decode("utf-8")
261
+ except UnicodeDecodeError as exc:
262
+ raise WebSocketError(
263
+ WSCloseCode.INVALID_TEXT, "Invalid UTF-8 text message"
264
+ ) from exc
265
+
266
+ # XXX: The Text and Binary messages here can be a performance
267
+ # bottleneck, so we use tuple.__new__ to improve performance.
268
+ # This is not type safe, but many tests should fail in
269
+ # test_client_ws_functional.py if this is wrong.
270
+ self.queue.feed_data(
271
+ TUPLE_NEW(WSMessage, (WS_MSG_TYPE_TEXT, text, "")),
272
+ len(payload_merged),
273
+ )
274
+ else:
275
+ self.queue.feed_data(
276
+ TUPLE_NEW(WSMessage, (WS_MSG_TYPE_BINARY, payload_merged, "")),
277
+ len(payload_merged),
278
+ )
279
+ elif opcode == OP_CODE_CLOSE:
280
+ if len(payload) >= 2:
281
+ close_code = UNPACK_CLOSE_CODE(payload[:2])[0]
282
+ if close_code < 3000 and close_code not in ALLOWED_CLOSE_CODES:
283
+ raise WebSocketError(
284
+ WSCloseCode.PROTOCOL_ERROR,
285
+ f"Invalid close code: {close_code}",
286
+ )
287
+ try:
288
+ close_message = payload[2:].decode("utf-8")
289
+ except UnicodeDecodeError as exc:
290
+ raise WebSocketError(
291
+ WSCloseCode.INVALID_TEXT, "Invalid UTF-8 text message"
292
+ ) from exc
293
+ msg = TUPLE_NEW(
294
+ WSMessage, (WSMsgType.CLOSE, close_code, close_message)
295
+ )
296
+ elif payload:
297
+ raise WebSocketError(
298
+ WSCloseCode.PROTOCOL_ERROR,
299
+ f"Invalid close frame: {fin} {opcode} {payload!r}",
300
+ )
301
+ else:
302
+ msg = TUPLE_NEW(WSMessage, (WSMsgType.CLOSE, 0, ""))
303
+
304
+ self.queue.feed_data(msg, 0)
305
+ elif opcode == OP_CODE_PING:
306
+ msg = TUPLE_NEW(WSMessage, (WSMsgType.PING, payload, ""))
307
+ self.queue.feed_data(msg, len(payload))
308
+
309
+ elif opcode == OP_CODE_PONG:
310
+ msg = TUPLE_NEW(WSMessage, (WSMsgType.PONG, payload, ""))
311
+ self.queue.feed_data(msg, len(payload))
312
+
313
+ else:
314
+ raise WebSocketError(
315
+ WSCloseCode.PROTOCOL_ERROR, f"Unexpected opcode={opcode!r}"
316
+ )
317
+
318
+ def parse_frame(
319
+ self, buf: bytes
320
+ ) -> List[Tuple[bool, Optional[int], Union[bytes, bytearray], Optional[bool]]]:
321
+ """Return the next frame from the socket."""
322
+ frames: List[
323
+ Tuple[bool, Optional[int], Union[bytes, bytearray], Optional[bool]]
324
+ ] = []
325
+ if self._tail:
326
+ buf, self._tail = self._tail + buf, b""
327
+
328
+ start_pos: int = 0
329
+ buf_length = len(buf)
330
+
331
+ while True:
332
+ # read header
333
+ if self._state == READ_HEADER:
334
+ if buf_length - start_pos < 2:
335
+ break
336
+ first_byte = buf[start_pos]
337
+ second_byte = buf[start_pos + 1]
338
+ start_pos += 2
339
+
340
+ fin = (first_byte >> 7) & 1
341
+ rsv1 = (first_byte >> 6) & 1
342
+ rsv2 = (first_byte >> 5) & 1
343
+ rsv3 = (first_byte >> 4) & 1
344
+ opcode = first_byte & 0xF
345
+
346
+ # frame-fin = %x0 ; more frames of this message follow
347
+ # / %x1 ; final frame of this message
348
+ # frame-rsv1 = %x0 ;
349
+ # 1 bit, MUST be 0 unless negotiated otherwise
350
+ # frame-rsv2 = %x0 ;
351
+ # 1 bit, MUST be 0 unless negotiated otherwise
352
+ # frame-rsv3 = %x0 ;
353
+ # 1 bit, MUST be 0 unless negotiated otherwise
354
+ #
355
+ # Remove rsv1 from this test for deflate development
356
+ if rsv2 or rsv3 or (rsv1 and not self._compress):
357
+ raise WebSocketError(
358
+ WSCloseCode.PROTOCOL_ERROR,
359
+ "Received frame with non-zero reserved bits",
360
+ )
361
+
362
+ if opcode > 0x7 and fin == 0:
363
+ raise WebSocketError(
364
+ WSCloseCode.PROTOCOL_ERROR,
365
+ "Received fragmented control frame",
366
+ )
367
+
368
+ has_mask = (second_byte >> 7) & 1
369
+ length = second_byte & 0x7F
370
+
371
+ # Control frames MUST have a payload
372
+ # length of 125 bytes or less
373
+ if opcode > 0x7 and length > 125:
374
+ raise WebSocketError(
375
+ WSCloseCode.PROTOCOL_ERROR,
376
+ "Control frame payload cannot be larger than 125 bytes",
377
+ )
378
+
379
+ # Set compress status if last package is FIN
380
+ # OR set compress status if this is first fragment
381
+ # Raise error if not first fragment with rsv1 = 0x1
382
+ if self._frame_fin or self._compressed is None:
383
+ self._compressed = True if rsv1 else False
384
+ elif rsv1:
385
+ raise WebSocketError(
386
+ WSCloseCode.PROTOCOL_ERROR,
387
+ "Received frame with non-zero reserved bits",
388
+ )
389
+
390
+ self._frame_fin = bool(fin)
391
+ self._frame_opcode = opcode
392
+ self._has_mask = bool(has_mask)
393
+ self._payload_length_flag = length
394
+ self._state = READ_PAYLOAD_LENGTH
395
+
396
+ # read payload length
397
+ if self._state == READ_PAYLOAD_LENGTH:
398
+ length_flag = self._payload_length_flag
399
+ if length_flag == 126:
400
+ if buf_length - start_pos < 2:
401
+ break
402
+ first_byte = buf[start_pos]
403
+ second_byte = buf[start_pos + 1]
404
+ start_pos += 2
405
+ self._payload_length = first_byte << 8 | second_byte
406
+ elif length_flag > 126:
407
+ if buf_length - start_pos < 8:
408
+ break
409
+ data = buf[start_pos : start_pos + 8]
410
+ start_pos += 8
411
+ self._payload_length = UNPACK_LEN3(data)[0]
412
+ else:
413
+ self._payload_length = length_flag
414
+
415
+ self._state = READ_PAYLOAD_MASK if self._has_mask else READ_PAYLOAD
416
+
417
+ # read payload mask
418
+ if self._state == READ_PAYLOAD_MASK:
419
+ if buf_length - start_pos < 4:
420
+ break
421
+ self._frame_mask = buf[start_pos : start_pos + 4]
422
+ start_pos += 4
423
+ self._state = READ_PAYLOAD
424
+
425
+ if self._state == READ_PAYLOAD:
426
+ chunk_len = buf_length - start_pos
427
+ if self._payload_length >= chunk_len:
428
+ end_pos = buf_length
429
+ self._payload_length -= chunk_len
430
+ else:
431
+ end_pos = start_pos + self._payload_length
432
+ self._payload_length = 0
433
+
434
+ if self._frame_payload_len:
435
+ if type(self._frame_payload) is not bytearray:
436
+ self._frame_payload = bytearray(self._frame_payload)
437
+ self._frame_payload += buf[start_pos:end_pos]
438
+ else:
439
+ # Fast path for the first frame
440
+ self._frame_payload = buf[start_pos:end_pos]
441
+
442
+ self._frame_payload_len += end_pos - start_pos
443
+ start_pos = end_pos
444
+
445
+ if self._payload_length != 0:
446
+ break
447
+
448
+ if self._has_mask:
449
+ assert self._frame_mask is not None
450
+ if type(self._frame_payload) is not bytearray:
451
+ self._frame_payload = bytearray(self._frame_payload)
452
+ websocket_mask(self._frame_mask, self._frame_payload)
453
+
454
+ frames.append(
455
+ (
456
+ self._frame_fin,
457
+ self._frame_opcode,
458
+ self._frame_payload,
459
+ self._compressed,
460
+ )
461
+ )
462
+ self._frame_payload = b""
463
+ self._frame_payload_len = 0
464
+ self._state = READ_HEADER
465
+
466
+ self._tail = buf[start_pos:] if start_pos < buf_length else b""
467
+
468
+ return frames
evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/__init__.py ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ # http://www.python.org/dev/peps/pep-0396/
2
+ __version__ = '0.4.1'
evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc1157.py ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #
2
+ # This file is part of pyasn1-modules software.
3
+ #
4
+ # Copyright (c) 2005-2020, Ilya Etingof <etingof@gmail.com>
5
+ # License: http://snmplabs.com/pyasn1/license.html
6
+ #
7
+ # SNMPv1 message syntax
8
+ #
9
+ # ASN.1 source from:
10
+ # http://www.ietf.org/rfc/rfc1157.txt
11
+ #
12
+ # Sample captures from:
13
+ # http://wiki.wireshark.org/SampleCaptures/
14
+ #
15
+ from pyasn1.type import namedtype
16
+ from pyasn1.type import namedval
17
+ from pyasn1.type import tag
18
+ from pyasn1.type import univ
19
+
20
+ from pyasn1_modules import rfc1155
21
+
22
+
23
+ class Version(univ.Integer):
24
+ namedValues = namedval.NamedValues(
25
+ ('version-1', 0)
26
+ )
27
+ defaultValue = 0
28
+
29
+
30
+ class Community(univ.OctetString):
31
+ pass
32
+
33
+
34
+ class RequestID(univ.Integer):
35
+ pass
36
+
37
+
38
+ class ErrorStatus(univ.Integer):
39
+ namedValues = namedval.NamedValues(
40
+ ('noError', 0),
41
+ ('tooBig', 1),
42
+ ('noSuchName', 2),
43
+ ('badValue', 3),
44
+ ('readOnly', 4),
45
+ ('genErr', 5)
46
+ )
47
+
48
+
49
+ class ErrorIndex(univ.Integer):
50
+ pass
51
+
52
+
53
+ class VarBind(univ.Sequence):
54
+ componentType = namedtype.NamedTypes(
55
+ namedtype.NamedType('name', rfc1155.ObjectName()),
56
+ namedtype.NamedType('value', rfc1155.ObjectSyntax())
57
+ )
58
+
59
+
60
+ class VarBindList(univ.SequenceOf):
61
+ componentType = VarBind()
62
+
63
+
64
+ class _RequestBase(univ.Sequence):
65
+ componentType = namedtype.NamedTypes(
66
+ namedtype.NamedType('request-id', RequestID()),
67
+ namedtype.NamedType('error-status', ErrorStatus()),
68
+ namedtype.NamedType('error-index', ErrorIndex()),
69
+ namedtype.NamedType('variable-bindings', VarBindList())
70
+ )
71
+
72
+
73
+ class GetRequestPDU(_RequestBase):
74
+ tagSet = _RequestBase.tagSet.tagImplicitly(
75
+ tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0)
76
+ )
77
+
78
+
79
+ class GetNextRequestPDU(_RequestBase):
80
+ tagSet = _RequestBase.tagSet.tagImplicitly(
81
+ tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1)
82
+ )
83
+
84
+
85
+ class GetResponsePDU(_RequestBase):
86
+ tagSet = _RequestBase.tagSet.tagImplicitly(
87
+ tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 2)
88
+ )
89
+
90
+
91
+ class SetRequestPDU(_RequestBase):
92
+ tagSet = _RequestBase.tagSet.tagImplicitly(
93
+ tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 3)
94
+ )
95
+
96
+
97
+ class TrapPDU(univ.Sequence):
98
+ componentType = namedtype.NamedTypes(
99
+ namedtype.NamedType('enterprise', univ.ObjectIdentifier()),
100
+ namedtype.NamedType('agent-addr', rfc1155.NetworkAddress()),
101
+ namedtype.NamedType('generic-trap', univ.Integer().clone(
102
+ namedValues=namedval.NamedValues(('coldStart', 0), ('warmStart', 1), ('linkDown', 2), ('linkUp', 3),
103
+ ('authenticationFailure', 4), ('egpNeighborLoss', 5),
104
+ ('enterpriseSpecific', 6)))),
105
+ namedtype.NamedType('specific-trap', univ.Integer()),
106
+ namedtype.NamedType('time-stamp', rfc1155.TimeTicks()),
107
+ namedtype.NamedType('variable-bindings', VarBindList())
108
+ )
109
+
110
+
111
+ class Pdus(univ.Choice):
112
+ componentType = namedtype.NamedTypes(
113
+ namedtype.NamedType('get-request', GetRequestPDU()),
114
+ namedtype.NamedType('get-next-request', GetNextRequestPDU()),
115
+ namedtype.NamedType('get-response', GetResponsePDU()),
116
+ namedtype.NamedType('set-request', SetRequestPDU()),
117
+ namedtype.NamedType('trap', TrapPDU())
118
+ )
119
+
120
+
121
+ class Message(univ.Sequence):
122
+ componentType = namedtype.NamedTypes(
123
+ namedtype.NamedType('version', Version()),
124
+ namedtype.NamedType('community', Community()),
125
+ namedtype.NamedType('data', Pdus())
126
+ )
evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc2437.py ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #
2
+ # This file is part of pyasn1-modules software.
3
+ #
4
+ # Copyright (c) 2005-2020, Ilya Etingof <etingof@gmail.com>
5
+ # License: http://snmplabs.com/pyasn1/license.html
6
+ #
7
+ # PKCS#1 syntax
8
+ #
9
+ # ASN.1 source from:
10
+ # ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2.asn
11
+ #
12
+ # Sample captures could be obtained with "openssl genrsa" command
13
+ #
14
+ from pyasn1.type import namedtype
15
+ from pyasn1.type import tag
16
+ from pyasn1.type import univ
17
+
18
+ from pyasn1_modules.rfc2459 import AlgorithmIdentifier
19
+
20
+ pkcs_1 = univ.ObjectIdentifier('1.2.840.113549.1.1')
21
+ rsaEncryption = univ.ObjectIdentifier('1.2.840.113549.1.1.1')
22
+ md2WithRSAEncryption = univ.ObjectIdentifier('1.2.840.113549.1.1.2')
23
+ md4WithRSAEncryption = univ.ObjectIdentifier('1.2.840.113549.1.1.3')
24
+ md5WithRSAEncryption = univ.ObjectIdentifier('1.2.840.113549.1.1.4')
25
+ sha1WithRSAEncryption = univ.ObjectIdentifier('1.2.840.113549.1.1.5')
26
+ rsaOAEPEncryptionSET = univ.ObjectIdentifier('1.2.840.113549.1.1.6')
27
+ id_RSAES_OAEP = univ.ObjectIdentifier('1.2.840.113549.1.1.7')
28
+ id_mgf1 = univ.ObjectIdentifier('1.2.840.113549.1.1.8')
29
+ id_pSpecified = univ.ObjectIdentifier('1.2.840.113549.1.1.9')
30
+ id_sha1 = univ.ObjectIdentifier('1.3.14.3.2.26')
31
+
32
+ MAX = float('inf')
33
+
34
+
35
+ class Version(univ.Integer):
36
+ pass
37
+
38
+
39
+ class RSAPrivateKey(univ.Sequence):
40
+ componentType = namedtype.NamedTypes(
41
+ namedtype.NamedType('version', Version()),
42
+ namedtype.NamedType('modulus', univ.Integer()),
43
+ namedtype.NamedType('publicExponent', univ.Integer()),
44
+ namedtype.NamedType('privateExponent', univ.Integer()),
45
+ namedtype.NamedType('prime1', univ.Integer()),
46
+ namedtype.NamedType('prime2', univ.Integer()),
47
+ namedtype.NamedType('exponent1', univ.Integer()),
48
+ namedtype.NamedType('exponent2', univ.Integer()),
49
+ namedtype.NamedType('coefficient', univ.Integer())
50
+ )
51
+
52
+
53
+ class RSAPublicKey(univ.Sequence):
54
+ componentType = namedtype.NamedTypes(
55
+ namedtype.NamedType('modulus', univ.Integer()),
56
+ namedtype.NamedType('publicExponent', univ.Integer())
57
+ )
58
+
59
+
60
+ # XXX defaults not set
61
+ class RSAES_OAEP_params(univ.Sequence):
62
+ componentType = namedtype.NamedTypes(
63
+ namedtype.NamedType('hashFunc', AlgorithmIdentifier().subtype(
64
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
65
+ namedtype.NamedType('maskGenFunc', AlgorithmIdentifier().subtype(
66
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1))),
67
+ namedtype.NamedType('pSourceFunc', AlgorithmIdentifier().subtype(
68
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 2)))
69
+ )
evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc2511.py ADDED
@@ -0,0 +1,258 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #
2
+ # This file is part of pyasn1-modules software.
3
+ #
4
+ # Copyright (c) 2005-2020, Ilya Etingof <etingof@gmail.com>
5
+ # License: http://snmplabs.com/pyasn1/license.html
6
+ #
7
+ # X.509 certificate Request Message Format (CRMF) syntax
8
+ #
9
+ # ASN.1 source from:
10
+ # http://tools.ietf.org/html/rfc2511
11
+ #
12
+ # Sample captures could be obtained with OpenSSL
13
+ #
14
+ from pyasn1_modules import rfc2315
15
+ from pyasn1_modules.rfc2459 import *
16
+
17
+ MAX = float('inf')
18
+
19
+ id_pkix = univ.ObjectIdentifier('1.3.6.1.5.5.7')
20
+ id_pkip = univ.ObjectIdentifier('1.3.6.1.5.5.7.5')
21
+ id_regCtrl = univ.ObjectIdentifier('1.3.6.1.5.5.7.5.1')
22
+ id_regCtrl_regToken = univ.ObjectIdentifier('1.3.6.1.5.5.7.5.1.1')
23
+ id_regCtrl_authenticator = univ.ObjectIdentifier('1.3.6.1.5.5.7.5.1.2')
24
+ id_regCtrl_pkiPublicationInfo = univ.ObjectIdentifier('1.3.6.1.5.5.7.5.1.3')
25
+ id_regCtrl_pkiArchiveOptions = univ.ObjectIdentifier('1.3.6.1.5.5.7.5.1.4')
26
+ id_regCtrl_oldCertID = univ.ObjectIdentifier('1.3.6.1.5.5.7.5.1.5')
27
+ id_regCtrl_protocolEncrKey = univ.ObjectIdentifier('1.3.6.1.5.5.7.5.1.6')
28
+ id_regInfo = univ.ObjectIdentifier('1.3.6.1.5.5.7.5.2')
29
+ id_regInfo_utf8Pairs = univ.ObjectIdentifier('1.3.6.1.5.5.7.5.2.1')
30
+ id_regInfo_certReq = univ.ObjectIdentifier('1.3.6.1.5.5.7.5.2.2')
31
+
32
+
33
+ # This should be in PKIX Certificate Extensions module
34
+
35
+ class GeneralName(univ.OctetString):
36
+ pass
37
+
38
+
39
+ # end of PKIX Certificate Extensions module
40
+
41
+ class UTF8Pairs(char.UTF8String):
42
+ pass
43
+
44
+
45
+ class ProtocolEncrKey(SubjectPublicKeyInfo):
46
+ pass
47
+
48
+
49
+ class CertId(univ.Sequence):
50
+ componentType = namedtype.NamedTypes(
51
+ namedtype.NamedType('issuer', GeneralName()),
52
+ namedtype.NamedType('serialNumber', univ.Integer())
53
+ )
54
+
55
+
56
+ class OldCertId(CertId):
57
+ pass
58
+
59
+
60
+ class KeyGenParameters(univ.OctetString):
61
+ pass
62
+
63
+
64
+ class EncryptedValue(univ.Sequence):
65
+ componentType = namedtype.NamedTypes(
66
+ namedtype.OptionalNamedType('intendedAlg', AlgorithmIdentifier().subtype(
67
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
68
+ namedtype.OptionalNamedType('symmAlg', AlgorithmIdentifier().subtype(
69
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1))),
70
+ namedtype.OptionalNamedType('encSymmKey', univ.BitString().subtype(
71
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 2))),
72
+ namedtype.OptionalNamedType('keyAlg', AlgorithmIdentifier().subtype(
73
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 3))),
74
+ namedtype.OptionalNamedType('valueHint', univ.OctetString().subtype(
75
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 4))),
76
+ namedtype.NamedType('encValue', univ.BitString())
77
+ )
78
+
79
+
80
+ class EncryptedKey(univ.Choice):
81
+ componentType = namedtype.NamedTypes(
82
+ namedtype.NamedType('encryptedValue', EncryptedValue()),
83
+ namedtype.NamedType('envelopedData', rfc2315.EnvelopedData().subtype(
84
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0)))
85
+ )
86
+
87
+
88
+ class PKIArchiveOptions(univ.Choice):
89
+ componentType = namedtype.NamedTypes(
90
+ namedtype.NamedType('encryptedPrivKey', EncryptedKey().subtype(
91
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
92
+ namedtype.NamedType('keyGenParameters', KeyGenParameters().subtype(
93
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
94
+ namedtype.NamedType('archiveRemGenPrivKey',
95
+ univ.Boolean().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2)))
96
+ )
97
+
98
+
99
+ class SinglePubInfo(univ.Sequence):
100
+ componentType = namedtype.NamedTypes(
101
+ namedtype.NamedType('pubMethod', univ.Integer(
102
+ namedValues=namedval.NamedValues(('dontCare', 0), ('x500', 1), ('web', 2), ('ldap', 3)))),
103
+ namedtype.OptionalNamedType('pubLocation', GeneralName())
104
+ )
105
+
106
+
107
+ class PKIPublicationInfo(univ.Sequence):
108
+ componentType = namedtype.NamedTypes(
109
+ namedtype.NamedType('action',
110
+ univ.Integer(namedValues=namedval.NamedValues(('dontPublish', 0), ('pleasePublish', 1)))),
111
+ namedtype.OptionalNamedType('pubInfos', univ.SequenceOf(componentType=SinglePubInfo()).subtype(
112
+ sizeSpec=constraint.ValueSizeConstraint(1, MAX)))
113
+ )
114
+
115
+
116
+ class Authenticator(char.UTF8String):
117
+ pass
118
+
119
+
120
+ class RegToken(char.UTF8String):
121
+ pass
122
+
123
+
124
+ class SubsequentMessage(univ.Integer):
125
+ namedValues = namedval.NamedValues(
126
+ ('encrCert', 0),
127
+ ('challengeResp', 1)
128
+ )
129
+
130
+
131
+ class POPOPrivKey(univ.Choice):
132
+ componentType = namedtype.NamedTypes(
133
+ namedtype.NamedType('thisMessage',
134
+ univ.BitString().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
135
+ namedtype.NamedType('subsequentMessage', SubsequentMessage().subtype(
136
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
137
+ namedtype.NamedType('dhMAC',
138
+ univ.BitString().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2)))
139
+ )
140
+
141
+
142
+ class PBMParameter(univ.Sequence):
143
+ componentType = namedtype.NamedTypes(
144
+ namedtype.NamedType('salt', univ.OctetString()),
145
+ namedtype.NamedType('owf', AlgorithmIdentifier()),
146
+ namedtype.NamedType('iterationCount', univ.Integer()),
147
+ namedtype.NamedType('mac', AlgorithmIdentifier())
148
+ )
149
+
150
+
151
+ class PKMACValue(univ.Sequence):
152
+ componentType = namedtype.NamedTypes(
153
+ namedtype.NamedType('algId', AlgorithmIdentifier()),
154
+ namedtype.NamedType('value', univ.BitString())
155
+ )
156
+
157
+
158
+ class POPOSigningKeyInput(univ.Sequence):
159
+ componentType = namedtype.NamedTypes(
160
+ namedtype.NamedType(
161
+ 'authInfo', univ.Choice(
162
+ componentType=namedtype.NamedTypes(
163
+ namedtype.NamedType(
164
+ 'sender', GeneralName().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))
165
+ ),
166
+ namedtype.NamedType('publicKeyMAC', PKMACValue())
167
+ )
168
+ )
169
+ ),
170
+ namedtype.NamedType('publicKey', SubjectPublicKeyInfo())
171
+ )
172
+
173
+
174
+ class POPOSigningKey(univ.Sequence):
175
+ componentType = namedtype.NamedTypes(
176
+ namedtype.OptionalNamedType('poposkInput', POPOSigningKeyInput().subtype(
177
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
178
+ namedtype.NamedType('algorithmIdentifier', AlgorithmIdentifier()),
179
+ namedtype.NamedType('signature', univ.BitString())
180
+ )
181
+
182
+
183
+ class ProofOfPossession(univ.Choice):
184
+ componentType = namedtype.NamedTypes(
185
+ namedtype.NamedType('raVerified',
186
+ univ.Null().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
187
+ namedtype.NamedType('signature', POPOSigningKey().subtype(
188
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1))),
189
+ namedtype.NamedType('keyEncipherment', POPOPrivKey().subtype(
190
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 2))),
191
+ namedtype.NamedType('keyAgreement', POPOPrivKey().subtype(
192
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 3)))
193
+ )
194
+
195
+
196
+ class Controls(univ.SequenceOf):
197
+ componentType = AttributeTypeAndValue()
198
+ sizeSpec = univ.SequenceOf.sizeSpec + constraint.ValueSizeConstraint(1, MAX)
199
+
200
+
201
+ class OptionalValidity(univ.Sequence):
202
+ componentType = namedtype.NamedTypes(
203
+ namedtype.OptionalNamedType('notBefore',
204
+ Time().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
205
+ namedtype.OptionalNamedType('notAfter',
206
+ Time().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
207
+ )
208
+
209
+
210
+ class CertTemplate(univ.Sequence):
211
+ componentType = namedtype.NamedTypes(
212
+ namedtype.OptionalNamedType('version', Version().subtype(
213
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
214
+ namedtype.OptionalNamedType('serialNumber', univ.Integer().subtype(
215
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
216
+ namedtype.OptionalNamedType('signingAlg', AlgorithmIdentifier().subtype(
217
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 2))),
218
+ namedtype.OptionalNamedType('issuer', Name().subtype(
219
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 3))),
220
+ namedtype.OptionalNamedType('validity', OptionalValidity().subtype(
221
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 4))),
222
+ namedtype.OptionalNamedType('subject', Name().subtype(
223
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 5))),
224
+ namedtype.OptionalNamedType('publicKey', SubjectPublicKeyInfo().subtype(
225
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 6))),
226
+ namedtype.OptionalNamedType('issuerUID', UniqueIdentifier().subtype(
227
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 7))),
228
+ namedtype.OptionalNamedType('subjectUID', UniqueIdentifier().subtype(
229
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 8))),
230
+ namedtype.OptionalNamedType('extensions', Extensions().subtype(
231
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 9)))
232
+ )
233
+
234
+
235
+ class CertRequest(univ.Sequence):
236
+ componentType = namedtype.NamedTypes(
237
+ namedtype.NamedType('certReqId', univ.Integer()),
238
+ namedtype.NamedType('certTemplate', CertTemplate()),
239
+ namedtype.OptionalNamedType('controls', Controls())
240
+ )
241
+
242
+
243
+ class CertReq(CertRequest):
244
+ pass
245
+
246
+
247
+ class CertReqMsg(univ.Sequence):
248
+ componentType = namedtype.NamedTypes(
249
+ namedtype.NamedType('certReq', CertRequest()),
250
+ namedtype.OptionalNamedType('pop', ProofOfPossession()),
251
+ namedtype.OptionalNamedType('regInfo', univ.SequenceOf(componentType=AttributeTypeAndValue()).subtype(
252
+ sizeSpec=constraint.ValueSizeConstraint(1, MAX)))
253
+ )
254
+
255
+
256
+ class CertReqMessages(univ.SequenceOf):
257
+ componentType = CertReqMsg()
258
+ sizeSpec = univ.SequenceOf.sizeSpec + constraint.ValueSizeConstraint(1, MAX)
evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc2986.py ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding: utf-8
2
+ #
3
+ # This file is part of pyasn1-modules software.
4
+ #
5
+ # Created by Joel Johnson with asn1ate tool.
6
+ # Modified by Russ Housley to add support for opentypes by importing
7
+ # definitions from rfc5280 so that the same maps are used.
8
+ #
9
+ # Copyright (c) 2005-2020, Ilya Etingof <etingof@gmail.com>
10
+ # License: http://snmplabs.com/pyasn1/license.html
11
+ #
12
+ # PKCS #10: Certification Request Syntax Specification
13
+ #
14
+ # ASN.1 source from:
15
+ # https://www.rfc-editor.org/rfc/rfc2986.txt
16
+ #
17
+ from pyasn1.type import namedtype
18
+ from pyasn1.type import tag
19
+ from pyasn1.type import univ
20
+
21
+ from pyasn1_modules import rfc5280
22
+
23
+ MAX = float('inf')
24
+
25
+
26
+ AttributeType = rfc5280.AttributeType
27
+
28
+ AttributeValue = rfc5280.AttributeValue
29
+
30
+ AttributeTypeAndValue = rfc5280.AttributeTypeAndValue
31
+
32
+ Attribute = rfc5280.Attribute
33
+
34
+ RelativeDistinguishedName = rfc5280.RelativeDistinguishedName
35
+
36
+ RDNSequence = rfc5280.RDNSequence
37
+
38
+ Name = rfc5280.Name
39
+
40
+ AlgorithmIdentifier = rfc5280.AlgorithmIdentifier
41
+
42
+ SubjectPublicKeyInfo = rfc5280.SubjectPublicKeyInfo
43
+
44
+
45
+ class Attributes(univ.SetOf):
46
+ pass
47
+
48
+
49
+ Attributes.componentType = Attribute()
50
+
51
+
52
+ class CertificationRequestInfo(univ.Sequence):
53
+ pass
54
+
55
+
56
+ CertificationRequestInfo.componentType = namedtype.NamedTypes(
57
+ namedtype.NamedType('version', univ.Integer()),
58
+ namedtype.NamedType('subject', Name()),
59
+ namedtype.NamedType('subjectPKInfo', SubjectPublicKeyInfo()),
60
+ namedtype.NamedType('attributes',
61
+ Attributes().subtype(implicitTag=tag.Tag(
62
+ tag.tagClassContext, tag.tagFormatSimple, 0))
63
+ )
64
+ )
65
+
66
+
67
+ class CertificationRequest(univ.Sequence):
68
+ pass
69
+
70
+
71
+ CertificationRequest.componentType = namedtype.NamedTypes(
72
+ namedtype.NamedType('certificationRequestInfo', CertificationRequestInfo()),
73
+ namedtype.NamedType('signatureAlgorithm', AlgorithmIdentifier()),
74
+ namedtype.NamedType('signature', univ.BitString())
75
+ )
evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc3414.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #
2
+ # This file is part of pyasn1-modules software.
3
+ #
4
+ # Copyright (c) 2005-2020, Ilya Etingof <etingof@gmail.com>
5
+ # License: http://snmplabs.com/pyasn1/license.html
6
+ #
7
+ # SNMPv3 message syntax
8
+ #
9
+ # ASN.1 source from:
10
+ # http://www.ietf.org/rfc/rfc3414.txt
11
+ #
12
+ from pyasn1.type import constraint
13
+ from pyasn1.type import namedtype
14
+ from pyasn1.type import univ
15
+
16
+
17
+ class UsmSecurityParameters(univ.Sequence):
18
+ componentType = namedtype.NamedTypes(
19
+ namedtype.NamedType('msgAuthoritativeEngineID', univ.OctetString()),
20
+ namedtype.NamedType('msgAuthoritativeEngineBoots',
21
+ univ.Integer().subtype(subtypeSpec=constraint.ValueRangeConstraint(0, 2147483647))),
22
+ namedtype.NamedType('msgAuthoritativeEngineTime',
23
+ univ.Integer().subtype(subtypeSpec=constraint.ValueRangeConstraint(0, 2147483647))),
24
+ namedtype.NamedType('msgUserName',
25
+ univ.OctetString().subtype(subtypeSpec=constraint.ValueSizeConstraint(0, 32))),
26
+ namedtype.NamedType('msgAuthenticationParameters', univ.OctetString()),
27
+ namedtype.NamedType('msgPrivacyParameters', univ.OctetString())
28
+ )
evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc3657.py ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ # Camellia Algorithm in CMS
10
+ #
11
+ # ASN.1 source from:
12
+ # https://www.rfc-editor.org/rfc/rfc3657.txt
13
+ #
14
+
15
+ from pyasn1.type import constraint
16
+ from pyasn1.type import univ
17
+
18
+ from pyasn1_modules import rfc5280
19
+ from pyasn1_modules import rfc5751
20
+
21
+
22
+ id_camellia128_cbc = univ.ObjectIdentifier('1.2.392.200011.61.1.1.1.2')
23
+
24
+ id_camellia192_cbc = univ.ObjectIdentifier('1.2.392.200011.61.1.1.1.3')
25
+
26
+ id_camellia256_cbc = univ.ObjectIdentifier('1.2.392.200011.61.1.1.1.4')
27
+
28
+ id_camellia128_wrap = univ.ObjectIdentifier('1.2.392.200011.61.1.1.3.2')
29
+
30
+ id_camellia192_wrap = univ.ObjectIdentifier('1.2.392.200011.61.1.1.3.3')
31
+
32
+ id_camellia256_wrap = univ.ObjectIdentifier('1.2.392.200011.61.1.1.3.4')
33
+
34
+
35
+
36
+ class Camellia_IV(univ.OctetString):
37
+ subtypeSpec = constraint.ValueSizeConstraint(16, 16)
38
+
39
+
40
+ class CamelliaSMimeCapability(univ.Null):
41
+ pass
42
+
43
+
44
+ # Update the Algorithm Identifier map in rfc5280.py.
45
+
46
+ _algorithmIdentifierMapUpdate = {
47
+ id_camellia128_cbc: Camellia_IV(),
48
+ id_camellia192_cbc: Camellia_IV(),
49
+ id_camellia256_cbc: Camellia_IV(),
50
+ }
51
+
52
+ rfc5280.algorithmIdentifierMap.update(_algorithmIdentifierMapUpdate)
53
+
54
+
55
+ # Update the SMIMECapabilities Attribute map in rfc5751.py
56
+
57
+ _smimeCapabilityMapUpdate = {
58
+ id_camellia128_cbc: CamelliaSMimeCapability(),
59
+ id_camellia192_cbc: CamelliaSMimeCapability(),
60
+ id_camellia256_cbc: CamelliaSMimeCapability(),
61
+ id_camellia128_wrap: CamelliaSMimeCapability(),
62
+ id_camellia192_wrap: CamelliaSMimeCapability(),
63
+ id_camellia256_wrap: CamelliaSMimeCapability(),
64
+ }
65
+
66
+ rfc5751.smimeCapabilityMap.update(_smimeCapabilityMapUpdate)
evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc3779.py ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #
2
+ # This file is part of pyasn1-modules software.
3
+ #
4
+ # Created by Russ Housley with assistance from asn1ate v.0.6.0.
5
+ # Modified by Russ Housley to add maps for use with opentypes.
6
+ #
7
+ # Copyright (c) 2019, Vigil Security, LLC
8
+ # License: http://snmplabs.com/pyasn1/license.html
9
+ #
10
+ # X.509 Extensions for IP Addresses and AS Identifiers
11
+ #
12
+ # ASN.1 source from:
13
+ # https://www.rfc-editor.org/rfc/rfc3779.txt
14
+ #
15
+
16
+ from pyasn1.type import constraint
17
+ from pyasn1.type import namedtype
18
+ from pyasn1.type import tag
19
+ from pyasn1.type import univ
20
+
21
+ from pyasn1_modules import rfc5280
22
+
23
+
24
+ # IP Address Delegation Extension
25
+
26
+ id_pe_ipAddrBlocks = univ.ObjectIdentifier('1.3.6.1.5.5.7.1.7')
27
+
28
+
29
+ class IPAddress(univ.BitString):
30
+ pass
31
+
32
+
33
+ class IPAddressRange(univ.Sequence):
34
+ pass
35
+
36
+ IPAddressRange.componentType = namedtype.NamedTypes(
37
+ namedtype.NamedType('min', IPAddress()),
38
+ namedtype.NamedType('max', IPAddress())
39
+ )
40
+
41
+
42
+ class IPAddressOrRange(univ.Choice):
43
+ pass
44
+
45
+ IPAddressOrRange.componentType = namedtype.NamedTypes(
46
+ namedtype.NamedType('addressPrefix', IPAddress()),
47
+ namedtype.NamedType('addressRange', IPAddressRange())
48
+ )
49
+
50
+
51
+ class IPAddressChoice(univ.Choice):
52
+ pass
53
+
54
+ IPAddressChoice.componentType = namedtype.NamedTypes(
55
+ namedtype.NamedType('inherit', univ.Null()),
56
+ namedtype.NamedType('addressesOrRanges', univ.SequenceOf(
57
+ componentType=IPAddressOrRange())
58
+ )
59
+ )
60
+
61
+
62
+ class IPAddressFamily(univ.Sequence):
63
+ pass
64
+
65
+ IPAddressFamily.componentType = namedtype.NamedTypes(
66
+ namedtype.NamedType('addressFamily', univ.OctetString().subtype(
67
+ subtypeSpec=constraint.ValueSizeConstraint(2, 3))),
68
+ namedtype.NamedType('ipAddressChoice', IPAddressChoice())
69
+ )
70
+
71
+
72
+ class IPAddrBlocks(univ.SequenceOf):
73
+ pass
74
+
75
+ IPAddrBlocks.componentType = IPAddressFamily()
76
+
77
+
78
+ # Autonomous System Identifier Delegation Extension
79
+
80
+ id_pe_autonomousSysIds = univ.ObjectIdentifier('1.3.6.1.5.5.7.1.8')
81
+
82
+
83
+ class ASId(univ.Integer):
84
+ pass
85
+
86
+
87
+ class ASRange(univ.Sequence):
88
+ pass
89
+
90
+ ASRange.componentType = namedtype.NamedTypes(
91
+ namedtype.NamedType('min', ASId()),
92
+ namedtype.NamedType('max', ASId())
93
+ )
94
+
95
+
96
+ class ASIdOrRange(univ.Choice):
97
+ pass
98
+
99
+ ASIdOrRange.componentType = namedtype.NamedTypes(
100
+ namedtype.NamedType('id', ASId()),
101
+ namedtype.NamedType('range', ASRange())
102
+ )
103
+
104
+
105
+ class ASIdentifierChoice(univ.Choice):
106
+ pass
107
+
108
+ ASIdentifierChoice.componentType = namedtype.NamedTypes(
109
+ namedtype.NamedType('inherit', univ.Null()),
110
+ namedtype.NamedType('asIdsOrRanges', univ.SequenceOf(
111
+ componentType=ASIdOrRange())
112
+ )
113
+ )
114
+
115
+
116
+ class ASIdentifiers(univ.Sequence):
117
+ pass
118
+
119
+ ASIdentifiers.componentType = namedtype.NamedTypes(
120
+ namedtype.OptionalNamedType('asnum', ASIdentifierChoice().subtype(
121
+ explicitTag=tag.Tag(tag.tagClassContext,
122
+ tag.tagFormatConstructed, 0))),
123
+ namedtype.OptionalNamedType('rdi', ASIdentifierChoice().subtype(
124
+ explicitTag=tag.Tag(tag.tagClassContext,
125
+ tag.tagFormatConstructed, 1)))
126
+ )
127
+
128
+
129
+ # Map of Certificate Extension OIDs to Extensions is added to the
130
+ # ones that are in rfc5280.py
131
+
132
+ _certificateExtensionsMapUpdate = {
133
+ id_pe_ipAddrBlocks: IPAddrBlocks(),
134
+ id_pe_autonomousSysIds: ASIdentifiers(),
135
+ }
136
+
137
+ rfc5280.certificateExtensionsMap.update(_certificateExtensionsMapUpdate)
evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc4387.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ # Certificate Store Access via HTTP
10
+ #
11
+ # ASN.1 source from:
12
+ # https://www.rfc-editor.org/rfc/rfc4387.txt
13
+ #
14
+
15
+
16
+ from pyasn1.type import univ
17
+
18
+
19
+ id_ad = univ.ObjectIdentifier((1, 3, 6, 1, 5, 5, 7, 48, ))
20
+
21
+ id_ad_http_certs = id_ad + (6, )
22
+
23
+ id_ad_http_crls = id_ad + (7,)
evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc4490.py ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #
2
+ # This file is part of pyasn1-modules software.
3
+ #
4
+ # Created by Russ Housley with 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
+ # Using the GOST 28147-89, GOST R 34.11-94, GOST R 34.10-94, and
10
+ # GOST R 34.10-2001 Algorithms with the CMS
11
+ #
12
+ # ASN.1 source from:
13
+ # https://www.rfc-editor.org/rfc/rfc4490.txt
14
+ #
15
+
16
+
17
+ from pyasn1.type import univ, char, namedtype, namedval, tag, constraint, useful
18
+
19
+ from pyasn1_modules import rfc4357
20
+ from pyasn1_modules import rfc5280
21
+
22
+
23
+ # Imports from RFC 4357
24
+
25
+ id_CryptoPro_algorithms = rfc4357.id_CryptoPro_algorithms
26
+
27
+ id_GostR3410_94 = rfc4357.id_GostR3410_94
28
+
29
+ id_GostR3410_2001 = rfc4357.id_GostR3410_2001
30
+
31
+ Gost28147_89_ParamSet = rfc4357.Gost28147_89_ParamSet
32
+
33
+ Gost28147_89_EncryptedKey = rfc4357.Gost28147_89_EncryptedKey
34
+
35
+ GostR3410_94_PublicKeyParameters = rfc4357.GostR3410_94_PublicKeyParameters
36
+
37
+ GostR3410_2001_PublicKeyParameters = rfc4357.GostR3410_2001_PublicKeyParameters
38
+
39
+
40
+ # Imports from RFC 5280
41
+
42
+ SubjectPublicKeyInfo = rfc5280.SubjectPublicKeyInfo
43
+
44
+
45
+ # CMS/PKCS#7 key agreement algorithms & parameters
46
+
47
+ class Gost28147_89_KeyWrapParameters(univ.Sequence):
48
+ componentType = namedtype.NamedTypes(
49
+ namedtype.NamedType('encryptionParamSet', Gost28147_89_ParamSet()),
50
+ namedtype.OptionalNamedType('ukm', univ.OctetString().subtype(
51
+ subtypeSpec=constraint.ValueSizeConstraint(8, 8)))
52
+ )
53
+
54
+
55
+ id_Gost28147_89_CryptoPro_KeyWrap = id_CryptoPro_algorithms + (13, 1, )
56
+
57
+
58
+ id_Gost28147_89_None_KeyWrap = id_CryptoPro_algorithms + (13, 0, )
59
+
60
+
61
+ id_GostR3410_2001_CryptoPro_ESDH = id_CryptoPro_algorithms + (96, )
62
+
63
+
64
+ id_GostR3410_94_CryptoPro_ESDH = id_CryptoPro_algorithms + (97, )
65
+
66
+
67
+ # CMS/PKCS#7 key transport algorithms & parameters
68
+
69
+ id_GostR3410_2001_KeyTransportSMIMECapability = id_GostR3410_2001
70
+
71
+
72
+ id_GostR3410_94_KeyTransportSMIMECapability = id_GostR3410_94
73
+
74
+
75
+ class GostR3410_TransportParameters(univ.Sequence):
76
+ componentType = namedtype.NamedTypes(
77
+ namedtype.NamedType('encryptionParamSet', Gost28147_89_ParamSet()),
78
+ namedtype.OptionalNamedType('ephemeralPublicKey',
79
+ SubjectPublicKeyInfo().subtype(implicitTag=tag.Tag(
80
+ tag.tagClassContext, tag.tagFormatSimple, 0))),
81
+ namedtype.NamedType('ukm', univ.OctetString().subtype(
82
+ subtypeSpec=constraint.ValueSizeConstraint(8, 8)))
83
+ )
84
+
85
+ class GostR3410_KeyTransport(univ.Sequence):
86
+ componentType = namedtype.NamedTypes(
87
+ namedtype.NamedType('sessionEncryptedKey', Gost28147_89_EncryptedKey()),
88
+ namedtype.OptionalNamedType('transportParameters',
89
+ GostR3410_TransportParameters().subtype(implicitTag=tag.Tag(
90
+ tag.tagClassContext, tag.tagFormatConstructed, 0)))
91
+ )
92
+
93
+
94
+ # GOST R 34.10-94 signature algorithm & parameters
95
+
96
+ class GostR3410_94_Signature(univ.OctetString):
97
+ subtypeSpec = constraint.ValueSizeConstraint(64, 64)
98
+
99
+
100
+ # GOST R 34.10-2001 signature algorithms and parameters
101
+
102
+ class GostR3410_2001_Signature(univ.OctetString):
103
+ subtypeSpec = constraint.ValueSizeConstraint(64, 64)
104
+
105
+
106
+ # Update the Algorithm Identifier map in rfc5280.py
107
+
108
+ _algorithmIdentifierMapUpdate = {
109
+ id_Gost28147_89_CryptoPro_KeyWrap: Gost28147_89_KeyWrapParameters(),
110
+ id_Gost28147_89_None_KeyWrap: Gost28147_89_KeyWrapParameters(),
111
+ }
112
+
113
+ rfc5280.algorithmIdentifierMap.update(_algorithmIdentifierMapUpdate)
evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc5035.py ADDED
@@ -0,0 +1,199 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #
2
+ # This file is part of pyasn1-modules software.
3
+ #
4
+ # Created by Russ Housley with assistance from asn1ate v.0.6.0.
5
+ # Modified by Russ Housley to add a map for use with opentypes.
6
+ #
7
+ # Copyright (c) 2019, Vigil Security, LLC
8
+ # License: http://snmplabs.com/pyasn1/license.html
9
+ #
10
+ # Update to Enhanced Security Services for S/MIME
11
+ #
12
+ # ASN.1 source from:
13
+ # https://www.rfc-editor.org/rfc/rfc5035.txt
14
+ #
15
+
16
+ from pyasn1.codec.der.encoder import encode as der_encode
17
+
18
+ from pyasn1.type import namedtype
19
+ from pyasn1.type import univ
20
+
21
+ from pyasn1_modules import rfc2634
22
+ from pyasn1_modules import rfc4055
23
+ from pyasn1_modules import rfc5652
24
+ from pyasn1_modules import rfc5280
25
+
26
+ ContentType = rfc5652.ContentType
27
+
28
+ IssuerAndSerialNumber = rfc5652.IssuerAndSerialNumber
29
+
30
+ SubjectKeyIdentifier = rfc5652.SubjectKeyIdentifier
31
+
32
+ AlgorithmIdentifier = rfc5280.AlgorithmIdentifier
33
+
34
+ PolicyInformation = rfc5280.PolicyInformation
35
+
36
+ GeneralNames = rfc5280.GeneralNames
37
+
38
+ CertificateSerialNumber = rfc5280.CertificateSerialNumber
39
+
40
+
41
+ # Signing Certificate Attribute V1 and V2
42
+
43
+ id_aa_signingCertificate = rfc2634.id_aa_signingCertificate
44
+
45
+ id_aa_signingCertificateV2 = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.47')
46
+
47
+ Hash = rfc2634.Hash
48
+
49
+ IssuerSerial = rfc2634.IssuerSerial
50
+
51
+ ESSCertID = rfc2634.ESSCertID
52
+
53
+ SigningCertificate = rfc2634.SigningCertificate
54
+
55
+
56
+ sha256AlgId = AlgorithmIdentifier()
57
+ sha256AlgId['algorithm'] = rfc4055.id_sha256
58
+ # A non-schema object for sha256AlgId['parameters'] as absent
59
+ sha256AlgId['parameters'] = der_encode(univ.OctetString(''))
60
+
61
+
62
+ class ESSCertIDv2(univ.Sequence):
63
+ pass
64
+
65
+ ESSCertIDv2.componentType = namedtype.NamedTypes(
66
+ namedtype.DefaultedNamedType('hashAlgorithm', sha256AlgId),
67
+ namedtype.NamedType('certHash', Hash()),
68
+ namedtype.OptionalNamedType('issuerSerial', IssuerSerial())
69
+ )
70
+
71
+
72
+ class SigningCertificateV2(univ.Sequence):
73
+ pass
74
+
75
+ SigningCertificateV2.componentType = namedtype.NamedTypes(
76
+ namedtype.NamedType('certs', univ.SequenceOf(
77
+ componentType=ESSCertIDv2())),
78
+ namedtype.OptionalNamedType('policies', univ.SequenceOf(
79
+ componentType=PolicyInformation()))
80
+ )
81
+
82
+
83
+ # Mail List Expansion History Attribute
84
+
85
+ id_aa_mlExpandHistory = rfc2634.id_aa_mlExpandHistory
86
+
87
+ ub_ml_expansion_history = rfc2634.ub_ml_expansion_history
88
+
89
+ EntityIdentifier = rfc2634.EntityIdentifier
90
+
91
+ MLReceiptPolicy = rfc2634.MLReceiptPolicy
92
+
93
+ MLData = rfc2634.MLData
94
+
95
+ MLExpansionHistory = rfc2634.MLExpansionHistory
96
+
97
+
98
+ # ESS Security Label Attribute
99
+
100
+ id_aa_securityLabel = rfc2634.id_aa_securityLabel
101
+
102
+ ub_privacy_mark_length = rfc2634.ub_privacy_mark_length
103
+
104
+ ub_security_categories = rfc2634.ub_security_categories
105
+
106
+ ub_integer_options = rfc2634.ub_integer_options
107
+
108
+ ESSPrivacyMark = rfc2634.ESSPrivacyMark
109
+
110
+ SecurityClassification = rfc2634.SecurityClassification
111
+
112
+ SecurityPolicyIdentifier = rfc2634.SecurityPolicyIdentifier
113
+
114
+ SecurityCategory = rfc2634.SecurityCategory
115
+
116
+ SecurityCategories = rfc2634.SecurityCategories
117
+
118
+ ESSSecurityLabel = rfc2634.ESSSecurityLabel
119
+
120
+
121
+ # Equivalent Labels Attribute
122
+
123
+ id_aa_equivalentLabels = rfc2634.id_aa_equivalentLabels
124
+
125
+ EquivalentLabels = rfc2634.EquivalentLabels
126
+
127
+
128
+ # Content Identifier Attribute
129
+
130
+ id_aa_contentIdentifier = rfc2634.id_aa_contentIdentifier
131
+
132
+ ContentIdentifier = rfc2634.ContentIdentifier
133
+
134
+
135
+ # Content Reference Attribute
136
+
137
+ id_aa_contentReference = rfc2634.id_aa_contentReference
138
+
139
+ ContentReference = rfc2634.ContentReference
140
+
141
+
142
+ # Message Signature Digest Attribute
143
+
144
+ id_aa_msgSigDigest = rfc2634.id_aa_msgSigDigest
145
+
146
+ MsgSigDigest = rfc2634.MsgSigDigest
147
+
148
+
149
+ # Content Hints Attribute
150
+
151
+ id_aa_contentHint = rfc2634.id_aa_contentHint
152
+
153
+ ContentHints = rfc2634.ContentHints
154
+
155
+
156
+ # Receipt Request Attribute
157
+
158
+ AllOrFirstTier = rfc2634.AllOrFirstTier
159
+
160
+ ReceiptsFrom = rfc2634.ReceiptsFrom
161
+
162
+ id_aa_receiptRequest = rfc2634.id_aa_receiptRequest
163
+
164
+ ub_receiptsTo = rfc2634.ub_receiptsTo
165
+
166
+ ReceiptRequest = rfc2634.ReceiptRequest
167
+
168
+
169
+ # Receipt Content Type
170
+
171
+ ESSVersion = rfc2634.ESSVersion
172
+
173
+ id_ct_receipt = rfc2634.id_ct_receipt
174
+
175
+ Receipt = rfc2634.Receipt
176
+
177
+ ub_receiptsTo = rfc2634.ub_receiptsTo
178
+
179
+ ReceiptRequest = rfc2634.ReceiptRequest
180
+
181
+
182
+ # Map of Attribute Type to the Attribute structure is added to the
183
+ # ones that are in rfc5652.py
184
+
185
+ _cmsAttributesMapUpdate = {
186
+ id_aa_signingCertificateV2: SigningCertificateV2(),
187
+ }
188
+
189
+ rfc5652.cmsAttributesMap.update(_cmsAttributesMapUpdate)
190
+
191
+
192
+ # Map of Content Type OIDs to Content Types is added to the
193
+ # ones that are in rfc5652.py
194
+
195
+ _cmsContentTypesMapUpdate = {
196
+ id_ct_receipt: Receipt(),
197
+ }
198
+
199
+ rfc5652.cmsContentTypesMap.update(_cmsContentTypesMapUpdate)
evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc5083.py ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This file is being contributed to of pyasn1-modules software.
2
+ #
3
+ # Created by Russ Housley without assistance from the asn1ate tool.
4
+ # Modified by Russ Housley to add a map for use with opentypes and
5
+ # simplify the code for the object identifier assignment.
6
+ #
7
+ # Copyright (c) 2018, 2019 Vigil Security, LLC
8
+ # License: http://snmplabs.com/pyasn1/license.html
9
+ #
10
+ # Authenticated-Enveloped-Data for the Cryptographic Message Syntax (CMS)
11
+ #
12
+ # ASN.1 source from:
13
+ # https://www.rfc-editor.org/rfc/rfc5083.txt
14
+
15
+ from pyasn1.type import namedtype
16
+ from pyasn1.type import tag
17
+ from pyasn1.type import univ
18
+
19
+ from pyasn1_modules import rfc5652
20
+
21
+ MAX = float('inf')
22
+
23
+
24
+ # CMS Authenticated-Enveloped-Data Content Type
25
+
26
+ id_ct_authEnvelopedData = univ.ObjectIdentifier('1.2.840.113549.1.9.16.1.23')
27
+
28
+ class AuthEnvelopedData(univ.Sequence):
29
+ pass
30
+
31
+ AuthEnvelopedData.componentType = namedtype.NamedTypes(
32
+ namedtype.NamedType('version', rfc5652.CMSVersion()),
33
+ namedtype.OptionalNamedType('originatorInfo', rfc5652.OriginatorInfo().subtype(
34
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
35
+ namedtype.NamedType('recipientInfos', rfc5652.RecipientInfos()),
36
+ namedtype.NamedType('authEncryptedContentInfo', rfc5652.EncryptedContentInfo()),
37
+ namedtype.OptionalNamedType('authAttrs', rfc5652.AuthAttributes().subtype(
38
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
39
+ namedtype.NamedType('mac', rfc5652.MessageAuthenticationCode()),
40
+ namedtype.OptionalNamedType('unauthAttrs', rfc5652.UnauthAttributes().subtype(
41
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2)))
42
+ )
43
+
44
+
45
+ # Map of Content Type OIDs to Content Types is added to the
46
+ # ones that are in rfc5652.py
47
+
48
+ _cmsContentTypesMapUpdate = {
49
+ id_ct_authEnvelopedData: AuthEnvelopedData(),
50
+ }
51
+
52
+ rfc5652.cmsContentTypesMap.update(_cmsContentTypesMapUpdate)
evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc5280.py ADDED
@@ -0,0 +1,1658 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding: utf-8
2
+ #
3
+ # This file is part of pyasn1-modules software.
4
+ #
5
+ # Created by Stanisław Pitucha with asn1ate tool.
6
+ # Updated by Russ Housley for ORAddress Extension Attribute opentype support.
7
+ # Updated by Russ Housley for AlgorithmIdentifier opentype support.
8
+ #
9
+ # Copyright (c) 2005-2020, Ilya Etingof <etingof@gmail.com>
10
+ # License: http://snmplabs.com/pyasn1/license.html
11
+ #
12
+ # Internet X.509 Public Key Infrastructure Certificate and Certificate
13
+ # Revocation List (CRL) Profile
14
+ #
15
+ # ASN.1 source from:
16
+ # https://www.rfc-editor.org/rfc/rfc5280.txt
17
+ #
18
+ from pyasn1.type import char
19
+ from pyasn1.type import constraint
20
+ from pyasn1.type import namedtype
21
+ from pyasn1.type import namedval
22
+ from pyasn1.type import opentype
23
+ from pyasn1.type import tag
24
+ from pyasn1.type import univ
25
+ from pyasn1.type import useful
26
+
27
+ MAX = float('inf')
28
+
29
+
30
+ def _buildOid(*components):
31
+ output = []
32
+ for x in tuple(components):
33
+ if isinstance(x, univ.ObjectIdentifier):
34
+ output.extend(list(x))
35
+ else:
36
+ output.append(int(x))
37
+
38
+ return univ.ObjectIdentifier(output)
39
+
40
+
41
+ ub_e163_4_sub_address_length = univ.Integer(40)
42
+
43
+ ub_e163_4_number_length = univ.Integer(15)
44
+
45
+ unformatted_postal_address = univ.Integer(16)
46
+
47
+
48
+ class TerminalType(univ.Integer):
49
+ pass
50
+
51
+
52
+ TerminalType.namedValues = namedval.NamedValues(
53
+ ('telex', 3),
54
+ ('teletex', 4),
55
+ ('g3-facsimile', 5),
56
+ ('g4-facsimile', 6),
57
+ ('ia5-terminal', 7),
58
+ ('videotex', 8)
59
+ )
60
+
61
+
62
+ class Extension(univ.Sequence):
63
+ pass
64
+
65
+
66
+ Extension.componentType = namedtype.NamedTypes(
67
+ namedtype.NamedType('extnID', univ.ObjectIdentifier()),
68
+ namedtype.DefaultedNamedType('critical', univ.Boolean().subtype(value=0)),
69
+ namedtype.NamedType('extnValue', univ.OctetString())
70
+ )
71
+
72
+
73
+ class Extensions(univ.SequenceOf):
74
+ pass
75
+
76
+
77
+ Extensions.componentType = Extension()
78
+ Extensions.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
79
+
80
+ physical_delivery_personal_name = univ.Integer(13)
81
+
82
+ ub_unformatted_address_length = univ.Integer(180)
83
+
84
+ ub_pds_parameter_length = univ.Integer(30)
85
+
86
+ ub_pds_physical_address_lines = univ.Integer(6)
87
+
88
+
89
+ class UnformattedPostalAddress(univ.Set):
90
+ pass
91
+
92
+
93
+ UnformattedPostalAddress.componentType = namedtype.NamedTypes(
94
+ namedtype.OptionalNamedType('printable-address', univ.SequenceOf(componentType=char.PrintableString().subtype(
95
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_pds_parameter_length)))),
96
+ namedtype.OptionalNamedType('teletex-string', char.TeletexString().subtype(
97
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_unformatted_address_length)))
98
+ )
99
+
100
+ ub_organization_name = univ.Integer(64)
101
+
102
+
103
+ class X520OrganizationName(univ.Choice):
104
+ pass
105
+
106
+
107
+ X520OrganizationName.componentType = namedtype.NamedTypes(
108
+ namedtype.NamedType('teletexString', char.TeletexString().subtype(
109
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_organization_name))),
110
+ namedtype.NamedType('printableString', char.PrintableString().subtype(
111
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_organization_name))),
112
+ namedtype.NamedType('universalString', char.UniversalString().subtype(
113
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_organization_name))),
114
+ namedtype.NamedType('utf8String',
115
+ char.UTF8String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_organization_name))),
116
+ namedtype.NamedType('bmpString',
117
+ char.BMPString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_organization_name)))
118
+ )
119
+
120
+ ub_x121_address_length = univ.Integer(16)
121
+
122
+ pds_name = univ.Integer(7)
123
+
124
+ id_pkix = _buildOid(1, 3, 6, 1, 5, 5, 7)
125
+
126
+ id_kp = _buildOid(id_pkix, 3)
127
+
128
+ ub_postal_code_length = univ.Integer(16)
129
+
130
+
131
+ class PostalCode(univ.Choice):
132
+ pass
133
+
134
+
135
+ PostalCode.componentType = namedtype.NamedTypes(
136
+ namedtype.NamedType('numeric-code', char.NumericString().subtype(
137
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_postal_code_length))),
138
+ namedtype.NamedType('printable-code', char.PrintableString().subtype(
139
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_postal_code_length)))
140
+ )
141
+
142
+ ub_generation_qualifier_length = univ.Integer(3)
143
+
144
+ unique_postal_name = univ.Integer(20)
145
+
146
+
147
+ class DomainComponent(char.IA5String):
148
+ pass
149
+
150
+
151
+ ub_domain_defined_attribute_value_length = univ.Integer(128)
152
+
153
+ ub_match = univ.Integer(128)
154
+
155
+ id_at = _buildOid(2, 5, 4)
156
+
157
+
158
+ class AttributeType(univ.ObjectIdentifier):
159
+ pass
160
+
161
+
162
+ id_at_organizationalUnitName = _buildOid(id_at, 11)
163
+
164
+ terminal_type = univ.Integer(23)
165
+
166
+
167
+ class PDSParameter(univ.Set):
168
+ pass
169
+
170
+
171
+ PDSParameter.componentType = namedtype.NamedTypes(
172
+ namedtype.OptionalNamedType('printable-string', char.PrintableString().subtype(
173
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_pds_parameter_length))),
174
+ namedtype.OptionalNamedType('teletex-string', char.TeletexString().subtype(
175
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_pds_parameter_length)))
176
+ )
177
+
178
+
179
+ class PhysicalDeliveryPersonalName(PDSParameter):
180
+ pass
181
+
182
+
183
+ ub_surname_length = univ.Integer(40)
184
+
185
+ id_ad = _buildOid(id_pkix, 48)
186
+
187
+ ub_domain_defined_attribute_type_length = univ.Integer(8)
188
+
189
+
190
+ class TeletexDomainDefinedAttribute(univ.Sequence):
191
+ pass
192
+
193
+
194
+ TeletexDomainDefinedAttribute.componentType = namedtype.NamedTypes(
195
+ namedtype.NamedType('type', char.TeletexString().subtype(
196
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_domain_defined_attribute_type_length))),
197
+ namedtype.NamedType('value', char.TeletexString().subtype(
198
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_domain_defined_attribute_value_length)))
199
+ )
200
+
201
+ ub_domain_defined_attributes = univ.Integer(4)
202
+
203
+
204
+ class TeletexDomainDefinedAttributes(univ.SequenceOf):
205
+ pass
206
+
207
+
208
+ TeletexDomainDefinedAttributes.componentType = TeletexDomainDefinedAttribute()
209
+ TeletexDomainDefinedAttributes.sizeSpec = constraint.ValueSizeConstraint(1, ub_domain_defined_attributes)
210
+
211
+ extended_network_address = univ.Integer(22)
212
+
213
+ ub_locality_name = univ.Integer(128)
214
+
215
+
216
+ class X520LocalityName(univ.Choice):
217
+ pass
218
+
219
+
220
+ X520LocalityName.componentType = namedtype.NamedTypes(
221
+ namedtype.NamedType('teletexString',
222
+ char.TeletexString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_locality_name))),
223
+ namedtype.NamedType('printableString', char.PrintableString().subtype(
224
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_locality_name))),
225
+ namedtype.NamedType('universalString', char.UniversalString().subtype(
226
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_locality_name))),
227
+ namedtype.NamedType('utf8String',
228
+ char.UTF8String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_locality_name))),
229
+ namedtype.NamedType('bmpString',
230
+ char.BMPString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_locality_name)))
231
+ )
232
+
233
+ teletex_organization_name = univ.Integer(3)
234
+
235
+ ub_given_name_length = univ.Integer(16)
236
+
237
+ ub_initials_length = univ.Integer(5)
238
+
239
+
240
+ class PersonalName(univ.Set):
241
+ pass
242
+
243
+
244
+ PersonalName.componentType = namedtype.NamedTypes(
245
+ namedtype.NamedType('surname', char.PrintableString().subtype(
246
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_surname_length)).subtype(
247
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
248
+ namedtype.OptionalNamedType('given-name', char.PrintableString().subtype(
249
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_given_name_length)).subtype(
250
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
251
+ namedtype.OptionalNamedType('initials', char.PrintableString().subtype(
252
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_initials_length)).subtype(
253
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
254
+ namedtype.OptionalNamedType('generation-qualifier', char.PrintableString().subtype(
255
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_generation_qualifier_length)).subtype(
256
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3)))
257
+ )
258
+
259
+ ub_organizational_unit_name_length = univ.Integer(32)
260
+
261
+
262
+ class OrganizationalUnitName(char.PrintableString):
263
+ pass
264
+
265
+
266
+ OrganizationalUnitName.subtypeSpec = constraint.ValueSizeConstraint(1, ub_organizational_unit_name_length)
267
+
268
+ id_at_generationQualifier = _buildOid(id_at, 44)
269
+
270
+
271
+ class Version(univ.Integer):
272
+ pass
273
+
274
+
275
+ Version.namedValues = namedval.NamedValues(
276
+ ('v1', 0),
277
+ ('v2', 1),
278
+ ('v3', 2)
279
+ )
280
+
281
+
282
+ class CertificateSerialNumber(univ.Integer):
283
+ pass
284
+
285
+
286
+ algorithmIdentifierMap = {}
287
+
288
+
289
+ class AlgorithmIdentifier(univ.Sequence):
290
+ componentType = namedtype.NamedTypes(
291
+ namedtype.NamedType('algorithm', univ.ObjectIdentifier()),
292
+ namedtype.OptionalNamedType('parameters', univ.Any(),
293
+ openType=opentype.OpenType('algorithm', algorithmIdentifierMap)
294
+ )
295
+ )
296
+
297
+
298
+ class Time(univ.Choice):
299
+ pass
300
+
301
+
302
+ Time.componentType = namedtype.NamedTypes(
303
+ namedtype.NamedType('utcTime', useful.UTCTime()),
304
+ namedtype.NamedType('generalTime', useful.GeneralizedTime())
305
+ )
306
+
307
+
308
+ class AttributeValue(univ.Any):
309
+ pass
310
+
311
+
312
+ certificateAttributesMap = {}
313
+
314
+
315
+ class AttributeTypeAndValue(univ.Sequence):
316
+ componentType = namedtype.NamedTypes(
317
+ namedtype.NamedType('type', AttributeType()),
318
+ namedtype.NamedType(
319
+ 'value', AttributeValue(),
320
+ openType=opentype.OpenType('type', certificateAttributesMap)
321
+ )
322
+ )
323
+
324
+
325
+ class RelativeDistinguishedName(univ.SetOf):
326
+ pass
327
+
328
+
329
+ RelativeDistinguishedName.componentType = AttributeTypeAndValue()
330
+ RelativeDistinguishedName.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
331
+
332
+
333
+ class RDNSequence(univ.SequenceOf):
334
+ pass
335
+
336
+
337
+ RDNSequence.componentType = RelativeDistinguishedName()
338
+
339
+
340
+ class Name(univ.Choice):
341
+ pass
342
+
343
+
344
+ Name.componentType = namedtype.NamedTypes(
345
+ namedtype.NamedType('rdnSequence', RDNSequence())
346
+ )
347
+
348
+
349
+ class TBSCertList(univ.Sequence):
350
+ pass
351
+
352
+
353
+ TBSCertList.componentType = namedtype.NamedTypes(
354
+ namedtype.OptionalNamedType('version', Version()),
355
+ namedtype.NamedType('signature', AlgorithmIdentifier()),
356
+ namedtype.NamedType('issuer', Name()),
357
+ namedtype.NamedType('thisUpdate', Time()),
358
+ namedtype.OptionalNamedType('nextUpdate', Time()),
359
+ namedtype.OptionalNamedType(
360
+ 'revokedCertificates', univ.SequenceOf(
361
+ componentType=univ.Sequence(
362
+ componentType=namedtype.NamedTypes(
363
+ namedtype.NamedType('userCertificate', CertificateSerialNumber()),
364
+ namedtype.NamedType('revocationDate', Time()),
365
+ namedtype.OptionalNamedType('crlEntryExtensions', Extensions())
366
+ )
367
+ )
368
+ )
369
+ ),
370
+ namedtype.OptionalNamedType(
371
+ 'crlExtensions', Extensions().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)))
372
+ )
373
+
374
+
375
+ class CertificateList(univ.Sequence):
376
+ pass
377
+
378
+
379
+ CertificateList.componentType = namedtype.NamedTypes(
380
+ namedtype.NamedType('tbsCertList', TBSCertList()),
381
+ namedtype.NamedType('signatureAlgorithm', AlgorithmIdentifier()),
382
+ namedtype.NamedType('signature', univ.BitString())
383
+ )
384
+
385
+
386
+ class PhysicalDeliveryOfficeName(PDSParameter):
387
+ pass
388
+
389
+
390
+ ub_extension_attributes = univ.Integer(256)
391
+
392
+ certificateExtensionsMap = {
393
+ }
394
+
395
+ oraddressExtensionAttributeMap = {
396
+ }
397
+
398
+
399
+ class ExtensionAttribute(univ.Sequence):
400
+ componentType = namedtype.NamedTypes(
401
+ namedtype.NamedType(
402
+ 'extension-attribute-type',
403
+ univ.Integer().subtype(subtypeSpec=constraint.ValueRangeConstraint(0, ub_extension_attributes)).subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
404
+ namedtype.NamedType(
405
+ 'extension-attribute-value',
406
+ univ.Any().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)),
407
+ openType=opentype.OpenType('extension-attribute-type', oraddressExtensionAttributeMap))
408
+ )
409
+
410
+ id_qt = _buildOid(id_pkix, 2)
411
+
412
+ id_qt_cps = _buildOid(id_qt, 1)
413
+
414
+ id_at_stateOrProvinceName = _buildOid(id_at, 8)
415
+
416
+ id_at_title = _buildOid(id_at, 12)
417
+
418
+ id_at_serialNumber = _buildOid(id_at, 5)
419
+
420
+
421
+ class X520dnQualifier(char.PrintableString):
422
+ pass
423
+
424
+
425
+ class PosteRestanteAddress(PDSParameter):
426
+ pass
427
+
428
+
429
+ poste_restante_address = univ.Integer(19)
430
+
431
+
432
+ class UniqueIdentifier(univ.BitString):
433
+ pass
434
+
435
+
436
+ class Validity(univ.Sequence):
437
+ pass
438
+
439
+
440
+ Validity.componentType = namedtype.NamedTypes(
441
+ namedtype.NamedType('notBefore', Time()),
442
+ namedtype.NamedType('notAfter', Time())
443
+ )
444
+
445
+
446
+ class SubjectPublicKeyInfo(univ.Sequence):
447
+ pass
448
+
449
+
450
+ SubjectPublicKeyInfo.componentType = namedtype.NamedTypes(
451
+ namedtype.NamedType('algorithm', AlgorithmIdentifier()),
452
+ namedtype.NamedType('subjectPublicKey', univ.BitString())
453
+ )
454
+
455
+
456
+ class TBSCertificate(univ.Sequence):
457
+ pass
458
+
459
+
460
+ TBSCertificate.componentType = namedtype.NamedTypes(
461
+ namedtype.DefaultedNamedType('version',
462
+ Version().subtype(explicitTag=tag.Tag(tag.tagClassContext,
463
+ tag.tagFormatSimple, 0)).subtype(value="v1")),
464
+ namedtype.NamedType('serialNumber', CertificateSerialNumber()),
465
+ namedtype.NamedType('signature', AlgorithmIdentifier()),
466
+ namedtype.NamedType('issuer', Name()),
467
+ namedtype.NamedType('validity', Validity()),
468
+ namedtype.NamedType('subject', Name()),
469
+ namedtype.NamedType('subjectPublicKeyInfo', SubjectPublicKeyInfo()),
470
+ namedtype.OptionalNamedType('issuerUniqueID', UniqueIdentifier().subtype(
471
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
472
+ namedtype.OptionalNamedType('subjectUniqueID', UniqueIdentifier().subtype(
473
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
474
+ namedtype.OptionalNamedType('extensions',
475
+ Extensions().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3)))
476
+ )
477
+
478
+ physical_delivery_office_name = univ.Integer(10)
479
+
480
+ ub_name = univ.Integer(32768)
481
+
482
+
483
+ class X520name(univ.Choice):
484
+ pass
485
+
486
+
487
+ X520name.componentType = namedtype.NamedTypes(
488
+ namedtype.NamedType('teletexString',
489
+ char.TeletexString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_name))),
490
+ namedtype.NamedType('printableString',
491
+ char.PrintableString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_name))),
492
+ namedtype.NamedType('universalString',
493
+ char.UniversalString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_name))),
494
+ namedtype.NamedType('utf8String',
495
+ char.UTF8String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_name))),
496
+ namedtype.NamedType('bmpString', char.BMPString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_name)))
497
+ )
498
+
499
+ id_at_dnQualifier = _buildOid(id_at, 46)
500
+
501
+ ub_serial_number = univ.Integer(64)
502
+
503
+ ub_pseudonym = univ.Integer(128)
504
+
505
+ pkcs_9 = _buildOid(1, 2, 840, 113549, 1, 9)
506
+
507
+
508
+ class X121Address(char.NumericString):
509
+ pass
510
+
511
+
512
+ X121Address.subtypeSpec = constraint.ValueSizeConstraint(1, ub_x121_address_length)
513
+
514
+
515
+ class NetworkAddress(X121Address):
516
+ pass
517
+
518
+
519
+ ub_integer_options = univ.Integer(256)
520
+
521
+ id_at_commonName = _buildOid(id_at, 3)
522
+
523
+ ub_organization_name_length = univ.Integer(64)
524
+
525
+ id_ad_ocsp = _buildOid(id_ad, 1)
526
+
527
+ ub_country_name_numeric_length = univ.Integer(3)
528
+
529
+ ub_country_name_alpha_length = univ.Integer(2)
530
+
531
+
532
+ class PhysicalDeliveryCountryName(univ.Choice):
533
+ pass
534
+
535
+
536
+ PhysicalDeliveryCountryName.componentType = namedtype.NamedTypes(
537
+ namedtype.NamedType('x121-dcc-code', char.NumericString().subtype(
538
+ subtypeSpec=constraint.ValueSizeConstraint(ub_country_name_numeric_length, ub_country_name_numeric_length))),
539
+ namedtype.NamedType('iso-3166-alpha2-code', char.PrintableString().subtype(
540
+ subtypeSpec=constraint.ValueSizeConstraint(ub_country_name_alpha_length, ub_country_name_alpha_length)))
541
+ )
542
+
543
+ id_emailAddress = _buildOid(pkcs_9, 1)
544
+
545
+ common_name = univ.Integer(1)
546
+
547
+
548
+ class X520Pseudonym(univ.Choice):
549
+ pass
550
+
551
+
552
+ X520Pseudonym.componentType = namedtype.NamedTypes(
553
+ namedtype.NamedType('teletexString',
554
+ char.TeletexString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_pseudonym))),
555
+ namedtype.NamedType('printableString',
556
+ char.PrintableString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_pseudonym))),
557
+ namedtype.NamedType('universalString',
558
+ char.UniversalString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_pseudonym))),
559
+ namedtype.NamedType('utf8String',
560
+ char.UTF8String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_pseudonym))),
561
+ namedtype.NamedType('bmpString',
562
+ char.BMPString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_pseudonym)))
563
+ )
564
+
565
+ ub_domain_name_length = univ.Integer(16)
566
+
567
+
568
+ class AdministrationDomainName(univ.Choice):
569
+ pass
570
+
571
+
572
+ AdministrationDomainName.tagSet = univ.Choice.tagSet.tagExplicitly(
573
+ tag.Tag(tag.tagClassApplication, tag.tagFormatConstructed, 2))
574
+ AdministrationDomainName.componentType = namedtype.NamedTypes(
575
+ namedtype.NamedType('numeric', char.NumericString().subtype(
576
+ subtypeSpec=constraint.ValueSizeConstraint(0, ub_domain_name_length))),
577
+ namedtype.NamedType('printable', char.PrintableString().subtype(
578
+ subtypeSpec=constraint.ValueSizeConstraint(0, ub_domain_name_length)))
579
+ )
580
+
581
+
582
+ class PresentationAddress(univ.Sequence):
583
+ pass
584
+
585
+
586
+ PresentationAddress.componentType = namedtype.NamedTypes(
587
+ namedtype.OptionalNamedType('pSelector', univ.OctetString().subtype(
588
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
589
+ namedtype.OptionalNamedType('sSelector', univ.OctetString().subtype(
590
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
591
+ namedtype.OptionalNamedType('tSelector', univ.OctetString().subtype(
592
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
593
+ namedtype.NamedType('nAddresses', univ.SetOf(componentType=univ.OctetString()).subtype(
594
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3)))
595
+ )
596
+
597
+
598
+ class ExtendedNetworkAddress(univ.Choice):
599
+ pass
600
+
601
+
602
+ ExtendedNetworkAddress.componentType = namedtype.NamedTypes(
603
+ namedtype.NamedType(
604
+ 'e163-4-address', univ.Sequence(
605
+ componentType=namedtype.NamedTypes(
606
+ namedtype.NamedType('number', char.NumericString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_e163_4_number_length)).subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
607
+ namedtype.OptionalNamedType('sub-address', char.NumericString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_e163_4_sub_address_length)).subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
608
+ )
609
+ )
610
+ ),
611
+ namedtype.NamedType('psap-address', PresentationAddress().subtype(
612
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0)))
613
+ )
614
+
615
+
616
+ class TeletexOrganizationName(char.TeletexString):
617
+ pass
618
+
619
+
620
+ TeletexOrganizationName.subtypeSpec = constraint.ValueSizeConstraint(1, ub_organization_name_length)
621
+
622
+ ub_terminal_id_length = univ.Integer(24)
623
+
624
+
625
+ class TerminalIdentifier(char.PrintableString):
626
+ pass
627
+
628
+
629
+ TerminalIdentifier.subtypeSpec = constraint.ValueSizeConstraint(1, ub_terminal_id_length)
630
+
631
+ id_ad_caIssuers = _buildOid(id_ad, 2)
632
+
633
+ id_at_countryName = _buildOid(id_at, 6)
634
+
635
+
636
+ class StreetAddress(PDSParameter):
637
+ pass
638
+
639
+
640
+ postal_code = univ.Integer(9)
641
+
642
+ id_at_givenName = _buildOid(id_at, 42)
643
+
644
+ ub_title = univ.Integer(64)
645
+
646
+
647
+ class ExtensionAttributes(univ.SetOf):
648
+ pass
649
+
650
+
651
+ ExtensionAttributes.componentType = ExtensionAttribute()
652
+ ExtensionAttributes.sizeSpec = constraint.ValueSizeConstraint(1, ub_extension_attributes)
653
+
654
+ ub_emailaddress_length = univ.Integer(255)
655
+
656
+ id_ad_caRepository = _buildOid(id_ad, 5)
657
+
658
+
659
+ class ExtensionORAddressComponents(PDSParameter):
660
+ pass
661
+
662
+
663
+ ub_organizational_unit_name = univ.Integer(64)
664
+
665
+
666
+ class X520OrganizationalUnitName(univ.Choice):
667
+ pass
668
+
669
+
670
+ X520OrganizationalUnitName.componentType = namedtype.NamedTypes(
671
+ namedtype.NamedType('teletexString', char.TeletexString().subtype(
672
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_organizational_unit_name))),
673
+ namedtype.NamedType('printableString', char.PrintableString().subtype(
674
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_organizational_unit_name))),
675
+ namedtype.NamedType('universalString', char.UniversalString().subtype(
676
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_organizational_unit_name))),
677
+ namedtype.NamedType('utf8String', char.UTF8String().subtype(
678
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_organizational_unit_name))),
679
+ namedtype.NamedType('bmpString', char.BMPString().subtype(
680
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_organizational_unit_name)))
681
+ )
682
+
683
+
684
+ class LocalPostalAttributes(PDSParameter):
685
+ pass
686
+
687
+
688
+ teletex_organizational_unit_names = univ.Integer(5)
689
+
690
+
691
+ class X520Title(univ.Choice):
692
+ pass
693
+
694
+
695
+ X520Title.componentType = namedtype.NamedTypes(
696
+ namedtype.NamedType('teletexString',
697
+ char.TeletexString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_title))),
698
+ namedtype.NamedType('printableString',
699
+ char.PrintableString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_title))),
700
+ namedtype.NamedType('universalString',
701
+ char.UniversalString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_title))),
702
+ namedtype.NamedType('utf8String',
703
+ char.UTF8String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_title))),
704
+ namedtype.NamedType('bmpString', char.BMPString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_title)))
705
+ )
706
+
707
+ id_at_localityName = _buildOid(id_at, 7)
708
+
709
+ id_at_initials = _buildOid(id_at, 43)
710
+
711
+ ub_state_name = univ.Integer(128)
712
+
713
+
714
+ class X520StateOrProvinceName(univ.Choice):
715
+ pass
716
+
717
+
718
+ X520StateOrProvinceName.componentType = namedtype.NamedTypes(
719
+ namedtype.NamedType('teletexString',
720
+ char.TeletexString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_state_name))),
721
+ namedtype.NamedType('printableString',
722
+ char.PrintableString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_state_name))),
723
+ namedtype.NamedType('universalString',
724
+ char.UniversalString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_state_name))),
725
+ namedtype.NamedType('utf8String',
726
+ char.UTF8String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_state_name))),
727
+ namedtype.NamedType('bmpString',
728
+ char.BMPString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_state_name)))
729
+ )
730
+
731
+ physical_delivery_organization_name = univ.Integer(14)
732
+
733
+ id_at_surname = _buildOid(id_at, 4)
734
+
735
+
736
+ class X520countryName(char.PrintableString):
737
+ pass
738
+
739
+
740
+ X520countryName.subtypeSpec = constraint.ValueSizeConstraint(2, 2)
741
+
742
+ physical_delivery_office_number = univ.Integer(11)
743
+
744
+ id_qt_unotice = _buildOid(id_qt, 2)
745
+
746
+
747
+ class X520SerialNumber(char.PrintableString):
748
+ pass
749
+
750
+
751
+ X520SerialNumber.subtypeSpec = constraint.ValueSizeConstraint(1, ub_serial_number)
752
+
753
+
754
+ class Attribute(univ.Sequence):
755
+ componentType = namedtype.NamedTypes(
756
+ namedtype.NamedType('type', AttributeType()),
757
+ namedtype.NamedType('values',
758
+ univ.SetOf(componentType=AttributeValue()),
759
+ openType=opentype.OpenType('type', certificateAttributesMap))
760
+ )
761
+
762
+ ub_common_name = univ.Integer(64)
763
+
764
+ id_pe = _buildOid(id_pkix, 1)
765
+
766
+
767
+ class ExtensionPhysicalDeliveryAddressComponents(PDSParameter):
768
+ pass
769
+
770
+
771
+ class EmailAddress(char.IA5String):
772
+ pass
773
+
774
+
775
+ EmailAddress.subtypeSpec = constraint.ValueSizeConstraint(1, ub_emailaddress_length)
776
+
777
+ id_at_organizationName = _buildOid(id_at, 10)
778
+
779
+ post_office_box_address = univ.Integer(18)
780
+
781
+
782
+ class BuiltInDomainDefinedAttribute(univ.Sequence):
783
+ pass
784
+
785
+
786
+ BuiltInDomainDefinedAttribute.componentType = namedtype.NamedTypes(
787
+ namedtype.NamedType('type', char.PrintableString().subtype(
788
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_domain_defined_attribute_type_length))),
789
+ namedtype.NamedType('value', char.PrintableString().subtype(
790
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_domain_defined_attribute_value_length)))
791
+ )
792
+
793
+
794
+ class BuiltInDomainDefinedAttributes(univ.SequenceOf):
795
+ pass
796
+
797
+
798
+ BuiltInDomainDefinedAttributes.componentType = BuiltInDomainDefinedAttribute()
799
+ BuiltInDomainDefinedAttributes.sizeSpec = constraint.ValueSizeConstraint(1, ub_domain_defined_attributes)
800
+
801
+ id_at_pseudonym = _buildOid(id_at, 65)
802
+
803
+ id_domainComponent = _buildOid(0, 9, 2342, 19200300, 100, 1, 25)
804
+
805
+
806
+ class X520CommonName(univ.Choice):
807
+ pass
808
+
809
+
810
+ X520CommonName.componentType = namedtype.NamedTypes(
811
+ namedtype.NamedType('teletexString',
812
+ char.TeletexString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_common_name))),
813
+ namedtype.NamedType('printableString',
814
+ char.PrintableString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_common_name))),
815
+ namedtype.NamedType('universalString',
816
+ char.UniversalString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_common_name))),
817
+ namedtype.NamedType('utf8String',
818
+ char.UTF8String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_common_name))),
819
+ namedtype.NamedType('bmpString',
820
+ char.BMPString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_common_name)))
821
+ )
822
+
823
+ extension_OR_address_components = univ.Integer(12)
824
+
825
+ ub_organizational_units = univ.Integer(4)
826
+
827
+ teletex_personal_name = univ.Integer(4)
828
+
829
+ ub_numeric_user_id_length = univ.Integer(32)
830
+
831
+ ub_common_name_length = univ.Integer(64)
832
+
833
+
834
+ class TeletexCommonName(char.TeletexString):
835
+ pass
836
+
837
+
838
+ TeletexCommonName.subtypeSpec = constraint.ValueSizeConstraint(1, ub_common_name_length)
839
+
840
+
841
+ class PhysicalDeliveryOrganizationName(PDSParameter):
842
+ pass
843
+
844
+
845
+ extension_physical_delivery_address_components = univ.Integer(15)
846
+
847
+
848
+ class NumericUserIdentifier(char.NumericString):
849
+ pass
850
+
851
+
852
+ NumericUserIdentifier.subtypeSpec = constraint.ValueSizeConstraint(1, ub_numeric_user_id_length)
853
+
854
+
855
+ class CountryName(univ.Choice):
856
+ pass
857
+
858
+
859
+ CountryName.tagSet = univ.Choice.tagSet.tagExplicitly(tag.Tag(tag.tagClassApplication, tag.tagFormatConstructed, 1))
860
+ CountryName.componentType = namedtype.NamedTypes(
861
+ namedtype.NamedType('x121-dcc-code', char.NumericString().subtype(
862
+ subtypeSpec=constraint.ValueSizeConstraint(ub_country_name_numeric_length, ub_country_name_numeric_length))),
863
+ namedtype.NamedType('iso-3166-alpha2-code', char.PrintableString().subtype(
864
+ subtypeSpec=constraint.ValueSizeConstraint(ub_country_name_alpha_length, ub_country_name_alpha_length)))
865
+ )
866
+
867
+
868
+ class OrganizationName(char.PrintableString):
869
+ pass
870
+
871
+
872
+ OrganizationName.subtypeSpec = constraint.ValueSizeConstraint(1, ub_organization_name_length)
873
+
874
+
875
+ class OrganizationalUnitNames(univ.SequenceOf):
876
+ pass
877
+
878
+
879
+ OrganizationalUnitNames.componentType = OrganizationalUnitName()
880
+ OrganizationalUnitNames.sizeSpec = constraint.ValueSizeConstraint(1, ub_organizational_units)
881
+
882
+
883
+ class PrivateDomainName(univ.Choice):
884
+ pass
885
+
886
+
887
+ PrivateDomainName.componentType = namedtype.NamedTypes(
888
+ namedtype.NamedType('numeric', char.NumericString().subtype(
889
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_domain_name_length))),
890
+ namedtype.NamedType('printable', char.PrintableString().subtype(
891
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_domain_name_length)))
892
+ )
893
+
894
+
895
+ class BuiltInStandardAttributes(univ.Sequence):
896
+ pass
897
+
898
+
899
+ BuiltInStandardAttributes.componentType = namedtype.NamedTypes(
900
+ namedtype.OptionalNamedType('country-name', CountryName()),
901
+ namedtype.OptionalNamedType('administration-domain-name', AdministrationDomainName()),
902
+ namedtype.OptionalNamedType('network-address', NetworkAddress().subtype(
903
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
904
+ namedtype.OptionalNamedType('terminal-identifier', TerminalIdentifier().subtype(
905
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
906
+ namedtype.OptionalNamedType('private-domain-name', PrivateDomainName().subtype(
907
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 2))),
908
+ namedtype.OptionalNamedType('organization-name', OrganizationName().subtype(
909
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3))),
910
+ namedtype.OptionalNamedType('numeric-user-identifier', NumericUserIdentifier().subtype(
911
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 4))),
912
+ namedtype.OptionalNamedType('personal-name', PersonalName().subtype(
913
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 5))),
914
+ namedtype.OptionalNamedType('organizational-unit-names', OrganizationalUnitNames().subtype(
915
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 6)))
916
+ )
917
+
918
+
919
+ class ORAddress(univ.Sequence):
920
+ pass
921
+
922
+
923
+ ORAddress.componentType = namedtype.NamedTypes(
924
+ namedtype.NamedType('built-in-standard-attributes', BuiltInStandardAttributes()),
925
+ namedtype.OptionalNamedType('built-in-domain-defined-attributes', BuiltInDomainDefinedAttributes()),
926
+ namedtype.OptionalNamedType('extension-attributes', ExtensionAttributes())
927
+ )
928
+
929
+
930
+ class DistinguishedName(RDNSequence):
931
+ pass
932
+
933
+
934
+ id_ad_timeStamping = _buildOid(id_ad, 3)
935
+
936
+
937
+ class PhysicalDeliveryOfficeNumber(PDSParameter):
938
+ pass
939
+
940
+
941
+ teletex_domain_defined_attributes = univ.Integer(6)
942
+
943
+
944
+ class UniquePostalName(PDSParameter):
945
+ pass
946
+
947
+
948
+ physical_delivery_country_name = univ.Integer(8)
949
+
950
+ ub_pds_name_length = univ.Integer(16)
951
+
952
+
953
+ class PDSName(char.PrintableString):
954
+ pass
955
+
956
+
957
+ PDSName.subtypeSpec = constraint.ValueSizeConstraint(1, ub_pds_name_length)
958
+
959
+
960
+ class TeletexPersonalName(univ.Set):
961
+ pass
962
+
963
+
964
+ TeletexPersonalName.componentType = namedtype.NamedTypes(
965
+ namedtype.NamedType('surname', char.TeletexString().subtype(
966
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_surname_length)).subtype(
967
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
968
+ namedtype.OptionalNamedType('given-name', char.TeletexString().subtype(
969
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_given_name_length)).subtype(
970
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
971
+ namedtype.OptionalNamedType('initials', char.TeletexString().subtype(
972
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_initials_length)).subtype(
973
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
974
+ namedtype.OptionalNamedType('generation-qualifier', char.TeletexString().subtype(
975
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_generation_qualifier_length)).subtype(
976
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3)))
977
+ )
978
+
979
+ street_address = univ.Integer(17)
980
+
981
+
982
+ class PostOfficeBoxAddress(PDSParameter):
983
+ pass
984
+
985
+
986
+ local_postal_attributes = univ.Integer(21)
987
+
988
+
989
+ class DirectoryString(univ.Choice):
990
+ pass
991
+
992
+
993
+ DirectoryString.componentType = namedtype.NamedTypes(
994
+ namedtype.NamedType('teletexString',
995
+ char.TeletexString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, MAX))),
996
+ namedtype.NamedType('printableString',
997
+ char.PrintableString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, MAX))),
998
+ namedtype.NamedType('universalString',
999
+ char.UniversalString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, MAX))),
1000
+ namedtype.NamedType('utf8String', char.UTF8String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, MAX))),
1001
+ namedtype.NamedType('bmpString', char.BMPString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, MAX)))
1002
+ )
1003
+
1004
+ teletex_common_name = univ.Integer(2)
1005
+
1006
+
1007
+ class CommonName(char.PrintableString):
1008
+ pass
1009
+
1010
+
1011
+ CommonName.subtypeSpec = constraint.ValueSizeConstraint(1, ub_common_name_length)
1012
+
1013
+
1014
+ class Certificate(univ.Sequence):
1015
+ pass
1016
+
1017
+
1018
+ Certificate.componentType = namedtype.NamedTypes(
1019
+ namedtype.NamedType('tbsCertificate', TBSCertificate()),
1020
+ namedtype.NamedType('signatureAlgorithm', AlgorithmIdentifier()),
1021
+ namedtype.NamedType('signature', univ.BitString())
1022
+ )
1023
+
1024
+
1025
+ class TeletexOrganizationalUnitName(char.TeletexString):
1026
+ pass
1027
+
1028
+
1029
+ TeletexOrganizationalUnitName.subtypeSpec = constraint.ValueSizeConstraint(1, ub_organizational_unit_name_length)
1030
+
1031
+ id_at_name = _buildOid(id_at, 41)
1032
+
1033
+
1034
+ class TeletexOrganizationalUnitNames(univ.SequenceOf):
1035
+ pass
1036
+
1037
+
1038
+ TeletexOrganizationalUnitNames.componentType = TeletexOrganizationalUnitName()
1039
+ TeletexOrganizationalUnitNames.sizeSpec = constraint.ValueSizeConstraint(1, ub_organizational_units)
1040
+
1041
+ id_ce = _buildOid(2, 5, 29)
1042
+
1043
+ id_ce_issuerAltName = _buildOid(id_ce, 18)
1044
+
1045
+
1046
+ class SkipCerts(univ.Integer):
1047
+ pass
1048
+
1049
+
1050
+ SkipCerts.subtypeSpec = constraint.ValueRangeConstraint(0, MAX)
1051
+
1052
+
1053
+ class CRLReason(univ.Enumerated):
1054
+ pass
1055
+
1056
+
1057
+ CRLReason.namedValues = namedval.NamedValues(
1058
+ ('unspecified', 0),
1059
+ ('keyCompromise', 1),
1060
+ ('cACompromise', 2),
1061
+ ('affiliationChanged', 3),
1062
+ ('superseded', 4),
1063
+ ('cessationOfOperation', 5),
1064
+ ('certificateHold', 6),
1065
+ ('removeFromCRL', 8),
1066
+ ('privilegeWithdrawn', 9),
1067
+ ('aACompromise', 10)
1068
+ )
1069
+
1070
+
1071
+ class PrivateKeyUsagePeriod(univ.Sequence):
1072
+ pass
1073
+
1074
+
1075
+ PrivateKeyUsagePeriod.componentType = namedtype.NamedTypes(
1076
+ namedtype.OptionalNamedType('notBefore', useful.GeneralizedTime().subtype(
1077
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
1078
+ namedtype.OptionalNamedType('notAfter', useful.GeneralizedTime().subtype(
1079
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
1080
+ )
1081
+
1082
+
1083
+ anotherNameMap = {
1084
+
1085
+ }
1086
+
1087
+
1088
+ class AnotherName(univ.Sequence):
1089
+ componentType = namedtype.NamedTypes(
1090
+ namedtype.NamedType('type-id', univ.ObjectIdentifier()),
1091
+ namedtype.NamedType(
1092
+ 'value',
1093
+ univ.Any().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)),
1094
+ openType=opentype.OpenType('type-id', anotherNameMap)
1095
+ )
1096
+ )
1097
+
1098
+
1099
+ class EDIPartyName(univ.Sequence):
1100
+ pass
1101
+
1102
+
1103
+ EDIPartyName.componentType = namedtype.NamedTypes(
1104
+ namedtype.OptionalNamedType('nameAssigner', DirectoryString().subtype(
1105
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
1106
+ namedtype.NamedType('partyName', DirectoryString().subtype(
1107
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1)))
1108
+ )
1109
+
1110
+
1111
+ class GeneralName(univ.Choice):
1112
+ pass
1113
+
1114
+
1115
+ GeneralName.componentType = namedtype.NamedTypes(
1116
+ namedtype.NamedType('otherName',
1117
+ AnotherName().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
1118
+ namedtype.NamedType('rfc822Name',
1119
+ char.IA5String().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
1120
+ namedtype.NamedType('dNSName',
1121
+ char.IA5String().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
1122
+ namedtype.NamedType('x400Address',
1123
+ ORAddress().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3))),
1124
+ namedtype.NamedType('directoryName',
1125
+ Name().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 4))),
1126
+ namedtype.NamedType('ediPartyName',
1127
+ EDIPartyName().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 5))),
1128
+ namedtype.NamedType('uniformResourceIdentifier',
1129
+ char.IA5String().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 6))),
1130
+ namedtype.NamedType('iPAddress',
1131
+ univ.OctetString().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 7))),
1132
+ namedtype.NamedType('registeredID', univ.ObjectIdentifier().subtype(
1133
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 8)))
1134
+ )
1135
+
1136
+
1137
+ class BaseDistance(univ.Integer):
1138
+ pass
1139
+
1140
+
1141
+ BaseDistance.subtypeSpec = constraint.ValueRangeConstraint(0, MAX)
1142
+
1143
+
1144
+ class GeneralSubtree(univ.Sequence):
1145
+ pass
1146
+
1147
+
1148
+ GeneralSubtree.componentType = namedtype.NamedTypes(
1149
+ namedtype.NamedType('base', GeneralName()),
1150
+ namedtype.DefaultedNamedType('minimum', BaseDistance().subtype(
1151
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)).subtype(value=0)),
1152
+ namedtype.OptionalNamedType('maximum', BaseDistance().subtype(
1153
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
1154
+ )
1155
+
1156
+
1157
+ class GeneralNames(univ.SequenceOf):
1158
+ pass
1159
+
1160
+
1161
+ GeneralNames.componentType = GeneralName()
1162
+ GeneralNames.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
1163
+
1164
+
1165
+ class DistributionPointName(univ.Choice):
1166
+ pass
1167
+
1168
+
1169
+ DistributionPointName.componentType = namedtype.NamedTypes(
1170
+ namedtype.NamedType('fullName',
1171
+ GeneralNames().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
1172
+ namedtype.NamedType('nameRelativeToCRLIssuer', RelativeDistinguishedName().subtype(
1173
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
1174
+ )
1175
+
1176
+
1177
+ class ReasonFlags(univ.BitString):
1178
+ pass
1179
+
1180
+
1181
+ ReasonFlags.namedValues = namedval.NamedValues(
1182
+ ('unused', 0),
1183
+ ('keyCompromise', 1),
1184
+ ('cACompromise', 2),
1185
+ ('affiliationChanged', 3),
1186
+ ('superseded', 4),
1187
+ ('cessationOfOperation', 5),
1188
+ ('certificateHold', 6),
1189
+ ('privilegeWithdrawn', 7),
1190
+ ('aACompromise', 8)
1191
+ )
1192
+
1193
+
1194
+ class IssuingDistributionPoint(univ.Sequence):
1195
+ pass
1196
+
1197
+
1198
+ IssuingDistributionPoint.componentType = namedtype.NamedTypes(
1199
+ namedtype.OptionalNamedType('distributionPoint', DistributionPointName().subtype(
1200
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
1201
+ namedtype.DefaultedNamedType('onlyContainsUserCerts', univ.Boolean().subtype(
1202
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)).subtype(value=0)),
1203
+ namedtype.DefaultedNamedType('onlyContainsCACerts', univ.Boolean().subtype(
1204
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2)).subtype(value=0)),
1205
+ namedtype.OptionalNamedType('onlySomeReasons', ReasonFlags().subtype(
1206
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3))),
1207
+ namedtype.DefaultedNamedType('indirectCRL', univ.Boolean().subtype(
1208
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 4)).subtype(value=0)),
1209
+ namedtype.DefaultedNamedType('onlyContainsAttributeCerts', univ.Boolean().subtype(
1210
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 5)).subtype(value=0))
1211
+ )
1212
+
1213
+ id_ce_certificatePolicies = _buildOid(id_ce, 32)
1214
+
1215
+ id_kp_emailProtection = _buildOid(id_kp, 4)
1216
+
1217
+
1218
+ class AccessDescription(univ.Sequence):
1219
+ pass
1220
+
1221
+
1222
+ AccessDescription.componentType = namedtype.NamedTypes(
1223
+ namedtype.NamedType('accessMethod', univ.ObjectIdentifier()),
1224
+ namedtype.NamedType('accessLocation', GeneralName())
1225
+ )
1226
+
1227
+
1228
+ class IssuerAltName(GeneralNames):
1229
+ pass
1230
+
1231
+
1232
+ id_ce_cRLDistributionPoints = _buildOid(id_ce, 31)
1233
+
1234
+ holdInstruction = _buildOid(2, 2, 840, 10040, 2)
1235
+
1236
+ id_holdinstruction_callissuer = _buildOid(holdInstruction, 2)
1237
+
1238
+ id_ce_subjectDirectoryAttributes = _buildOid(id_ce, 9)
1239
+
1240
+ id_ce_issuingDistributionPoint = _buildOid(id_ce, 28)
1241
+
1242
+
1243
+ class DistributionPoint(univ.Sequence):
1244
+ pass
1245
+
1246
+
1247
+ DistributionPoint.componentType = namedtype.NamedTypes(
1248
+ namedtype.OptionalNamedType('distributionPoint', DistributionPointName().subtype(
1249
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
1250
+ namedtype.OptionalNamedType('reasons', ReasonFlags().subtype(
1251
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
1252
+ namedtype.OptionalNamedType('cRLIssuer', GeneralNames().subtype(
1253
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2)))
1254
+ )
1255
+
1256
+
1257
+ class CRLDistributionPoints(univ.SequenceOf):
1258
+ pass
1259
+
1260
+
1261
+ CRLDistributionPoints.componentType = DistributionPoint()
1262
+ CRLDistributionPoints.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
1263
+
1264
+
1265
+ class GeneralSubtrees(univ.SequenceOf):
1266
+ pass
1267
+
1268
+
1269
+ GeneralSubtrees.componentType = GeneralSubtree()
1270
+ GeneralSubtrees.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
1271
+
1272
+
1273
+ class NameConstraints(univ.Sequence):
1274
+ pass
1275
+
1276
+
1277
+ NameConstraints.componentType = namedtype.NamedTypes(
1278
+ namedtype.OptionalNamedType('permittedSubtrees', GeneralSubtrees().subtype(
1279
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
1280
+ namedtype.OptionalNamedType('excludedSubtrees', GeneralSubtrees().subtype(
1281
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
1282
+ )
1283
+
1284
+
1285
+ class SubjectDirectoryAttributes(univ.SequenceOf):
1286
+ pass
1287
+
1288
+
1289
+ SubjectDirectoryAttributes.componentType = Attribute()
1290
+ SubjectDirectoryAttributes.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
1291
+
1292
+ id_kp_OCSPSigning = _buildOid(id_kp, 9)
1293
+
1294
+ id_kp_timeStamping = _buildOid(id_kp, 8)
1295
+
1296
+
1297
+ class DisplayText(univ.Choice):
1298
+ pass
1299
+
1300
+
1301
+ DisplayText.componentType = namedtype.NamedTypes(
1302
+ namedtype.NamedType('ia5String', char.IA5String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, 200))),
1303
+ namedtype.NamedType('visibleString',
1304
+ char.VisibleString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, 200))),
1305
+ namedtype.NamedType('bmpString', char.BMPString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, 200))),
1306
+ namedtype.NamedType('utf8String', char.UTF8String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, 200)))
1307
+ )
1308
+
1309
+
1310
+ class NoticeReference(univ.Sequence):
1311
+ pass
1312
+
1313
+
1314
+ NoticeReference.componentType = namedtype.NamedTypes(
1315
+ namedtype.NamedType('organization', DisplayText()),
1316
+ namedtype.NamedType('noticeNumbers', univ.SequenceOf(componentType=univ.Integer()))
1317
+ )
1318
+
1319
+
1320
+ class UserNotice(univ.Sequence):
1321
+ pass
1322
+
1323
+
1324
+ UserNotice.componentType = namedtype.NamedTypes(
1325
+ namedtype.OptionalNamedType('noticeRef', NoticeReference()),
1326
+ namedtype.OptionalNamedType('explicitText', DisplayText())
1327
+ )
1328
+
1329
+
1330
+ class PolicyQualifierId(univ.ObjectIdentifier):
1331
+ pass
1332
+
1333
+
1334
+ policyQualifierInfoMap = {
1335
+
1336
+ }
1337
+
1338
+
1339
+ class PolicyQualifierInfo(univ.Sequence):
1340
+ componentType = namedtype.NamedTypes(
1341
+ namedtype.NamedType('policyQualifierId', PolicyQualifierId()),
1342
+ namedtype.NamedType(
1343
+ 'qualifier', univ.Any(),
1344
+ openType=opentype.OpenType('policyQualifierId', policyQualifierInfoMap)
1345
+ )
1346
+ )
1347
+
1348
+
1349
+ class CertPolicyId(univ.ObjectIdentifier):
1350
+ pass
1351
+
1352
+
1353
+ class PolicyInformation(univ.Sequence):
1354
+ pass
1355
+
1356
+
1357
+ PolicyInformation.componentType = namedtype.NamedTypes(
1358
+ namedtype.NamedType('policyIdentifier', CertPolicyId()),
1359
+ namedtype.OptionalNamedType('policyQualifiers', univ.SequenceOf(componentType=PolicyQualifierInfo()))
1360
+ )
1361
+
1362
+
1363
+ class CertificatePolicies(univ.SequenceOf):
1364
+ pass
1365
+
1366
+
1367
+ CertificatePolicies.componentType = PolicyInformation()
1368
+ CertificatePolicies.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
1369
+
1370
+
1371
+ class SubjectAltName(GeneralNames):
1372
+ pass
1373
+
1374
+
1375
+ id_ce_basicConstraints = _buildOid(id_ce, 19)
1376
+
1377
+ id_ce_authorityKeyIdentifier = _buildOid(id_ce, 35)
1378
+
1379
+ id_kp_codeSigning = _buildOid(id_kp, 3)
1380
+
1381
+
1382
+ class BasicConstraints(univ.Sequence):
1383
+ pass
1384
+
1385
+
1386
+ BasicConstraints.componentType = namedtype.NamedTypes(
1387
+ namedtype.DefaultedNamedType('cA', univ.Boolean().subtype(value=0)),
1388
+ namedtype.OptionalNamedType('pathLenConstraint',
1389
+ univ.Integer().subtype(subtypeSpec=constraint.ValueRangeConstraint(0, MAX)))
1390
+ )
1391
+
1392
+ id_ce_certificateIssuer = _buildOid(id_ce, 29)
1393
+
1394
+
1395
+ class PolicyMappings(univ.SequenceOf):
1396
+ pass
1397
+
1398
+
1399
+ PolicyMappings.componentType = univ.Sequence(
1400
+ componentType=namedtype.NamedTypes(
1401
+ namedtype.NamedType('issuerDomainPolicy', CertPolicyId()),
1402
+ namedtype.NamedType('subjectDomainPolicy', CertPolicyId())
1403
+ )
1404
+ )
1405
+
1406
+ PolicyMappings.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
1407
+
1408
+
1409
+ class InhibitAnyPolicy(SkipCerts):
1410
+ pass
1411
+
1412
+
1413
+ anyPolicy = _buildOid(id_ce_certificatePolicies, 0)
1414
+
1415
+
1416
+ class CRLNumber(univ.Integer):
1417
+ pass
1418
+
1419
+
1420
+ CRLNumber.subtypeSpec = constraint.ValueRangeConstraint(0, MAX)
1421
+
1422
+
1423
+ class BaseCRLNumber(CRLNumber):
1424
+ pass
1425
+
1426
+
1427
+ id_ce_nameConstraints = _buildOid(id_ce, 30)
1428
+
1429
+ id_kp_serverAuth = _buildOid(id_kp, 1)
1430
+
1431
+ id_ce_freshestCRL = _buildOid(id_ce, 46)
1432
+
1433
+ id_ce_cRLReasons = _buildOid(id_ce, 21)
1434
+
1435
+ id_ce_extKeyUsage = _buildOid(id_ce, 37)
1436
+
1437
+
1438
+ class KeyIdentifier(univ.OctetString):
1439
+ pass
1440
+
1441
+
1442
+ class AuthorityKeyIdentifier(univ.Sequence):
1443
+ pass
1444
+
1445
+
1446
+ AuthorityKeyIdentifier.componentType = namedtype.NamedTypes(
1447
+ namedtype.OptionalNamedType('keyIdentifier', KeyIdentifier().subtype(
1448
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
1449
+ namedtype.OptionalNamedType('authorityCertIssuer', GeneralNames().subtype(
1450
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
1451
+ namedtype.OptionalNamedType('authorityCertSerialNumber', CertificateSerialNumber().subtype(
1452
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2)))
1453
+ )
1454
+
1455
+
1456
+ class FreshestCRL(CRLDistributionPoints):
1457
+ pass
1458
+
1459
+
1460
+ id_ce_policyConstraints = _buildOid(id_ce, 36)
1461
+
1462
+ id_pe_authorityInfoAccess = _buildOid(id_pe, 1)
1463
+
1464
+
1465
+ class AuthorityInfoAccessSyntax(univ.SequenceOf):
1466
+ pass
1467
+
1468
+
1469
+ AuthorityInfoAccessSyntax.componentType = AccessDescription()
1470
+ AuthorityInfoAccessSyntax.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
1471
+
1472
+ id_holdinstruction_none = _buildOid(holdInstruction, 1)
1473
+
1474
+
1475
+ class CPSuri(char.IA5String):
1476
+ pass
1477
+
1478
+
1479
+ id_pe_subjectInfoAccess = _buildOid(id_pe, 11)
1480
+
1481
+
1482
+ class SubjectKeyIdentifier(KeyIdentifier):
1483
+ pass
1484
+
1485
+
1486
+ id_ce_subjectAltName = _buildOid(id_ce, 17)
1487
+
1488
+
1489
+ class KeyPurposeId(univ.ObjectIdentifier):
1490
+ pass
1491
+
1492
+
1493
+ class ExtKeyUsageSyntax(univ.SequenceOf):
1494
+ pass
1495
+
1496
+
1497
+ ExtKeyUsageSyntax.componentType = KeyPurposeId()
1498
+ ExtKeyUsageSyntax.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
1499
+
1500
+
1501
+ class HoldInstructionCode(univ.ObjectIdentifier):
1502
+ pass
1503
+
1504
+
1505
+ id_ce_deltaCRLIndicator = _buildOid(id_ce, 27)
1506
+
1507
+ id_ce_keyUsage = _buildOid(id_ce, 15)
1508
+
1509
+ id_ce_holdInstructionCode = _buildOid(id_ce, 23)
1510
+
1511
+
1512
+ class SubjectInfoAccessSyntax(univ.SequenceOf):
1513
+ pass
1514
+
1515
+
1516
+ SubjectInfoAccessSyntax.componentType = AccessDescription()
1517
+ SubjectInfoAccessSyntax.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
1518
+
1519
+
1520
+ class InvalidityDate(useful.GeneralizedTime):
1521
+ pass
1522
+
1523
+
1524
+ class KeyUsage(univ.BitString):
1525
+ pass
1526
+
1527
+
1528
+ KeyUsage.namedValues = namedval.NamedValues(
1529
+ ('digitalSignature', 0),
1530
+ ('nonRepudiation', 1),
1531
+ ('keyEncipherment', 2),
1532
+ ('dataEncipherment', 3),
1533
+ ('keyAgreement', 4),
1534
+ ('keyCertSign', 5),
1535
+ ('cRLSign', 6),
1536
+ ('encipherOnly', 7),
1537
+ ('decipherOnly', 8)
1538
+ )
1539
+
1540
+ id_ce_invalidityDate = _buildOid(id_ce, 24)
1541
+
1542
+ id_ce_policyMappings = _buildOid(id_ce, 33)
1543
+
1544
+ anyExtendedKeyUsage = _buildOid(id_ce_extKeyUsage, 0)
1545
+
1546
+ id_ce_privateKeyUsagePeriod = _buildOid(id_ce, 16)
1547
+
1548
+ id_ce_cRLNumber = _buildOid(id_ce, 20)
1549
+
1550
+
1551
+ class CertificateIssuer(GeneralNames):
1552
+ pass
1553
+
1554
+
1555
+ id_holdinstruction_reject = _buildOid(holdInstruction, 3)
1556
+
1557
+
1558
+ class PolicyConstraints(univ.Sequence):
1559
+ pass
1560
+
1561
+
1562
+ PolicyConstraints.componentType = namedtype.NamedTypes(
1563
+ namedtype.OptionalNamedType('requireExplicitPolicy',
1564
+ SkipCerts().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
1565
+ namedtype.OptionalNamedType('inhibitPolicyMapping',
1566
+ SkipCerts().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
1567
+ )
1568
+
1569
+ id_kp_clientAuth = _buildOid(id_kp, 2)
1570
+
1571
+ id_ce_subjectKeyIdentifier = _buildOid(id_ce, 14)
1572
+
1573
+ id_ce_inhibitAnyPolicy = _buildOid(id_ce, 54)
1574
+
1575
+ # map of ORAddress ExtensionAttribute type to ExtensionAttribute value
1576
+
1577
+ _oraddressExtensionAttributeMapUpdate = {
1578
+ common_name: CommonName(),
1579
+ teletex_common_name: TeletexCommonName(),
1580
+ teletex_organization_name: TeletexOrganizationName(),
1581
+ teletex_personal_name: TeletexPersonalName(),
1582
+ teletex_organizational_unit_names: TeletexOrganizationalUnitNames(),
1583
+ pds_name: PDSName(),
1584
+ physical_delivery_country_name: PhysicalDeliveryCountryName(),
1585
+ postal_code: PostalCode(),
1586
+ physical_delivery_office_name: PhysicalDeliveryOfficeName(),
1587
+ physical_delivery_office_number: PhysicalDeliveryOfficeNumber(),
1588
+ extension_OR_address_components: ExtensionORAddressComponents(),
1589
+ physical_delivery_personal_name: PhysicalDeliveryPersonalName(),
1590
+ physical_delivery_organization_name: PhysicalDeliveryOrganizationName(),
1591
+ extension_physical_delivery_address_components: ExtensionPhysicalDeliveryAddressComponents(),
1592
+ unformatted_postal_address: UnformattedPostalAddress(),
1593
+ street_address: StreetAddress(),
1594
+ post_office_box_address: PostOfficeBoxAddress(),
1595
+ poste_restante_address: PosteRestanteAddress(),
1596
+ unique_postal_name: UniquePostalName(),
1597
+ local_postal_attributes: LocalPostalAttributes(),
1598
+ extended_network_address: ExtendedNetworkAddress(),
1599
+ terminal_type: TerminalType(),
1600
+ teletex_domain_defined_attributes: TeletexDomainDefinedAttributes(),
1601
+ }
1602
+
1603
+ oraddressExtensionAttributeMap.update(_oraddressExtensionAttributeMapUpdate)
1604
+
1605
+
1606
+ # map of AttributeType -> AttributeValue
1607
+
1608
+ _certificateAttributesMapUpdate = {
1609
+ id_at_name: X520name(),
1610
+ id_at_surname: X520name(),
1611
+ id_at_givenName: X520name(),
1612
+ id_at_initials: X520name(),
1613
+ id_at_generationQualifier: X520name(),
1614
+ id_at_commonName: X520CommonName(),
1615
+ id_at_localityName: X520LocalityName(),
1616
+ id_at_stateOrProvinceName: X520StateOrProvinceName(),
1617
+ id_at_organizationName: X520OrganizationName(),
1618
+ id_at_organizationalUnitName: X520OrganizationalUnitName(),
1619
+ id_at_title: X520Title(),
1620
+ id_at_dnQualifier: X520dnQualifier(),
1621
+ id_at_countryName: X520countryName(),
1622
+ id_at_serialNumber: X520SerialNumber(),
1623
+ id_at_pseudonym: X520Pseudonym(),
1624
+ id_domainComponent: DomainComponent(),
1625
+ id_emailAddress: EmailAddress(),
1626
+ }
1627
+
1628
+ certificateAttributesMap.update(_certificateAttributesMapUpdate)
1629
+
1630
+
1631
+ # map of Certificate Extension OIDs to Extensions
1632
+
1633
+ _certificateExtensionsMap = {
1634
+ id_ce_authorityKeyIdentifier: AuthorityKeyIdentifier(),
1635
+ id_ce_subjectKeyIdentifier: SubjectKeyIdentifier(),
1636
+ id_ce_keyUsage: KeyUsage(),
1637
+ id_ce_privateKeyUsagePeriod: PrivateKeyUsagePeriod(),
1638
+ id_ce_certificatePolicies: CertificatePolicies(),
1639
+ id_ce_policyMappings: PolicyMappings(),
1640
+ id_ce_subjectAltName: SubjectAltName(),
1641
+ id_ce_issuerAltName: IssuerAltName(),
1642
+ id_ce_subjectDirectoryAttributes: SubjectDirectoryAttributes(),
1643
+ id_ce_basicConstraints: BasicConstraints(),
1644
+ id_ce_nameConstraints: NameConstraints(),
1645
+ id_ce_policyConstraints: PolicyConstraints(),
1646
+ id_ce_extKeyUsage: ExtKeyUsageSyntax(),
1647
+ id_ce_cRLDistributionPoints: CRLDistributionPoints(),
1648
+ id_pe_authorityInfoAccess: AuthorityInfoAccessSyntax(),
1649
+ id_ce_cRLNumber: univ.Integer(),
1650
+ id_ce_deltaCRLIndicator: BaseCRLNumber(),
1651
+ id_ce_issuingDistributionPoint: IssuingDistributionPoint(),
1652
+ id_ce_cRLReasons: CRLReason(),
1653
+ id_ce_holdInstructionCode: univ.ObjectIdentifier(),
1654
+ id_ce_invalidityDate: useful.GeneralizedTime(),
1655
+ id_ce_certificateIssuer: GeneralNames(),
1656
+ }
1657
+
1658
+ certificateExtensionsMap.update(_certificateExtensionsMap)
evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc5480.py ADDED
@@ -0,0 +1,190 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This file is being contributed to pyasn1-modules software.
2
+ #
3
+ # Created by Russ Housley with assistance from asn1ate v.0.6.0.
4
+ # Modified by Russ Housley to add maps for opentypes.
5
+ #
6
+ # Copyright (c) 2019, Vigil Security, LLC
7
+ # License: http://snmplabs.com/pyasn1/license.html
8
+ #
9
+ # Elliptic Curve Cryptography Subject Public Key Information
10
+ #
11
+ # ASN.1 source from:
12
+ # https://www.rfc-editor.org/rfc/rfc5480.txt
13
+
14
+
15
+ # What can be imported from rfc4055.py ?
16
+
17
+ from pyasn1.type import namedtype
18
+ from pyasn1.type import univ
19
+
20
+ from pyasn1_modules import rfc3279
21
+ from pyasn1_modules import rfc5280
22
+
23
+
24
+ # These structures are the same as RFC 3279.
25
+
26
+ DHPublicKey = rfc3279.DHPublicKey
27
+
28
+ DSAPublicKey = rfc3279.DSAPublicKey
29
+
30
+ ValidationParms = rfc3279.ValidationParms
31
+
32
+ DomainParameters = rfc3279.DomainParameters
33
+
34
+ ECDSA_Sig_Value = rfc3279.ECDSA_Sig_Value
35
+
36
+ ECPoint = rfc3279.ECPoint
37
+
38
+ KEA_Parms_Id = rfc3279.KEA_Parms_Id
39
+
40
+ RSAPublicKey = rfc3279.RSAPublicKey
41
+
42
+
43
+ # RFC 5480 changed the names of these structures from RFC 3279.
44
+
45
+ DSS_Parms = rfc3279.Dss_Parms
46
+
47
+ DSA_Sig_Value = rfc3279.Dss_Sig_Value
48
+
49
+
50
+ # RFC 3279 defines a more complex alternative for ECParameters.
51
+ # RFC 5480 narrows the definition to a single CHOICE: namedCurve.
52
+
53
+ class ECParameters(univ.Choice):
54
+ pass
55
+
56
+ ECParameters.componentType = namedtype.NamedTypes(
57
+ namedtype.NamedType('namedCurve', univ.ObjectIdentifier())
58
+ )
59
+
60
+
61
+ # OIDs for Message Digest Algorithms
62
+
63
+ id_md2 = univ.ObjectIdentifier('1.2.840.113549.2.2')
64
+
65
+ id_md5 = univ.ObjectIdentifier('1.2.840.113549.2.5')
66
+
67
+ id_sha1 = univ.ObjectIdentifier('1.3.14.3.2.26')
68
+
69
+ id_sha224 = univ.ObjectIdentifier('2.16.840.1.101.3.4.2.4')
70
+
71
+ id_sha256 = univ.ObjectIdentifier('2.16.840.1.101.3.4.2.1')
72
+
73
+ id_sha384 = univ.ObjectIdentifier('2.16.840.1.101.3.4.2.2')
74
+
75
+ id_sha512 = univ.ObjectIdentifier('2.16.840.1.101.3.4.2.3')
76
+
77
+
78
+ # OID for RSA PK Algorithm and Key
79
+
80
+ rsaEncryption = univ.ObjectIdentifier('1.2.840.113549.1.1.1')
81
+
82
+
83
+ # OID for DSA PK Algorithm, Key, and Parameters
84
+
85
+ id_dsa = univ.ObjectIdentifier('1.2.840.10040.4.1')
86
+
87
+
88
+ # OID for Diffie-Hellman PK Algorithm, Key, and Parameters
89
+
90
+ dhpublicnumber = univ.ObjectIdentifier('1.2.840.10046.2.1')
91
+
92
+ # OID for KEA PK Algorithm and Parameters
93
+
94
+ id_keyExchangeAlgorithm = univ.ObjectIdentifier('2.16.840.1.101.2.1.1.22')
95
+
96
+
97
+ # OIDs for Elliptic Curve Algorithm ID, Key, and Parameters
98
+ # Note that ECDSA keys always use this OID
99
+
100
+ id_ecPublicKey = univ.ObjectIdentifier('1.2.840.10045.2.1')
101
+
102
+ id_ecDH = univ.ObjectIdentifier('1.3.132.1.12')
103
+
104
+ id_ecMQV = univ.ObjectIdentifier('1.3.132.1.13')
105
+
106
+
107
+ # OIDs for RSA Signature Algorithms
108
+
109
+ md2WithRSAEncryption = univ.ObjectIdentifier('1.2.840.113549.1.1.2')
110
+
111
+ md5WithRSAEncryption = univ.ObjectIdentifier('1.2.840.113549.1.1.4')
112
+
113
+ sha1WithRSAEncryption = univ.ObjectIdentifier('1.2.840.113549.1.1.5')
114
+
115
+
116
+ # OIDs for DSA Signature Algorithms
117
+
118
+ id_dsa_with_sha1 = univ.ObjectIdentifier('1.2.840.10040.4.3')
119
+
120
+ id_dsa_with_sha224 = univ.ObjectIdentifier('2.16.840.1.101.3.4.3.1')
121
+
122
+ id_dsa_with_sha256 = univ.ObjectIdentifier('2.16.840.1.101.3.4.3.2')
123
+
124
+
125
+ # OIDs for ECDSA Signature Algorithms
126
+
127
+ ecdsa_with_SHA1 = univ.ObjectIdentifier('1.2.840.10045.4.1')
128
+
129
+ ecdsa_with_SHA224 = univ.ObjectIdentifier('1.2.840.10045.4.3.1')
130
+
131
+ ecdsa_with_SHA256 = univ.ObjectIdentifier('1.2.840.10045.4.3.2')
132
+
133
+ ecdsa_with_SHA384 = univ.ObjectIdentifier('1.2.840.10045.4.3.3')
134
+
135
+ ecdsa_with_SHA512 = univ.ObjectIdentifier('1.2.840.10045.4.3.4')
136
+
137
+
138
+ # OIDs for Named Elliptic Curves
139
+
140
+ secp192r1 = univ.ObjectIdentifier('1.2.840.10045.3.1.1')
141
+
142
+ sect163k1 = univ.ObjectIdentifier('1.3.132.0.1')
143
+
144
+ sect163r2 = univ.ObjectIdentifier('1.3.132.0.15')
145
+
146
+ secp224r1 = univ.ObjectIdentifier('1.3.132.0.33')
147
+
148
+ sect233k1 = univ.ObjectIdentifier('1.3.132.0.26')
149
+
150
+ sect233r1 = univ.ObjectIdentifier('1.3.132.0.27')
151
+
152
+ secp256r1 = univ.ObjectIdentifier('1.2.840.10045.3.1.7')
153
+
154
+ sect283k1 = univ.ObjectIdentifier('1.3.132.0.16')
155
+
156
+ sect283r1 = univ.ObjectIdentifier('1.3.132.0.17')
157
+
158
+ secp384r1 = univ.ObjectIdentifier('1.3.132.0.34')
159
+
160
+ sect409k1 = univ.ObjectIdentifier('1.3.132.0.36')
161
+
162
+ sect409r1 = univ.ObjectIdentifier('1.3.132.0.37')
163
+
164
+ secp521r1 = univ.ObjectIdentifier('1.3.132.0.35')
165
+
166
+ sect571k1 = univ.ObjectIdentifier('1.3.132.0.38')
167
+
168
+ sect571r1 = univ.ObjectIdentifier('1.3.132.0.39')
169
+
170
+
171
+ # Map of Algorithm Identifier OIDs to Parameters
172
+ # The algorithm is not included if the parameters MUST be absent
173
+
174
+ _algorithmIdentifierMapUpdate = {
175
+ rsaEncryption: univ.Null(),
176
+ md2WithRSAEncryption: univ.Null(),
177
+ md5WithRSAEncryption: univ.Null(),
178
+ sha1WithRSAEncryption: univ.Null(),
179
+ id_dsa: DSS_Parms(),
180
+ dhpublicnumber: DomainParameters(),
181
+ id_keyExchangeAlgorithm: KEA_Parms_Id(),
182
+ id_ecPublicKey: ECParameters(),
183
+ id_ecDH: ECParameters(),
184
+ id_ecMQV: ECParameters(),
185
+ }
186
+
187
+
188
+ # Add these Algorithm Identifier map entries to the ones in rfc5280.py
189
+
190
+ rfc5280.algorithmIdentifierMap.update(_algorithmIdentifierMapUpdate)
evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc5914.py ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This file is being contributed to pyasn1-modules software.
2
+ #
3
+ # Created by Russ Housley with assistance from asn1ate v.0.6.0.
4
+ #
5
+ # Copyright (c) 2019, Vigil Security, LLC
6
+ # License: http://snmplabs.com/pyasn1/license.html
7
+ #
8
+ # Trust Anchor Format
9
+ #
10
+ # ASN.1 source from:
11
+ # https://www.rfc-editor.org/rfc/rfc5914.txt
12
+
13
+ from pyasn1.type import char
14
+ from pyasn1.type import constraint
15
+ from pyasn1.type import namedtype
16
+ from pyasn1.type import namedval
17
+ from pyasn1.type import tag
18
+ from pyasn1.type import univ
19
+
20
+ from pyasn1_modules import rfc5280
21
+
22
+
23
+ MAX = float('inf')
24
+
25
+ Certificate = rfc5280.Certificate
26
+
27
+ Name = rfc5280.Name
28
+
29
+ Extensions = rfc5280.Extensions
30
+
31
+ SubjectPublicKeyInfo = rfc5280.SubjectPublicKeyInfo
32
+
33
+ TBSCertificate = rfc5280.TBSCertificate
34
+
35
+ CertificatePolicies = rfc5280.CertificatePolicies
36
+
37
+ KeyIdentifier = rfc5280.KeyIdentifier
38
+
39
+ NameConstraints = rfc5280.NameConstraints
40
+
41
+
42
+ class CertPolicyFlags(univ.BitString):
43
+ pass
44
+
45
+ CertPolicyFlags.namedValues = namedval.NamedValues(
46
+ ('inhibitPolicyMapping', 0),
47
+ ('requireExplicitPolicy', 1),
48
+ ('inhibitAnyPolicy', 2)
49
+ )
50
+
51
+
52
+ class CertPathControls(univ.Sequence):
53
+ pass
54
+
55
+ CertPathControls.componentType = namedtype.NamedTypes(
56
+ namedtype.NamedType('taName', Name()),
57
+ namedtype.OptionalNamedType('certificate', Certificate().subtype(
58
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
59
+ namedtype.OptionalNamedType('policySet', CertificatePolicies().subtype(
60
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
61
+ namedtype.OptionalNamedType('policyFlags', CertPolicyFlags().subtype(
62
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
63
+ namedtype.OptionalNamedType('nameConstr', NameConstraints().subtype(
64
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3))),
65
+ namedtype.OptionalNamedType('pathLenConstraint', univ.Integer().subtype(
66
+ subtypeSpec=constraint.ValueRangeConstraint(0, MAX)).subtype(
67
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 4)))
68
+ )
69
+
70
+
71
+ class TrustAnchorTitle(char.UTF8String):
72
+ pass
73
+
74
+ TrustAnchorTitle.subtypeSpec = constraint.ValueSizeConstraint(1, 64)
75
+
76
+
77
+ class TrustAnchorInfoVersion(univ.Integer):
78
+ pass
79
+
80
+ TrustAnchorInfoVersion.namedValues = namedval.NamedValues(
81
+ ('v1', 1)
82
+ )
83
+
84
+
85
+ class TrustAnchorInfo(univ.Sequence):
86
+ pass
87
+
88
+ TrustAnchorInfo.componentType = namedtype.NamedTypes(
89
+ namedtype.DefaultedNamedType('version', TrustAnchorInfoVersion().subtype(value='v1')),
90
+ namedtype.NamedType('pubKey', SubjectPublicKeyInfo()),
91
+ namedtype.NamedType('keyId', KeyIdentifier()),
92
+ namedtype.OptionalNamedType('taTitle', TrustAnchorTitle()),
93
+ namedtype.OptionalNamedType('certPath', CertPathControls()),
94
+ namedtype.OptionalNamedType('exts', Extensions().subtype(explicitTag=tag.Tag(
95
+ tag.tagClassContext, tag.tagFormatSimple, 1))),
96
+ namedtype.OptionalNamedType('taTitleLangTag', char.UTF8String().subtype(
97
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2)))
98
+ )
99
+
100
+
101
+ class TrustAnchorChoice(univ.Choice):
102
+ pass
103
+
104
+ TrustAnchorChoice.componentType = namedtype.NamedTypes(
105
+ namedtype.NamedType('certificate', Certificate()),
106
+ namedtype.NamedType('tbsCert', TBSCertificate().subtype(
107
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
108
+ namedtype.NamedType('taInfo', TrustAnchorInfo().subtype(
109
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 2)))
110
+ )
111
+
112
+
113
+ id_ct_trustAnchorList = univ.ObjectIdentifier('1.2.840.113549.1.9.16.1.34')
114
+
115
+ class TrustAnchorList(univ.SequenceOf):
116
+ pass
117
+
118
+ TrustAnchorList.componentType = TrustAnchorChoice()
119
+ TrustAnchorList.subtypeSpec=constraint.ValueSizeConstraint(1, MAX)
evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc5916.py ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ # Device Owner Attribute
10
+ #
11
+ # ASN.1 source from:
12
+ # https://www.rfc-editor.org/rfc/rfc5916.txt
13
+ #
14
+
15
+ from pyasn1.type import univ
16
+
17
+ from pyasn1_modules import rfc5280
18
+
19
+
20
+ # Device Owner Attribute
21
+
22
+ id_deviceOwner = univ.ObjectIdentifier((2, 16, 840, 1, 101, 2, 1, 5, 69))
23
+
24
+ at_deviceOwner = rfc5280.Attribute()
25
+ at_deviceOwner['type'] = id_deviceOwner
26
+ at_deviceOwner['values'][0] = univ.ObjectIdentifier()
27
+
28
+
29
+ # Add to the map of Attribute Type OIDs to Attributes in rfc5280.py.
30
+
31
+ _certificateAttributesMapUpdate = {
32
+ id_deviceOwner: univ.ObjectIdentifier(),
33
+ }
34
+
35
+ rfc5280.certificateAttributesMap.update(_certificateAttributesMapUpdate)
evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc5934.py ADDED
@@ -0,0 +1,786 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This file is being contributed to pyasn1-modules software.
2
+ #
3
+ # Created by Russ Housley with assistance from asn1ate v.0.6.0.
4
+ #
5
+ # Copyright (c) 2019, Vigil Security, LLC
6
+ # License: http://snmplabs.com/pyasn1/license.html
7
+ #
8
+ # Trust Anchor Format
9
+ #
10
+ # ASN.1 source from:
11
+ # https://www.rfc-editor.org/rfc/rfc5934.txt
12
+
13
+ from pyasn1.type import univ, char, namedtype, namedval, tag, constraint, useful
14
+
15
+ from pyasn1_modules import rfc2985
16
+ from pyasn1_modules import rfc5280
17
+ from pyasn1_modules import rfc5652
18
+ from pyasn1_modules import rfc5914
19
+
20
+ MAX = float('inf')
21
+
22
+
23
+ def _OID(*components):
24
+ output = []
25
+ for x in tuple(components):
26
+ if isinstance(x, univ.ObjectIdentifier):
27
+ output.extend(list(x))
28
+ else:
29
+ output.append(int(x))
30
+ return univ.ObjectIdentifier(output)
31
+
32
+
33
+ # Imports from RFC 2985
34
+
35
+ SingleAttribute = rfc2985.SingleAttribute
36
+
37
+
38
+ # Imports from RFC5914
39
+
40
+ CertPathControls = rfc5914.CertPathControls
41
+
42
+ TrustAnchorChoice = rfc5914.TrustAnchorChoice
43
+
44
+ TrustAnchorTitle = rfc5914.TrustAnchorTitle
45
+
46
+
47
+ # Imports from RFC 5280
48
+
49
+ AlgorithmIdentifier = rfc5280.AlgorithmIdentifier
50
+
51
+ AnotherName = rfc5280.AnotherName
52
+
53
+ Attribute = rfc5280.Attribute
54
+
55
+ Certificate = rfc5280.Certificate
56
+
57
+ CertificateSerialNumber = rfc5280.CertificateSerialNumber
58
+
59
+ Extension = rfc5280.Extension
60
+
61
+ Extensions = rfc5280.Extensions
62
+
63
+ KeyIdentifier = rfc5280.KeyIdentifier
64
+
65
+ Name = rfc5280.Name
66
+
67
+ SubjectPublicKeyInfo = rfc5280.SubjectPublicKeyInfo
68
+
69
+ TBSCertificate = rfc5280.TBSCertificate
70
+
71
+ Validity = rfc5280.Validity
72
+
73
+
74
+ # Object Identifier Arc for TAMP Message Content Types
75
+
76
+ id_tamp = univ.ObjectIdentifier('2.16.840.1.101.2.1.2.77')
77
+
78
+
79
+ # TAMP Status Query Message
80
+
81
+ id_ct_TAMP_statusQuery = _OID(id_tamp, 1)
82
+
83
+
84
+ class TAMPVersion(univ.Integer):
85
+ pass
86
+
87
+ TAMPVersion.namedValues = namedval.NamedValues(
88
+ ('v1', 1),
89
+ ('v2', 2)
90
+ )
91
+
92
+
93
+ class TerseOrVerbose(univ.Enumerated):
94
+ pass
95
+
96
+ TerseOrVerbose.namedValues = namedval.NamedValues(
97
+ ('terse', 1),
98
+ ('verbose', 2)
99
+ )
100
+
101
+
102
+ class HardwareSerialEntry(univ.Choice):
103
+ pass
104
+
105
+ HardwareSerialEntry.componentType = namedtype.NamedTypes(
106
+ namedtype.NamedType('all', univ.Null()),
107
+ namedtype.NamedType('single', univ.OctetString()),
108
+ namedtype.NamedType('block', univ.Sequence(componentType=namedtype.NamedTypes(
109
+ namedtype.NamedType('low', univ.OctetString()),
110
+ namedtype.NamedType('high', univ.OctetString())
111
+ ))
112
+ )
113
+ )
114
+
115
+
116
+ class HardwareModules(univ.Sequence):
117
+ pass
118
+
119
+ HardwareModules.componentType = namedtype.NamedTypes(
120
+ namedtype.NamedType('hwType', univ.ObjectIdentifier()),
121
+ namedtype.NamedType('hwSerialEntries', univ.SequenceOf(
122
+ componentType=HardwareSerialEntry()).subtype(
123
+ subtypeSpec=constraint.ValueSizeConstraint(1, MAX)))
124
+ )
125
+
126
+
127
+ class HardwareModuleIdentifierList(univ.SequenceOf):
128
+ pass
129
+
130
+ HardwareModuleIdentifierList.componentType = HardwareModules()
131
+ HardwareModuleIdentifierList.subtypeSpec=constraint.ValueSizeConstraint(1, MAX)
132
+
133
+
134
+ class Community(univ.ObjectIdentifier):
135
+ pass
136
+
137
+
138
+ class CommunityIdentifierList(univ.SequenceOf):
139
+ pass
140
+
141
+ CommunityIdentifierList.componentType = Community()
142
+ CommunityIdentifierList.subtypeSpec=constraint.ValueSizeConstraint(0, MAX)
143
+
144
+
145
+ class TargetIdentifier(univ.Choice):
146
+ pass
147
+
148
+ TargetIdentifier.componentType = namedtype.NamedTypes(
149
+ namedtype.NamedType('hwModules', HardwareModuleIdentifierList().subtype(
150
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
151
+ namedtype.NamedType('communities', CommunityIdentifierList().subtype(
152
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
153
+ namedtype.NamedType('allModules', univ.Null().subtype(
154
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3))),
155
+ namedtype.NamedType('uri', char.IA5String().subtype(
156
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 4))),
157
+ namedtype.NamedType('otherName', AnotherName().subtype(
158
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 5)))
159
+ )
160
+
161
+
162
+ class SeqNumber(univ.Integer):
163
+ pass
164
+
165
+ SeqNumber.subtypeSpec = constraint.ValueRangeConstraint(0, 9223372036854775807)
166
+
167
+
168
+ class TAMPMsgRef(univ.Sequence):
169
+ pass
170
+
171
+ TAMPMsgRef.componentType = namedtype.NamedTypes(
172
+ namedtype.NamedType('target', TargetIdentifier()),
173
+ namedtype.NamedType('seqNum', SeqNumber())
174
+ )
175
+
176
+
177
+ class TAMPStatusQuery(univ.Sequence):
178
+ pass
179
+
180
+ TAMPStatusQuery.componentType = namedtype.NamedTypes(
181
+ namedtype.DefaultedNamedType('version', TAMPVersion().subtype(
182
+ implicitTag=tag.Tag(tag.tagClassContext,
183
+ tag.tagFormatSimple, 0)).subtype(value='v2')),
184
+ namedtype.DefaultedNamedType('terse', TerseOrVerbose().subtype(
185
+ implicitTag=tag.Tag(tag.tagClassContext,
186
+ tag.tagFormatSimple, 1)).subtype(value='verbose')),
187
+ namedtype.NamedType('query', TAMPMsgRef())
188
+ )
189
+
190
+
191
+ tamp_status_query = rfc5652.ContentInfo()
192
+ tamp_status_query['contentType'] = id_ct_TAMP_statusQuery
193
+ tamp_status_query['content'] = TAMPStatusQuery()
194
+
195
+
196
+ # TAMP Status Response Message
197
+
198
+ id_ct_TAMP_statusResponse = _OID(id_tamp, 2)
199
+
200
+
201
+ class KeyIdentifiers(univ.SequenceOf):
202
+ pass
203
+
204
+ KeyIdentifiers.componentType = KeyIdentifier()
205
+ KeyIdentifiers.subtypeSpec=constraint.ValueSizeConstraint(1, MAX)
206
+
207
+
208
+ class TrustAnchorChoiceList(univ.SequenceOf):
209
+ pass
210
+
211
+ TrustAnchorChoiceList.componentType = TrustAnchorChoice()
212
+ TrustAnchorChoiceList.subtypeSpec=constraint.ValueSizeConstraint(1, MAX)
213
+
214
+
215
+ class TAMPSequenceNumber(univ.Sequence):
216
+ pass
217
+
218
+ TAMPSequenceNumber.componentType = namedtype.NamedTypes(
219
+ namedtype.NamedType('keyId', KeyIdentifier()),
220
+ namedtype.NamedType('seqNumber', SeqNumber())
221
+ )
222
+
223
+
224
+ class TAMPSequenceNumbers(univ.SequenceOf):
225
+ pass
226
+
227
+ TAMPSequenceNumbers.componentType = TAMPSequenceNumber()
228
+ TAMPSequenceNumbers.subtypeSpec=constraint.ValueSizeConstraint(1, MAX)
229
+
230
+
231
+ class TerseStatusResponse(univ.Sequence):
232
+ pass
233
+
234
+ TerseStatusResponse.componentType = namedtype.NamedTypes(
235
+ namedtype.NamedType('taKeyIds', KeyIdentifiers()),
236
+ namedtype.OptionalNamedType('communities', CommunityIdentifierList())
237
+ )
238
+
239
+
240
+ class VerboseStatusResponse(univ.Sequence):
241
+ pass
242
+
243
+ VerboseStatusResponse.componentType = namedtype.NamedTypes(
244
+ namedtype.NamedType('taInfo', TrustAnchorChoiceList()),
245
+ namedtype.OptionalNamedType('continPubKeyDecryptAlg',
246
+ AlgorithmIdentifier().subtype(implicitTag=tag.Tag(
247
+ tag.tagClassContext, tag.tagFormatSimple, 0))),
248
+ namedtype.OptionalNamedType('communities',
249
+ CommunityIdentifierList().subtype(implicitTag=tag.Tag(
250
+ tag.tagClassContext, tag.tagFormatSimple, 1))),
251
+ namedtype.OptionalNamedType('tampSeqNumbers',
252
+ TAMPSequenceNumbers().subtype(implicitTag=tag.Tag(
253
+ tag.tagClassContext, tag.tagFormatSimple, 2)))
254
+ )
255
+
256
+
257
+ class StatusResponse(univ.Choice):
258
+ pass
259
+
260
+ StatusResponse.componentType = namedtype.NamedTypes(
261
+ namedtype.NamedType('terseResponse', TerseStatusResponse().subtype(
262
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
263
+ namedtype.NamedType('verboseResponse', VerboseStatusResponse().subtype(
264
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1)))
265
+ )
266
+
267
+
268
+ class TAMPStatusResponse(univ.Sequence):
269
+ pass
270
+
271
+ TAMPStatusResponse.componentType = namedtype.NamedTypes(
272
+ namedtype.DefaultedNamedType('version', TAMPVersion().subtype(
273
+ implicitTag=tag.Tag(tag.tagClassContext,
274
+ tag.tagFormatSimple, 0)).subtype(value='v2')),
275
+ namedtype.NamedType('query', TAMPMsgRef()),
276
+ namedtype.NamedType('response', StatusResponse()),
277
+ namedtype.DefaultedNamedType('usesApex', univ.Boolean().subtype(value=1))
278
+ )
279
+
280
+
281
+ tamp_status_response = rfc5652.ContentInfo()
282
+ tamp_status_response['contentType'] = id_ct_TAMP_statusResponse
283
+ tamp_status_response['content'] = TAMPStatusResponse()
284
+
285
+
286
+ # Trust Anchor Update Message
287
+
288
+ id_ct_TAMP_update = _OID(id_tamp, 3)
289
+
290
+
291
+ class TBSCertificateChangeInfo(univ.Sequence):
292
+ pass
293
+
294
+ TBSCertificateChangeInfo.componentType = namedtype.NamedTypes(
295
+ namedtype.OptionalNamedType('serialNumber', CertificateSerialNumber()),
296
+ namedtype.OptionalNamedType('signature', AlgorithmIdentifier().subtype(
297
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
298
+ namedtype.OptionalNamedType('issuer', Name().subtype(implicitTag=tag.Tag(
299
+ tag.tagClassContext, tag.tagFormatSimple, 1))),
300
+ namedtype.OptionalNamedType('validity', Validity().subtype(
301
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
302
+ namedtype.OptionalNamedType('subject', Name().subtype(implicitTag=tag.Tag(
303
+ tag.tagClassContext, tag.tagFormatSimple, 3))),
304
+ namedtype.NamedType('subjectPublicKeyInfo', SubjectPublicKeyInfo().subtype(
305
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 4))),
306
+ namedtype.OptionalNamedType('exts', Extensions().subtype(explicitTag=tag.Tag(
307
+ tag.tagClassContext, tag.tagFormatSimple, 5)))
308
+ )
309
+
310
+
311
+ class TrustAnchorChangeInfo(univ.Sequence):
312
+ pass
313
+
314
+ TrustAnchorChangeInfo.componentType = namedtype.NamedTypes(
315
+ namedtype.NamedType('pubKey', SubjectPublicKeyInfo()),
316
+ namedtype.OptionalNamedType('keyId', KeyIdentifier()),
317
+ namedtype.OptionalNamedType('taTitle', TrustAnchorTitle()),
318
+ namedtype.OptionalNamedType('certPath', CertPathControls()),
319
+ namedtype.OptionalNamedType('exts', Extensions().subtype(
320
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
321
+ )
322
+
323
+
324
+ class TrustAnchorChangeInfoChoice(univ.Choice):
325
+ pass
326
+
327
+ TrustAnchorChangeInfoChoice.componentType = namedtype.NamedTypes(
328
+ namedtype.NamedType('tbsCertChange', TBSCertificateChangeInfo().subtype(
329
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
330
+ namedtype.NamedType('taChange', TrustAnchorChangeInfo().subtype(
331
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1)))
332
+ )
333
+
334
+
335
+ class TrustAnchorUpdate(univ.Choice):
336
+ pass
337
+
338
+ TrustAnchorUpdate.componentType = namedtype.NamedTypes(
339
+ namedtype.NamedType('add', TrustAnchorChoice().subtype(
340
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
341
+ namedtype.NamedType('remove', SubjectPublicKeyInfo().subtype(
342
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
343
+ namedtype.NamedType('change', TrustAnchorChangeInfoChoice().subtype(
344
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 3)))
345
+ )
346
+
347
+
348
+ class TAMPUpdate(univ.Sequence):
349
+ pass
350
+
351
+ TAMPUpdate.componentType = namedtype.NamedTypes(
352
+ namedtype.DefaultedNamedType('version',
353
+ TAMPVersion().subtype(implicitTag=tag.Tag(tag.tagClassContext,
354
+ tag.tagFormatSimple, 0)).subtype(value='v2')),
355
+ namedtype.DefaultedNamedType('terse',
356
+ TerseOrVerbose().subtype(implicitTag=tag.Tag(tag.tagClassContext,
357
+ tag.tagFormatSimple, 1)).subtype(value='verbose')),
358
+ namedtype.NamedType('msgRef', TAMPMsgRef()),
359
+ namedtype.NamedType('updates',
360
+ univ.SequenceOf(componentType=TrustAnchorUpdate()).subtype(
361
+ subtypeSpec=constraint.ValueSizeConstraint(1, MAX))),
362
+ namedtype.OptionalNamedType('tampSeqNumbers',
363
+ TAMPSequenceNumbers().subtype(implicitTag=tag.Tag(
364
+ tag.tagClassContext, tag.tagFormatSimple, 2)))
365
+ )
366
+
367
+
368
+ tamp_update = rfc5652.ContentInfo()
369
+ tamp_update['contentType'] = id_ct_TAMP_update
370
+ tamp_update['content'] = TAMPUpdate()
371
+
372
+
373
+ # Trust Anchor Update Confirm Message
374
+
375
+ id_ct_TAMP_updateConfirm = _OID(id_tamp, 4)
376
+
377
+
378
+ class StatusCode(univ.Enumerated):
379
+ pass
380
+
381
+ StatusCode.namedValues = namedval.NamedValues(
382
+ ('success', 0),
383
+ ('decodeFailure', 1),
384
+ ('badContentInfo', 2),
385
+ ('badSignedData', 3),
386
+ ('badEncapContent', 4),
387
+ ('badCertificate', 5),
388
+ ('badSignerInfo', 6),
389
+ ('badSignedAttrs', 7),
390
+ ('badUnsignedAttrs', 8),
391
+ ('missingContent', 9),
392
+ ('noTrustAnchor', 10),
393
+ ('notAuthorized', 11),
394
+ ('badDigestAlgorithm', 12),
395
+ ('badSignatureAlgorithm', 13),
396
+ ('unsupportedKeySize', 14),
397
+ ('unsupportedParameters', 15),
398
+ ('signatureFailure', 16),
399
+ ('insufficientMemory', 17),
400
+ ('unsupportedTAMPMsgType', 18),
401
+ ('apexTAMPAnchor', 19),
402
+ ('improperTAAddition', 20),
403
+ ('seqNumFailure', 21),
404
+ ('contingencyPublicKeyDecrypt', 22),
405
+ ('incorrectTarget', 23),
406
+ ('communityUpdateFailed', 24),
407
+ ('trustAnchorNotFound', 25),
408
+ ('unsupportedTAAlgorithm', 26),
409
+ ('unsupportedTAKeySize', 27),
410
+ ('unsupportedContinPubKeyDecryptAlg', 28),
411
+ ('missingSignature', 29),
412
+ ('resourcesBusy', 30),
413
+ ('versionNumberMismatch', 31),
414
+ ('missingPolicySet', 32),
415
+ ('revokedCertificate', 33),
416
+ ('unsupportedTrustAnchorFormat', 34),
417
+ ('improperTAChange', 35),
418
+ ('malformed', 36),
419
+ ('cmsError', 37),
420
+ ('unsupportedTargetIdentifier', 38),
421
+ ('other', 127)
422
+ )
423
+
424
+
425
+ class StatusCodeList(univ.SequenceOf):
426
+ pass
427
+
428
+ StatusCodeList.componentType = StatusCode()
429
+ StatusCodeList.subtypeSpec=constraint.ValueSizeConstraint(1, MAX)
430
+
431
+
432
+ class TerseUpdateConfirm(StatusCodeList):
433
+ pass
434
+
435
+
436
+ class VerboseUpdateConfirm(univ.Sequence):
437
+ pass
438
+
439
+ VerboseUpdateConfirm.componentType = namedtype.NamedTypes(
440
+ namedtype.NamedType('status', StatusCodeList()),
441
+ namedtype.NamedType('taInfo', TrustAnchorChoiceList()),
442
+ namedtype.OptionalNamedType('tampSeqNumbers', TAMPSequenceNumbers()),
443
+ namedtype.DefaultedNamedType('usesApex', univ.Boolean().subtype(value=1))
444
+ )
445
+
446
+
447
+ class UpdateConfirm(univ.Choice):
448
+ pass
449
+
450
+ UpdateConfirm.componentType = namedtype.NamedTypes(
451
+ namedtype.NamedType('terseConfirm', TerseUpdateConfirm().subtype(
452
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
453
+ namedtype.NamedType('verboseConfirm', VerboseUpdateConfirm().subtype(
454
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1)))
455
+ )
456
+
457
+
458
+ class TAMPUpdateConfirm(univ.Sequence):
459
+ pass
460
+
461
+ TAMPUpdateConfirm.componentType = namedtype.NamedTypes(
462
+ namedtype.DefaultedNamedType('version', TAMPVersion().subtype(
463
+ implicitTag=tag.Tag(tag.tagClassContext,
464
+ tag.tagFormatSimple, 0)).subtype(value='v2')),
465
+ namedtype.NamedType('update', TAMPMsgRef()),
466
+ namedtype.NamedType('confirm', UpdateConfirm())
467
+ )
468
+
469
+
470
+ tamp_update_confirm = rfc5652.ContentInfo()
471
+ tamp_update_confirm['contentType'] = id_ct_TAMP_updateConfirm
472
+ tamp_update_confirm['content'] = TAMPUpdateConfirm()
473
+
474
+
475
+ # Apex Trust Anchor Update Message
476
+
477
+ id_ct_TAMP_apexUpdate = _OID(id_tamp, 5)
478
+
479
+
480
+ class TAMPApexUpdate(univ.Sequence):
481
+ pass
482
+
483
+ TAMPApexUpdate.componentType = namedtype.NamedTypes(
484
+ namedtype.DefaultedNamedType('version',
485
+ TAMPVersion().subtype(implicitTag=tag.Tag(tag.tagClassContext,
486
+ tag.tagFormatSimple, 0)).subtype(value='v2')),
487
+ namedtype.DefaultedNamedType('terse',
488
+ TerseOrVerbose().subtype(implicitTag=tag.Tag(tag.tagClassContext,
489
+ tag.tagFormatSimple, 1)).subtype(value='verbose')),
490
+ namedtype.NamedType('msgRef', TAMPMsgRef()),
491
+ namedtype.NamedType('clearTrustAnchors', univ.Boolean()),
492
+ namedtype.NamedType('clearCommunities', univ.Boolean()),
493
+ namedtype.OptionalNamedType('seqNumber', SeqNumber()),
494
+ namedtype.NamedType('apexTA', TrustAnchorChoice())
495
+ )
496
+
497
+
498
+ tamp_apex_update = rfc5652.ContentInfo()
499
+ tamp_apex_update['contentType'] = id_ct_TAMP_apexUpdate
500
+ tamp_apex_update['content'] = TAMPApexUpdate()
501
+
502
+
503
+ # Apex Trust Anchor Update Confirm Message
504
+
505
+ id_ct_TAMP_apexUpdateConfirm = _OID(id_tamp, 6)
506
+
507
+
508
+ class TerseApexUpdateConfirm(StatusCode):
509
+ pass
510
+
511
+
512
+ class VerboseApexUpdateConfirm(univ.Sequence):
513
+ pass
514
+
515
+ VerboseApexUpdateConfirm.componentType = namedtype.NamedTypes(
516
+ namedtype.NamedType('status', StatusCode()),
517
+ namedtype.NamedType('taInfo', TrustAnchorChoiceList()),
518
+ namedtype.OptionalNamedType('communities',
519
+ CommunityIdentifierList().subtype(implicitTag=tag.Tag(tag.tagClassContext,
520
+ tag.tagFormatSimple, 0))),
521
+ namedtype.OptionalNamedType('tampSeqNumbers',
522
+ TAMPSequenceNumbers().subtype(implicitTag=tag.Tag(tag.tagClassContext,
523
+ tag.tagFormatSimple, 1)))
524
+ )
525
+
526
+
527
+ class ApexUpdateConfirm(univ.Choice):
528
+ pass
529
+
530
+ ApexUpdateConfirm.componentType = namedtype.NamedTypes(
531
+ namedtype.NamedType('terseApexConfirm',
532
+ TerseApexUpdateConfirm().subtype(implicitTag=tag.Tag(tag.tagClassContext,
533
+ tag.tagFormatSimple, 0))),
534
+ namedtype.NamedType('verboseApexConfirm',
535
+ VerboseApexUpdateConfirm().subtype(implicitTag=tag.Tag(tag.tagClassContext,
536
+ tag.tagFormatConstructed, 1)))
537
+ )
538
+
539
+
540
+ class TAMPApexUpdateConfirm(univ.Sequence):
541
+ pass
542
+
543
+ TAMPApexUpdateConfirm.componentType = namedtype.NamedTypes(
544
+ namedtype.DefaultedNamedType('version',
545
+ TAMPVersion().subtype(implicitTag=tag.Tag(tag.tagClassContext,
546
+ tag.tagFormatSimple, 0)).subtype(value='v2')),
547
+ namedtype.NamedType('apexReplace', TAMPMsgRef()),
548
+ namedtype.NamedType('apexConfirm', ApexUpdateConfirm())
549
+ )
550
+
551
+
552
+ tamp_apex_update_confirm = rfc5652.ContentInfo()
553
+ tamp_apex_update_confirm['contentType'] = id_ct_TAMP_apexUpdateConfirm
554
+ tamp_apex_update_confirm['content'] = TAMPApexUpdateConfirm()
555
+
556
+
557
+ # Community Update Message
558
+
559
+ id_ct_TAMP_communityUpdate = _OID(id_tamp, 7)
560
+
561
+
562
+ class CommunityUpdates(univ.Sequence):
563
+ pass
564
+
565
+ CommunityUpdates.componentType = namedtype.NamedTypes(
566
+ namedtype.OptionalNamedType('remove',
567
+ CommunityIdentifierList().subtype(implicitTag=tag.Tag(tag.tagClassContext,
568
+ tag.tagFormatSimple, 1))),
569
+ namedtype.OptionalNamedType('add',
570
+ CommunityIdentifierList().subtype(implicitTag=tag.Tag(tag.tagClassContext,
571
+ tag.tagFormatSimple, 2)))
572
+ )
573
+
574
+
575
+ class TAMPCommunityUpdate(univ.Sequence):
576
+ pass
577
+
578
+ TAMPCommunityUpdate.componentType = namedtype.NamedTypes(
579
+ namedtype.DefaultedNamedType('version',
580
+ TAMPVersion().subtype(implicitTag=tag.Tag(tag.tagClassContext,
581
+ tag.tagFormatSimple, 0)).subtype(value='v2')),
582
+ namedtype.DefaultedNamedType('terse',
583
+ TerseOrVerbose().subtype(implicitTag=tag.Tag(tag.tagClassContext,
584
+ tag.tagFormatSimple, 1)).subtype(value='verbose')),
585
+ namedtype.NamedType('msgRef', TAMPMsgRef()),
586
+ namedtype.NamedType('updates', CommunityUpdates())
587
+ )
588
+
589
+
590
+ tamp_community_update = rfc5652.ContentInfo()
591
+ tamp_community_update['contentType'] = id_ct_TAMP_communityUpdate
592
+ tamp_community_update['content'] = TAMPCommunityUpdate()
593
+
594
+
595
+ # Community Update Confirm Message
596
+
597
+ id_ct_TAMP_communityUpdateConfirm = _OID(id_tamp, 8)
598
+
599
+
600
+ class TerseCommunityConfirm(StatusCode):
601
+ pass
602
+
603
+
604
+ class VerboseCommunityConfirm(univ.Sequence):
605
+ pass
606
+
607
+ VerboseCommunityConfirm.componentType = namedtype.NamedTypes(
608
+ namedtype.NamedType('status', StatusCode()),
609
+ namedtype.OptionalNamedType('communities', CommunityIdentifierList())
610
+ )
611
+
612
+
613
+ class CommunityConfirm(univ.Choice):
614
+ pass
615
+
616
+ CommunityConfirm.componentType = namedtype.NamedTypes(
617
+ namedtype.NamedType('terseCommConfirm',
618
+ TerseCommunityConfirm().subtype(implicitTag=tag.Tag(tag.tagClassContext,
619
+ tag.tagFormatSimple, 0))),
620
+ namedtype.NamedType('verboseCommConfirm',
621
+ VerboseCommunityConfirm().subtype(implicitTag=tag.Tag(tag.tagClassContext,
622
+ tag.tagFormatConstructed, 1)))
623
+ )
624
+
625
+
626
+ class TAMPCommunityUpdateConfirm(univ.Sequence):
627
+ pass
628
+
629
+ TAMPCommunityUpdateConfirm.componentType = namedtype.NamedTypes(
630
+ namedtype.DefaultedNamedType('version',
631
+ TAMPVersion().subtype(implicitTag=tag.Tag(tag.tagClassContext,
632
+ tag.tagFormatSimple, 0)).subtype(value='v2')),
633
+ namedtype.NamedType('update', TAMPMsgRef()),
634
+ namedtype.NamedType('commConfirm', CommunityConfirm())
635
+ )
636
+
637
+
638
+ tamp_community_update_confirm = rfc5652.ContentInfo()
639
+ tamp_community_update_confirm['contentType'] = id_ct_TAMP_communityUpdateConfirm
640
+ tamp_community_update_confirm['content'] = TAMPCommunityUpdateConfirm()
641
+
642
+
643
+ # Sequence Number Adjust Message
644
+
645
+ id_ct_TAMP_seqNumAdjust = _OID(id_tamp, 10)
646
+
647
+
648
+
649
+ class SequenceNumberAdjust(univ.Sequence):
650
+ pass
651
+
652
+ SequenceNumberAdjust.componentType = namedtype.NamedTypes(
653
+ namedtype.DefaultedNamedType('version',
654
+ TAMPVersion().subtype(implicitTag=tag.Tag(tag.tagClassContext,
655
+ tag.tagFormatSimple, 0)).subtype(value='v2')),
656
+ namedtype.NamedType('msgRef', TAMPMsgRef())
657
+ )
658
+
659
+
660
+ tamp_sequence_number_adjust = rfc5652.ContentInfo()
661
+ tamp_sequence_number_adjust['contentType'] = id_ct_TAMP_seqNumAdjust
662
+ tamp_sequence_number_adjust['content'] = SequenceNumberAdjust()
663
+
664
+
665
+ # Sequence Number Adjust Confirm Message
666
+
667
+ id_ct_TAMP_seqNumAdjustConfirm = _OID(id_tamp, 11)
668
+
669
+
670
+ class SequenceNumberAdjustConfirm(univ.Sequence):
671
+ pass
672
+
673
+ SequenceNumberAdjustConfirm.componentType = namedtype.NamedTypes(
674
+ namedtype.DefaultedNamedType('version',
675
+ TAMPVersion().subtype(implicitTag=tag.Tag(tag.tagClassContext,
676
+ tag.tagFormatSimple, 0)).subtype(value='v2')),
677
+ namedtype.NamedType('adjust', TAMPMsgRef()),
678
+ namedtype.NamedType('status', StatusCode())
679
+ )
680
+
681
+
682
+ tamp_sequence_number_adjust_confirm = rfc5652.ContentInfo()
683
+ tamp_sequence_number_adjust_confirm['contentType'] = id_ct_TAMP_seqNumAdjustConfirm
684
+ tamp_sequence_number_adjust_confirm['content'] = SequenceNumberAdjustConfirm()
685
+
686
+
687
+ # TAMP Error Message
688
+
689
+ id_ct_TAMP_error = _OID(id_tamp, 9)
690
+
691
+
692
+ class TAMPError(univ.Sequence):
693
+ pass
694
+
695
+ TAMPError.componentType = namedtype.NamedTypes(
696
+ namedtype.DefaultedNamedType('version',
697
+ TAMPVersion().subtype(implicitTag=tag.Tag(tag.tagClassContext,
698
+ tag.tagFormatSimple, 0)).subtype(value='v2')),
699
+ namedtype.NamedType('msgType', univ.ObjectIdentifier()),
700
+ namedtype.NamedType('status', StatusCode()),
701
+ namedtype.OptionalNamedType('msgRef', TAMPMsgRef())
702
+ )
703
+
704
+
705
+ tamp_error = rfc5652.ContentInfo()
706
+ tamp_error['contentType'] = id_ct_TAMP_error
707
+ tamp_error['content'] = TAMPError()
708
+
709
+
710
+ # Object Identifier Arc for Attributes
711
+
712
+ id_attributes = univ.ObjectIdentifier('2.16.840.1.101.2.1.5')
713
+
714
+
715
+ # contingency-public-key-decrypt-key unsigned attribute
716
+
717
+ id_aa_TAMP_contingencyPublicKeyDecryptKey = _OID(id_attributes, 63)
718
+
719
+
720
+ class PlaintextSymmetricKey(univ.OctetString):
721
+ pass
722
+
723
+
724
+ contingency_public_key_decrypt_key = Attribute()
725
+ contingency_public_key_decrypt_key['type'] = id_aa_TAMP_contingencyPublicKeyDecryptKey
726
+ contingency_public_key_decrypt_key['values'][0] = PlaintextSymmetricKey()
727
+
728
+
729
+ # id-pe-wrappedApexContinKey extension
730
+
731
+ id_pe_wrappedApexContinKey =univ.ObjectIdentifier('1.3.6.1.5.5.7.1.20')
732
+
733
+
734
+ class ApexContingencyKey(univ.Sequence):
735
+ pass
736
+
737
+ ApexContingencyKey.componentType = namedtype.NamedTypes(
738
+ namedtype.NamedType('wrapAlgorithm', AlgorithmIdentifier()),
739
+ namedtype.NamedType('wrappedContinPubKey', univ.OctetString())
740
+ )
741
+
742
+
743
+ wrappedApexContinKey = Extension()
744
+ wrappedApexContinKey['extnID'] = id_pe_wrappedApexContinKey
745
+ wrappedApexContinKey['critical'] = 0
746
+ wrappedApexContinKey['extnValue'] = univ.OctetString()
747
+
748
+
749
+ # Add to the map of CMS Content Type OIDs to Content Types in
750
+ # rfc5652.py
751
+
752
+ _cmsContentTypesMapUpdate = {
753
+ id_ct_TAMP_statusQuery: TAMPStatusQuery(),
754
+ id_ct_TAMP_statusResponse: TAMPStatusResponse(),
755
+ id_ct_TAMP_update: TAMPUpdate(),
756
+ id_ct_TAMP_updateConfirm: TAMPUpdateConfirm(),
757
+ id_ct_TAMP_apexUpdate: TAMPApexUpdate(),
758
+ id_ct_TAMP_apexUpdateConfirm: TAMPApexUpdateConfirm(),
759
+ id_ct_TAMP_communityUpdate: TAMPCommunityUpdate(),
760
+ id_ct_TAMP_communityUpdateConfirm: TAMPCommunityUpdateConfirm(),
761
+ id_ct_TAMP_seqNumAdjust: SequenceNumberAdjust(),
762
+ id_ct_TAMP_seqNumAdjustConfirm: SequenceNumberAdjustConfirm(),
763
+ id_ct_TAMP_error: TAMPError(),
764
+ }
765
+
766
+ rfc5652.cmsContentTypesMap.update(_cmsContentTypesMapUpdate)
767
+
768
+
769
+ # Add to the map of CMS Attribute OIDs to Attribute Values in
770
+ # rfc5652.py
771
+
772
+ _cmsAttributesMapUpdate = {
773
+ id_aa_TAMP_contingencyPublicKeyDecryptKey: PlaintextSymmetricKey(),
774
+ }
775
+
776
+ rfc5652.cmsAttributesMap.update(_cmsAttributesMapUpdate)
777
+
778
+
779
+ # Add to the map of Certificate Extension OIDs to Extensions in
780
+ # rfc5280.py
781
+
782
+ _certificateExtensionsMap = {
783
+ id_pe_wrappedApexContinKey: ApexContingencyKey(),
784
+ }
785
+
786
+ rfc5280.certificateExtensionsMap.update(_certificateExtensionsMap)
evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc6010.py ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #
2
+ # This file is part of pyasn1-modules software.
3
+ #
4
+ # Created by Russ Housley with assistance from asn1ate v.0.6.0.
5
+ # Modified by Russ Housley to add maps for use with opentypes.
6
+ #
7
+ # Copyright (c) 2019, Vigil Security, LLC
8
+ # License: http://snmplabs.com/pyasn1/license.html
9
+ #
10
+ # Certificate Extension for CMS Content Constraints (CCC)
11
+ #
12
+ # ASN.1 source from:
13
+ # https://www.rfc-editor.org/rfc/rfc6010.txt
14
+ #
15
+
16
+ from pyasn1.type import constraint
17
+ from pyasn1.type import namedtype
18
+ from pyasn1.type import namedval
19
+ from pyasn1.type import univ
20
+
21
+ from pyasn1_modules import rfc5280
22
+
23
+ MAX = float('inf')
24
+
25
+
26
+ AttributeType = rfc5280.AttributeType
27
+
28
+ AttributeValue = rfc5280.AttributeValue
29
+
30
+
31
+ id_ct_anyContentType = univ.ObjectIdentifier('1.2.840.113549.1.9.16.1.0')
32
+
33
+
34
+ class AttrConstraint(univ.Sequence):
35
+ pass
36
+
37
+ AttrConstraint.componentType = namedtype.NamedTypes(
38
+ namedtype.NamedType('attrType', AttributeType()),
39
+ namedtype.NamedType('attrValues', univ.SetOf(
40
+ componentType=AttributeValue()).subtype(subtypeSpec=constraint.ValueSizeConstraint(1, MAX)))
41
+ )
42
+
43
+
44
+ class AttrConstraintList(univ.SequenceOf):
45
+ pass
46
+
47
+ AttrConstraintList.componentType = AttrConstraint()
48
+ AttrConstraintList.subtypeSpec=constraint.ValueSizeConstraint(1, MAX)
49
+
50
+
51
+ class ContentTypeGeneration(univ.Enumerated):
52
+ pass
53
+
54
+ ContentTypeGeneration.namedValues = namedval.NamedValues(
55
+ ('canSource', 0),
56
+ ('cannotSource', 1)
57
+ )
58
+
59
+
60
+ class ContentTypeConstraint(univ.Sequence):
61
+ pass
62
+
63
+ ContentTypeConstraint.componentType = namedtype.NamedTypes(
64
+ namedtype.NamedType('contentType', univ.ObjectIdentifier()),
65
+ namedtype.DefaultedNamedType('canSource', ContentTypeGeneration().subtype(value='canSource')),
66
+ namedtype.OptionalNamedType('attrConstraints', AttrConstraintList())
67
+ )
68
+
69
+
70
+ # CMS Content Constraints (CCC) Extension and Object Identifier
71
+
72
+ id_pe_cmsContentConstraints = univ.ObjectIdentifier('1.3.6.1.5.5.7.1.18')
73
+
74
+ class CMSContentConstraints(univ.SequenceOf):
75
+ pass
76
+
77
+ CMSContentConstraints.componentType = ContentTypeConstraint()
78
+ CMSContentConstraints.subtypeSpec=constraint.ValueSizeConstraint(1, MAX)
79
+
80
+
81
+ # Map of Certificate Extension OIDs to Extensions
82
+ # To be added to the ones that are in rfc5280.py
83
+
84
+ _certificateExtensionsMap = {
85
+ id_pe_cmsContentConstraints: CMSContentConstraints(),
86
+ }
87
+
88
+ rfc5280.certificateExtensionsMap.update(_certificateExtensionsMap)
evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc6402.py ADDED
@@ -0,0 +1,628 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding: utf-8
2
+ #
3
+ # This file is part of pyasn1-modules software.
4
+ #
5
+ # Created by Stanisław Pitucha with asn1ate tool.
6
+ # Modified by Russ Housley to add a maps for CMC Control Attributes
7
+ # and CMC Content Types for use with opentypes.
8
+ #
9
+ # Copyright (c) 2005-2020, Ilya Etingof <etingof@gmail.com>
10
+ # License: http://snmplabs.com/pyasn1/license.html
11
+ #
12
+ # Certificate Management over CMS (CMC) Updates
13
+ #
14
+ # ASN.1 source from:
15
+ # https://www.rfc-editor.org/rfc/rfc6402.txt
16
+ #
17
+ from pyasn1.type import char
18
+ from pyasn1.type import constraint
19
+ from pyasn1.type import namedtype
20
+ from pyasn1.type import namedval
21
+ from pyasn1.type import opentype
22
+ from pyasn1.type import tag
23
+ from pyasn1.type import univ
24
+ from pyasn1.type import useful
25
+
26
+ from pyasn1_modules import rfc4211
27
+ from pyasn1_modules import rfc5280
28
+ from pyasn1_modules import rfc5652
29
+
30
+ MAX = float('inf')
31
+
32
+
33
+ def _buildOid(*components):
34
+ output = []
35
+ for x in tuple(components):
36
+ if isinstance(x, univ.ObjectIdentifier):
37
+ output.extend(list(x))
38
+ else:
39
+ output.append(int(x))
40
+
41
+ return univ.ObjectIdentifier(output)
42
+
43
+
44
+ # Since CMS Attributes and CMC Controls both use 'attrType', one map is used
45
+ cmcControlAttributesMap = rfc5652.cmsAttributesMap
46
+
47
+
48
+ class ChangeSubjectName(univ.Sequence):
49
+ pass
50
+
51
+
52
+ ChangeSubjectName.componentType = namedtype.NamedTypes(
53
+ namedtype.OptionalNamedType('subject', rfc5280.Name()),
54
+ namedtype.OptionalNamedType('subjectAlt', rfc5280.GeneralNames())
55
+ )
56
+
57
+
58
+ class AttributeValue(univ.Any):
59
+ pass
60
+
61
+
62
+ class CMCStatus(univ.Integer):
63
+ pass
64
+
65
+
66
+ CMCStatus.namedValues = namedval.NamedValues(
67
+ ('success', 0),
68
+ ('failed', 2),
69
+ ('pending', 3),
70
+ ('noSupport', 4),
71
+ ('confirmRequired', 5),
72
+ ('popRequired', 6),
73
+ ('partial', 7)
74
+ )
75
+
76
+
77
+ class PendInfo(univ.Sequence):
78
+ pass
79
+
80
+
81
+ PendInfo.componentType = namedtype.NamedTypes(
82
+ namedtype.NamedType('pendToken', univ.OctetString()),
83
+ namedtype.NamedType('pendTime', useful.GeneralizedTime())
84
+ )
85
+
86
+ bodyIdMax = univ.Integer(4294967295)
87
+
88
+
89
+ class BodyPartID(univ.Integer):
90
+ pass
91
+
92
+
93
+ BodyPartID.subtypeSpec = constraint.ValueRangeConstraint(0, bodyIdMax)
94
+
95
+
96
+ class BodyPartPath(univ.SequenceOf):
97
+ pass
98
+
99
+
100
+ BodyPartPath.componentType = BodyPartID()
101
+ BodyPartPath.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
102
+
103
+
104
+ class BodyPartReference(univ.Choice):
105
+ pass
106
+
107
+
108
+ BodyPartReference.componentType = namedtype.NamedTypes(
109
+ namedtype.NamedType('bodyPartID', BodyPartID()),
110
+ namedtype.NamedType('bodyPartPath', BodyPartPath())
111
+ )
112
+
113
+
114
+ class CMCFailInfo(univ.Integer):
115
+ pass
116
+
117
+
118
+ CMCFailInfo.namedValues = namedval.NamedValues(
119
+ ('badAlg', 0),
120
+ ('badMessageCheck', 1),
121
+ ('badRequest', 2),
122
+ ('badTime', 3),
123
+ ('badCertId', 4),
124
+ ('unsupportedExt', 5),
125
+ ('mustArchiveKeys', 6),
126
+ ('badIdentity', 7),
127
+ ('popRequired', 8),
128
+ ('popFailed', 9),
129
+ ('noKeyReuse', 10),
130
+ ('internalCAError', 11),
131
+ ('tryLater', 12),
132
+ ('authDataFail', 13)
133
+ )
134
+
135
+
136
+ class CMCStatusInfoV2(univ.Sequence):
137
+ pass
138
+
139
+
140
+ CMCStatusInfoV2.componentType = namedtype.NamedTypes(
141
+ namedtype.NamedType('cMCStatus', CMCStatus()),
142
+ namedtype.NamedType('bodyList', univ.SequenceOf(componentType=BodyPartReference())),
143
+ namedtype.OptionalNamedType('statusString', char.UTF8String()),
144
+ namedtype.OptionalNamedType(
145
+ 'otherInfo', univ.Choice(
146
+ componentType=namedtype.NamedTypes(
147
+ namedtype.NamedType('failInfo', CMCFailInfo()),
148
+ namedtype.NamedType('pendInfo', PendInfo()),
149
+ namedtype.NamedType(
150
+ 'extendedFailInfo', univ.Sequence(
151
+ componentType=namedtype.NamedTypes(
152
+ namedtype.NamedType('failInfoOID', univ.ObjectIdentifier()),
153
+ namedtype.NamedType('failInfoValue', AttributeValue()))
154
+ )
155
+ )
156
+ )
157
+ )
158
+ )
159
+ )
160
+
161
+
162
+ class GetCRL(univ.Sequence):
163
+ pass
164
+
165
+
166
+ GetCRL.componentType = namedtype.NamedTypes(
167
+ namedtype.NamedType('issuerName', rfc5280.Name()),
168
+ namedtype.OptionalNamedType('cRLName', rfc5280.GeneralName()),
169
+ namedtype.OptionalNamedType('time', useful.GeneralizedTime()),
170
+ namedtype.OptionalNamedType('reasons', rfc5280.ReasonFlags())
171
+ )
172
+
173
+ id_pkix = _buildOid(1, 3, 6, 1, 5, 5, 7)
174
+
175
+ id_cmc = _buildOid(id_pkix, 7)
176
+
177
+ id_cmc_batchResponses = _buildOid(id_cmc, 29)
178
+
179
+ id_cmc_popLinkWitness = _buildOid(id_cmc, 23)
180
+
181
+
182
+ class PopLinkWitnessV2(univ.Sequence):
183
+ pass
184
+
185
+
186
+ PopLinkWitnessV2.componentType = namedtype.NamedTypes(
187
+ namedtype.NamedType('keyGenAlgorithm', rfc5280.AlgorithmIdentifier()),
188
+ namedtype.NamedType('macAlgorithm', rfc5280.AlgorithmIdentifier()),
189
+ namedtype.NamedType('witness', univ.OctetString())
190
+ )
191
+
192
+ id_cmc_popLinkWitnessV2 = _buildOid(id_cmc, 33)
193
+
194
+ id_cmc_identityProofV2 = _buildOid(id_cmc, 34)
195
+
196
+ id_cmc_revokeRequest = _buildOid(id_cmc, 17)
197
+
198
+ id_cmc_recipientNonce = _buildOid(id_cmc, 7)
199
+
200
+
201
+ class ControlsProcessed(univ.Sequence):
202
+ pass
203
+
204
+
205
+ ControlsProcessed.componentType = namedtype.NamedTypes(
206
+ namedtype.NamedType('bodyList', univ.SequenceOf(componentType=BodyPartReference()))
207
+ )
208
+
209
+
210
+ class CertificationRequest(univ.Sequence):
211
+ pass
212
+
213
+
214
+ CertificationRequest.componentType = namedtype.NamedTypes(
215
+ namedtype.NamedType(
216
+ 'certificationRequestInfo', univ.Sequence(
217
+ componentType=namedtype.NamedTypes(
218
+ namedtype.NamedType('version', univ.Integer()),
219
+ namedtype.NamedType('subject', rfc5280.Name()),
220
+ namedtype.NamedType(
221
+ 'subjectPublicKeyInfo', univ.Sequence(
222
+ componentType=namedtype.NamedTypes(
223
+ namedtype.NamedType('algorithm', rfc5280.AlgorithmIdentifier()),
224
+ namedtype.NamedType('subjectPublicKey', univ.BitString())
225
+ )
226
+ )
227
+ ),
228
+ namedtype.NamedType(
229
+ 'attributes', univ.SetOf(
230
+ componentType=rfc5652.Attribute()).subtype(
231
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))
232
+ )
233
+ )
234
+ )
235
+ ),
236
+ namedtype.NamedType('signatureAlgorithm', rfc5280.AlgorithmIdentifier()),
237
+ namedtype.NamedType('signature', univ.BitString())
238
+ )
239
+
240
+
241
+ class TaggedCertificationRequest(univ.Sequence):
242
+ pass
243
+
244
+
245
+ TaggedCertificationRequest.componentType = namedtype.NamedTypes(
246
+ namedtype.NamedType('bodyPartID', BodyPartID()),
247
+ namedtype.NamedType('certificationRequest', CertificationRequest())
248
+ )
249
+
250
+
251
+ class TaggedRequest(univ.Choice):
252
+ pass
253
+
254
+
255
+ TaggedRequest.componentType = namedtype.NamedTypes(
256
+ namedtype.NamedType('tcr', TaggedCertificationRequest().subtype(
257
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
258
+ namedtype.NamedType('crm',
259
+ rfc4211.CertReqMsg().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
260
+ namedtype.NamedType('orm', univ.Sequence(componentType=namedtype.NamedTypes(
261
+ namedtype.NamedType('bodyPartID', BodyPartID()),
262
+ namedtype.NamedType('requestMessageType', univ.ObjectIdentifier()),
263
+ namedtype.NamedType('requestMessageValue', univ.Any())
264
+ ))
265
+ .subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 2)))
266
+ )
267
+
268
+ id_cmc_popLinkRandom = _buildOid(id_cmc, 22)
269
+
270
+ id_cmc_statusInfo = _buildOid(id_cmc, 1)
271
+
272
+ id_cmc_trustedAnchors = _buildOid(id_cmc, 26)
273
+
274
+ id_cmc_transactionId = _buildOid(id_cmc, 5)
275
+
276
+ id_cmc_encryptedPOP = _buildOid(id_cmc, 9)
277
+
278
+
279
+ class PublishTrustAnchors(univ.Sequence):
280
+ pass
281
+
282
+
283
+ PublishTrustAnchors.componentType = namedtype.NamedTypes(
284
+ namedtype.NamedType('seqNumber', univ.Integer()),
285
+ namedtype.NamedType('hashAlgorithm', rfc5280.AlgorithmIdentifier()),
286
+ namedtype.NamedType('anchorHashes', univ.SequenceOf(componentType=univ.OctetString()))
287
+ )
288
+
289
+
290
+ class RevokeRequest(univ.Sequence):
291
+ pass
292
+
293
+
294
+ RevokeRequest.componentType = namedtype.NamedTypes(
295
+ namedtype.NamedType('issuerName', rfc5280.Name()),
296
+ namedtype.NamedType('serialNumber', univ.Integer()),
297
+ namedtype.NamedType('reason', rfc5280.CRLReason()),
298
+ namedtype.OptionalNamedType('invalidityDate', useful.GeneralizedTime()),
299
+ namedtype.OptionalNamedType('passphrase', univ.OctetString()),
300
+ namedtype.OptionalNamedType('comment', char.UTF8String())
301
+ )
302
+
303
+ id_cmc_senderNonce = _buildOid(id_cmc, 6)
304
+
305
+ id_cmc_authData = _buildOid(id_cmc, 27)
306
+
307
+
308
+ class TaggedContentInfo(univ.Sequence):
309
+ pass
310
+
311
+
312
+ TaggedContentInfo.componentType = namedtype.NamedTypes(
313
+ namedtype.NamedType('bodyPartID', BodyPartID()),
314
+ namedtype.NamedType('contentInfo', rfc5652.ContentInfo())
315
+ )
316
+
317
+
318
+ class IdentifyProofV2(univ.Sequence):
319
+ pass
320
+
321
+
322
+ IdentifyProofV2.componentType = namedtype.NamedTypes(
323
+ namedtype.NamedType('proofAlgID', rfc5280.AlgorithmIdentifier()),
324
+ namedtype.NamedType('macAlgId', rfc5280.AlgorithmIdentifier()),
325
+ namedtype.NamedType('witness', univ.OctetString())
326
+ )
327
+
328
+
329
+ class CMCPublicationInfo(univ.Sequence):
330
+ pass
331
+
332
+
333
+ CMCPublicationInfo.componentType = namedtype.NamedTypes(
334
+ namedtype.NamedType('hashAlg', rfc5280.AlgorithmIdentifier()),
335
+ namedtype.NamedType('certHashes', univ.SequenceOf(componentType=univ.OctetString())),
336
+ namedtype.NamedType('pubInfo', rfc4211.PKIPublicationInfo())
337
+ )
338
+
339
+ id_kp_cmcCA = _buildOid(rfc5280.id_kp, 27)
340
+
341
+ id_cmc_confirmCertAcceptance = _buildOid(id_cmc, 24)
342
+
343
+ id_cmc_raIdentityWitness = _buildOid(id_cmc, 35)
344
+
345
+ id_ExtensionReq = _buildOid(1, 2, 840, 113549, 1, 9, 14)
346
+
347
+ id_cct = _buildOid(id_pkix, 12)
348
+
349
+ id_cct_PKIData = _buildOid(id_cct, 2)
350
+
351
+ id_kp_cmcRA = _buildOid(rfc5280.id_kp, 28)
352
+
353
+
354
+ class CMCStatusInfo(univ.Sequence):
355
+ pass
356
+
357
+
358
+ CMCStatusInfo.componentType = namedtype.NamedTypes(
359
+ namedtype.NamedType('cMCStatus', CMCStatus()),
360
+ namedtype.NamedType('bodyList', univ.SequenceOf(componentType=BodyPartID())),
361
+ namedtype.OptionalNamedType('statusString', char.UTF8String()),
362
+ namedtype.OptionalNamedType(
363
+ 'otherInfo', univ.Choice(
364
+ componentType=namedtype.NamedTypes(
365
+ namedtype.NamedType('failInfo', CMCFailInfo()),
366
+ namedtype.NamedType('pendInfo', PendInfo())
367
+ )
368
+ )
369
+ )
370
+ )
371
+
372
+
373
+ class DecryptedPOP(univ.Sequence):
374
+ pass
375
+
376
+
377
+ DecryptedPOP.componentType = namedtype.NamedTypes(
378
+ namedtype.NamedType('bodyPartID', BodyPartID()),
379
+ namedtype.NamedType('thePOPAlgID', rfc5280.AlgorithmIdentifier()),
380
+ namedtype.NamedType('thePOP', univ.OctetString())
381
+ )
382
+
383
+ id_cmc_addExtensions = _buildOid(id_cmc, 8)
384
+
385
+ id_cmc_modCertTemplate = _buildOid(id_cmc, 31)
386
+
387
+
388
+ class TaggedAttribute(univ.Sequence):
389
+ pass
390
+
391
+
392
+ TaggedAttribute.componentType = namedtype.NamedTypes(
393
+ namedtype.NamedType('bodyPartID', BodyPartID()),
394
+ namedtype.NamedType('attrType', univ.ObjectIdentifier()),
395
+ namedtype.NamedType('attrValues', univ.SetOf(componentType=AttributeValue()),
396
+ openType=opentype.OpenType('attrType', cmcControlAttributesMap)
397
+ )
398
+ )
399
+
400
+
401
+ class OtherMsg(univ.Sequence):
402
+ pass
403
+
404
+
405
+ OtherMsg.componentType = namedtype.NamedTypes(
406
+ namedtype.NamedType('bodyPartID', BodyPartID()),
407
+ namedtype.NamedType('otherMsgType', univ.ObjectIdentifier()),
408
+ namedtype.NamedType('otherMsgValue', univ.Any())
409
+ )
410
+
411
+
412
+ class PKIData(univ.Sequence):
413
+ pass
414
+
415
+
416
+ PKIData.componentType = namedtype.NamedTypes(
417
+ namedtype.NamedType('controlSequence', univ.SequenceOf(componentType=TaggedAttribute())),
418
+ namedtype.NamedType('reqSequence', univ.SequenceOf(componentType=TaggedRequest())),
419
+ namedtype.NamedType('cmsSequence', univ.SequenceOf(componentType=TaggedContentInfo())),
420
+ namedtype.NamedType('otherMsgSequence', univ.SequenceOf(componentType=OtherMsg()))
421
+ )
422
+
423
+
424
+ class BodyPartList(univ.SequenceOf):
425
+ pass
426
+
427
+
428
+ BodyPartList.componentType = BodyPartID()
429
+ BodyPartList.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
430
+
431
+ id_cmc_responseBody = _buildOid(id_cmc, 37)
432
+
433
+
434
+ class AuthPublish(BodyPartID):
435
+ pass
436
+
437
+
438
+ class CMCUnsignedData(univ.Sequence):
439
+ pass
440
+
441
+
442
+ CMCUnsignedData.componentType = namedtype.NamedTypes(
443
+ namedtype.NamedType('bodyPartPath', BodyPartPath()),
444
+ namedtype.NamedType('identifier', univ.ObjectIdentifier()),
445
+ namedtype.NamedType('content', univ.Any())
446
+ )
447
+
448
+
449
+ class CMCCertId(rfc5652.IssuerAndSerialNumber):
450
+ pass
451
+
452
+
453
+ class PKIResponse(univ.Sequence):
454
+ pass
455
+
456
+
457
+ PKIResponse.componentType = namedtype.NamedTypes(
458
+ namedtype.NamedType('controlSequence', univ.SequenceOf(componentType=TaggedAttribute())),
459
+ namedtype.NamedType('cmsSequence', univ.SequenceOf(componentType=TaggedContentInfo())),
460
+ namedtype.NamedType('otherMsgSequence', univ.SequenceOf(componentType=OtherMsg()))
461
+ )
462
+
463
+
464
+ class ResponseBody(PKIResponse):
465
+ pass
466
+
467
+
468
+ id_cmc_statusInfoV2 = _buildOid(id_cmc, 25)
469
+
470
+ id_cmc_lraPOPWitness = _buildOid(id_cmc, 11)
471
+
472
+
473
+ class ModCertTemplate(univ.Sequence):
474
+ pass
475
+
476
+
477
+ ModCertTemplate.componentType = namedtype.NamedTypes(
478
+ namedtype.NamedType('pkiDataReference', BodyPartPath()),
479
+ namedtype.NamedType('certReferences', BodyPartList()),
480
+ namedtype.DefaultedNamedType('replace', univ.Boolean().subtype(value=1)),
481
+ namedtype.NamedType('certTemplate', rfc4211.CertTemplate())
482
+ )
483
+
484
+ id_cmc_regInfo = _buildOid(id_cmc, 18)
485
+
486
+ id_cmc_identityProof = _buildOid(id_cmc, 3)
487
+
488
+
489
+ class ExtensionReq(univ.SequenceOf):
490
+ pass
491
+
492
+
493
+ ExtensionReq.componentType = rfc5280.Extension()
494
+ ExtensionReq.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
495
+
496
+ id_kp_cmcArchive = _buildOid(rfc5280.id_kp, 28)
497
+
498
+ id_cmc_publishCert = _buildOid(id_cmc, 30)
499
+
500
+ id_cmc_dataReturn = _buildOid(id_cmc, 4)
501
+
502
+
503
+ class LraPopWitness(univ.Sequence):
504
+ pass
505
+
506
+
507
+ LraPopWitness.componentType = namedtype.NamedTypes(
508
+ namedtype.NamedType('pkiDataBodyid', BodyPartID()),
509
+ namedtype.NamedType('bodyIds', univ.SequenceOf(componentType=BodyPartID()))
510
+ )
511
+
512
+ id_aa = _buildOid(1, 2, 840, 113549, 1, 9, 16, 2)
513
+
514
+ id_aa_cmc_unsignedData = _buildOid(id_aa, 34)
515
+
516
+ id_cmc_getCert = _buildOid(id_cmc, 15)
517
+
518
+ id_cmc_batchRequests = _buildOid(id_cmc, 28)
519
+
520
+ id_cmc_decryptedPOP = _buildOid(id_cmc, 10)
521
+
522
+ id_cmc_responseInfo = _buildOid(id_cmc, 19)
523
+
524
+ id_cmc_changeSubjectName = _buildOid(id_cmc, 36)
525
+
526
+
527
+ class GetCert(univ.Sequence):
528
+ pass
529
+
530
+
531
+ GetCert.componentType = namedtype.NamedTypes(
532
+ namedtype.NamedType('issuerName', rfc5280.GeneralName()),
533
+ namedtype.NamedType('serialNumber', univ.Integer())
534
+ )
535
+
536
+ id_cmc_identification = _buildOid(id_cmc, 2)
537
+
538
+ id_cmc_queryPending = _buildOid(id_cmc, 21)
539
+
540
+
541
+ class AddExtensions(univ.Sequence):
542
+ pass
543
+
544
+
545
+ AddExtensions.componentType = namedtype.NamedTypes(
546
+ namedtype.NamedType('pkiDataReference', BodyPartID()),
547
+ namedtype.NamedType('certReferences', univ.SequenceOf(componentType=BodyPartID())),
548
+ namedtype.NamedType('extensions', univ.SequenceOf(componentType=rfc5280.Extension()))
549
+ )
550
+
551
+
552
+ class EncryptedPOP(univ.Sequence):
553
+ pass
554
+
555
+
556
+ EncryptedPOP.componentType = namedtype.NamedTypes(
557
+ namedtype.NamedType('request', TaggedRequest()),
558
+ namedtype.NamedType('cms', rfc5652.ContentInfo()),
559
+ namedtype.NamedType('thePOPAlgID', rfc5280.AlgorithmIdentifier()),
560
+ namedtype.NamedType('witnessAlgID', rfc5280.AlgorithmIdentifier()),
561
+ namedtype.NamedType('witness', univ.OctetString())
562
+ )
563
+
564
+ id_cmc_getCRL = _buildOid(id_cmc, 16)
565
+
566
+ id_cct_PKIResponse = _buildOid(id_cct, 3)
567
+
568
+ id_cmc_controlProcessed = _buildOid(id_cmc, 32)
569
+
570
+
571
+ class NoSignatureValue(univ.OctetString):
572
+ pass
573
+
574
+
575
+ id_ad_cmc = _buildOid(rfc5280.id_ad, 12)
576
+
577
+ id_alg_noSignature = _buildOid(id_pkix, 6, 2)
578
+
579
+
580
+ # Map of CMC Control OIDs to CMC Control Attributes
581
+
582
+ _cmcControlAttributesMapUpdate = {
583
+ id_cmc_statusInfo: CMCStatusInfo(),
584
+ id_cmc_statusInfoV2: CMCStatusInfoV2(),
585
+ id_cmc_identification: char.UTF8String(),
586
+ id_cmc_identityProof: univ.OctetString(),
587
+ id_cmc_identityProofV2: IdentifyProofV2(),
588
+ id_cmc_dataReturn: univ.OctetString(),
589
+ id_cmc_transactionId: univ.Integer(),
590
+ id_cmc_senderNonce: univ.OctetString(),
591
+ id_cmc_recipientNonce: univ.OctetString(),
592
+ id_cmc_addExtensions: AddExtensions(),
593
+ id_cmc_encryptedPOP: EncryptedPOP(),
594
+ id_cmc_decryptedPOP: DecryptedPOP(),
595
+ id_cmc_lraPOPWitness: LraPopWitness(),
596
+ id_cmc_getCert: GetCert(),
597
+ id_cmc_getCRL: GetCRL(),
598
+ id_cmc_revokeRequest: RevokeRequest(),
599
+ id_cmc_regInfo: univ.OctetString(),
600
+ id_cmc_responseInfo: univ.OctetString(),
601
+ id_cmc_queryPending: univ.OctetString(),
602
+ id_cmc_popLinkRandom: univ.OctetString(),
603
+ id_cmc_popLinkWitness: univ.OctetString(),
604
+ id_cmc_popLinkWitnessV2: PopLinkWitnessV2(),
605
+ id_cmc_confirmCertAcceptance: CMCCertId(),
606
+ id_cmc_trustedAnchors: PublishTrustAnchors(),
607
+ id_cmc_authData: AuthPublish(),
608
+ id_cmc_batchRequests: BodyPartList(),
609
+ id_cmc_batchResponses: BodyPartList(),
610
+ id_cmc_publishCert: CMCPublicationInfo(),
611
+ id_cmc_modCertTemplate: ModCertTemplate(),
612
+ id_cmc_controlProcessed: ControlsProcessed(),
613
+ id_ExtensionReq: ExtensionReq(),
614
+ }
615
+
616
+ cmcControlAttributesMap.update(_cmcControlAttributesMapUpdate)
617
+
618
+
619
+ # Map of CMC Content Type OIDs to CMC Content Types are added to
620
+ # the ones that are in rfc5652.py
621
+
622
+ _cmsContentTypesMapUpdate = {
623
+ id_cct_PKIData: PKIData(),
624
+ id_cct_PKIResponse: PKIResponse(),
625
+ }
626
+
627
+ rfc5652.cmsContentTypesMap.update(_cmsContentTypesMapUpdate)
628
+
evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc7030.py ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #
2
+ # This file is part of pyasn1-modules software.
3
+ #
4
+ # Created by Russ Housley with 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
+ # Enrollment over Secure Transport (EST)
10
+ #
11
+ # ASN.1 source from:
12
+ # https://www.rfc-editor.org/rfc/rfc7030.txt
13
+ #
14
+
15
+ from pyasn1.type import constraint
16
+ from pyasn1.type import namedtype
17
+ from pyasn1.type import univ
18
+
19
+ from pyasn1_modules import rfc5652
20
+
21
+ MAX = float('inf')
22
+
23
+
24
+ # Imports from RFC 5652
25
+
26
+ Attribute = rfc5652.Attribute
27
+
28
+
29
+ # Asymmetric Decrypt Key Identifier Attribute
30
+
31
+ id_aa_asymmDecryptKeyID = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.54')
32
+
33
+ class AsymmetricDecryptKeyIdentifier(univ.OctetString):
34
+ pass
35
+
36
+
37
+ aa_asymmDecryptKeyID = Attribute()
38
+ aa_asymmDecryptKeyID['attrType'] = id_aa_asymmDecryptKeyID
39
+ aa_asymmDecryptKeyID['attrValues'][0] = AsymmetricDecryptKeyIdentifier()
40
+
41
+
42
+ # CSR Attributes
43
+
44
+ class AttrOrOID(univ.Choice):
45
+ pass
46
+
47
+ AttrOrOID.componentType = namedtype.NamedTypes(
48
+ namedtype.NamedType('oid', univ.ObjectIdentifier()),
49
+ namedtype.NamedType('attribute', Attribute())
50
+ )
51
+
52
+
53
+ class CsrAttrs(univ.SequenceOf):
54
+ pass
55
+
56
+ CsrAttrs.componentType = AttrOrOID()
57
+ CsrAttrs.subtypeSpec=constraint.ValueSizeConstraint(0, MAX)
58
+
59
+
60
+ # Update CMS Attribute Map
61
+
62
+ _cmsAttributesMapUpdate = {
63
+ id_aa_asymmDecryptKeyID: AsymmetricDecryptKeyIdentifier(),
64
+ }
65
+
66
+ rfc5652.cmsAttributesMap.update(_cmsAttributesMapUpdate)
evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc7773.py ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ # Authentication Context Certificate Extension
10
+ #
11
+ # ASN.1 source from:
12
+ # https://www.rfc-editor.org/rfc/rfc7773.txt
13
+ #
14
+
15
+ from pyasn1.type import char
16
+ from pyasn1.type import constraint
17
+ from pyasn1.type import namedtype
18
+ from pyasn1.type import univ
19
+
20
+ from pyasn1_modules import rfc5280
21
+
22
+ MAX = float('inf')
23
+
24
+
25
+ # Authentication Context Extension
26
+
27
+ e_legnamnden = univ.ObjectIdentifier('1.2.752.201')
28
+
29
+ id_eleg_ce = e_legnamnden + (5, )
30
+
31
+ id_ce_authContext = id_eleg_ce + (1, )
32
+
33
+
34
+ class AuthenticationContext(univ.Sequence):
35
+ componentType = namedtype.NamedTypes(
36
+ namedtype.NamedType('contextType', char.UTF8String()),
37
+ namedtype.OptionalNamedType('contextInfo', char.UTF8String())
38
+ )
39
+
40
+ class AuthenticationContexts(univ.SequenceOf):
41
+ componentType = AuthenticationContext()
42
+ subtypeSpec=constraint.ValueSizeConstraint(1, MAX)
43
+
44
+
45
+ # Map of Certificate Extension OIDs to Extensions added to the
46
+ # ones that are in rfc5280.py
47
+
48
+ _certificateExtensionsMapUpdate = {
49
+ id_ce_authContext: AuthenticationContexts(),
50
+ }
51
+
52
+ rfc5280.certificateExtensionsMap.update(_certificateExtensionsMapUpdate)
evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc8419.py ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This file is being contributed to pyasn1-modules software.
2
+ #
3
+ # Created by Russ Housley.
4
+ #
5
+ # Copyright (c) 2019, Vigil Security, LLC
6
+ # License: http://snmplabs.com/pyasn1/license.html
7
+ #
8
+ # Edwards-Curve Digital Signature Algorithm (EdDSA) Signatures in the CMS
9
+ #
10
+ # ASN.1 source from:
11
+ # https://www.rfc-editor.org/rfc/rfc8419.txt
12
+ # https://www.rfc-editor.org/errata/eid5869
13
+
14
+
15
+ from pyasn1.type import univ
16
+
17
+ from pyasn1_modules import rfc5280
18
+
19
+
20
+ class ShakeOutputLen(univ.Integer):
21
+ pass
22
+
23
+
24
+ id_Ed25519 = univ.ObjectIdentifier('1.3.101.112')
25
+
26
+ sigAlg_Ed25519 = rfc5280.AlgorithmIdentifier()
27
+ sigAlg_Ed25519['algorithm'] = id_Ed25519
28
+ # sigAlg_Ed25519['parameters'] is absent
29
+
30
+
31
+ id_Ed448 = univ.ObjectIdentifier('1.3.101.113')
32
+
33
+ sigAlg_Ed448 = rfc5280.AlgorithmIdentifier()
34
+ sigAlg_Ed448['algorithm'] = id_Ed448
35
+ # sigAlg_Ed448['parameters'] is absent
36
+
37
+
38
+ hashAlgs = univ.ObjectIdentifier('2.16.840.1.101.3.4.2')
39
+
40
+ id_sha512 = hashAlgs + (3, )
41
+
42
+ hashAlg_SHA_512 = rfc5280.AlgorithmIdentifier()
43
+ hashAlg_SHA_512['algorithm'] = id_sha512
44
+ # hashAlg_SHA_512['parameters'] is absent
45
+
46
+
47
+ id_shake256 = hashAlgs + (12, )
48
+
49
+ hashAlg_SHAKE256 = rfc5280.AlgorithmIdentifier()
50
+ hashAlg_SHAKE256['algorithm'] = id_shake256
51
+ # hashAlg_SHAKE256['parameters']is absent
52
+
53
+
54
+ id_shake256_len = hashAlgs + (18, )
55
+
56
+ hashAlg_SHAKE256_LEN = rfc5280.AlgorithmIdentifier()
57
+ hashAlg_SHAKE256_LEN['algorithm'] = id_shake256_len
58
+ hashAlg_SHAKE256_LEN['parameters'] = ShakeOutputLen()
59
+
60
+
61
+ # Map of Algorithm Identifier OIDs to Parameters added to the
62
+ # ones in rfc5280.py. Do not add OIDs with absent paramaters.
63
+
64
+ _algorithmIdentifierMapUpdate = {
65
+ id_shake256_len: ShakeOutputLen(),
66
+ }
67
+
68
+ rfc5280.algorithmIdentifierMap.update(_algorithmIdentifierMapUpdate)
evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc8520.py ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #
2
+ # This file is part of pyasn1-modules software.
3
+ #
4
+ # Created by Russ Housley with assistance from asn1ate v.0.6.0.
5
+ # Modified by Russ Housley to add maps for use with opentypes.
6
+ #
7
+ # Copyright (c) 2019, Vigil Security, LLC
8
+ # License: http://snmplabs.com/pyasn1/license.html
9
+ #
10
+ # X.509 Extensions for MUD URL and MUD Signer;
11
+ # Object Identifier for CMS Content Type for a MUD file
12
+ #
13
+ # ASN.1 source from:
14
+ # https://www.rfc-editor.org/rfc/rfc8520.txt
15
+ #
16
+
17
+ from pyasn1.type import char
18
+ from pyasn1.type import univ
19
+
20
+ from pyasn1_modules import rfc5280
21
+ from pyasn1_modules import rfc5652
22
+
23
+
24
+ # X.509 Extension for MUD URL
25
+
26
+ id_pe_mud_url = univ.ObjectIdentifier('1.3.6.1.5.5.7.1.25')
27
+
28
+ class MUDURLSyntax(char.IA5String):
29
+ pass
30
+
31
+
32
+ # X.509 Extension for MUD Signer
33
+
34
+ id_pe_mudsigner = univ.ObjectIdentifier('1.3.6.1.5.5.7.1.30')
35
+
36
+ class MUDsignerSyntax(rfc5280.Name):
37
+ pass
38
+
39
+
40
+ # Object Identifier for CMS Content Type for a MUD file
41
+
42
+ id_ct_mudtype = univ.ObjectIdentifier('1.2.840.113549.1.9.16.1.41')
43
+
44
+
45
+ # Map of Certificate Extension OIDs to Extensions added to the
46
+ # ones that are in rfc5280.py
47
+
48
+ _certificateExtensionsMapUpdate = {
49
+ id_pe_mud_url: MUDURLSyntax(),
50
+ id_pe_mudsigner: MUDsignerSyntax(),
51
+ }
52
+
53
+ rfc5280.certificateExtensionsMap.update(_certificateExtensionsMapUpdate)
54
+
55
+
56
+ # Map of Content Type OIDs to Content Types added to the
57
+ # ones that are in rfc5652.py
58
+
59
+ _cmsContentTypesMapUpdate = {
60
+ id_ct_mudtype: univ.OctetString(),
61
+ }
62
+
63
+ rfc5652.cmsContentTypesMap.update(_cmsContentTypesMapUpdate)
evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc8696.py ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ # Using Pre-Shared Key (PSK) in the Cryptographic Message Syntax (CMS)
10
+ #
11
+ # ASN.1 source from:
12
+ # https://www.rfc-editor.org/rfc/rfc8696.txt
13
+ #
14
+
15
+ from pyasn1.type import constraint
16
+ from pyasn1.type import namedtype
17
+ from pyasn1.type import namedval
18
+ from pyasn1.type import tag
19
+ from pyasn1.type import univ
20
+
21
+ from pyasn1_modules import rfc5652
22
+
23
+ MAX = float('inf')
24
+
25
+
26
+ id_ori = univ.ObjectIdentifier('1.2.840.113549.1.9.16.13')
27
+
28
+ id_ori_keyTransPSK = univ.ObjectIdentifier('1.2.840.113549.1.9.16.13.1')
29
+
30
+ id_ori_keyAgreePSK = univ.ObjectIdentifier('1.2.840.113549.1.9.16.13.2')
31
+
32
+
33
+ class PreSharedKeyIdentifier(univ.OctetString):
34
+ pass
35
+
36
+
37
+ class KeyTransRecipientInfos(univ.SequenceOf):
38
+ componentType = rfc5652.KeyTransRecipientInfo()
39
+
40
+
41
+ class KeyTransPSKRecipientInfo(univ.Sequence):
42
+ componentType = namedtype.NamedTypes(
43
+ namedtype.NamedType('version',
44
+ rfc5652.CMSVersion()),
45
+ namedtype.NamedType('pskid',
46
+ PreSharedKeyIdentifier()),
47
+ namedtype.NamedType('kdfAlgorithm',
48
+ rfc5652.KeyDerivationAlgorithmIdentifier()),
49
+ namedtype.NamedType('keyEncryptionAlgorithm',
50
+ rfc5652.KeyEncryptionAlgorithmIdentifier()),
51
+ namedtype.NamedType('ktris',
52
+ KeyTransRecipientInfos()),
53
+ namedtype.NamedType('encryptedKey',
54
+ rfc5652.EncryptedKey())
55
+ )
56
+
57
+
58
+ class KeyAgreePSKRecipientInfo(univ.Sequence):
59
+ componentType = namedtype.NamedTypes(
60
+ namedtype.NamedType('version',
61
+ rfc5652.CMSVersion()),
62
+ namedtype.NamedType('pskid',
63
+ PreSharedKeyIdentifier()),
64
+ namedtype.NamedType('originator',
65
+ rfc5652.OriginatorIdentifierOrKey().subtype(explicitTag=tag.Tag(
66
+ tag.tagClassContext, tag.tagFormatConstructed, 0))),
67
+ namedtype.OptionalNamedType('ukm',
68
+ rfc5652.UserKeyingMaterial().subtype(explicitTag=tag.Tag(
69
+ tag.tagClassContext, tag.tagFormatSimple, 1))),
70
+ namedtype.NamedType('kdfAlgorithm',
71
+ rfc5652.KeyDerivationAlgorithmIdentifier()),
72
+ namedtype.NamedType('keyEncryptionAlgorithm',
73
+ rfc5652.KeyEncryptionAlgorithmIdentifier()),
74
+ namedtype.NamedType('recipientEncryptedKeys',
75
+ rfc5652.RecipientEncryptedKeys())
76
+ )
77
+
78
+
79
+ class CMSORIforPSKOtherInfo(univ.Sequence):
80
+ componentType = namedtype.NamedTypes(
81
+ namedtype.NamedType('psk',
82
+ univ.OctetString()),
83
+ namedtype.NamedType('keyMgmtAlgType',
84
+ univ.Enumerated(namedValues=namedval.NamedValues(
85
+ ('keyTrans', 5), ('keyAgree', 10)))),
86
+ namedtype.NamedType('keyEncryptionAlgorithm',
87
+ rfc5652.KeyEncryptionAlgorithmIdentifier()),
88
+ namedtype.NamedType('pskLength',
89
+ univ.Integer().subtype(
90
+ subtypeSpec=constraint.ValueRangeConstraint(1, MAX))),
91
+ namedtype.NamedType('kdkLength',
92
+ univ.Integer().subtype(
93
+ subtypeSpec=constraint.ValueRangeConstraint(1, MAX)))
94
+ )
95
+
96
+
97
+ # Update the CMS Other Recipient Info map in rfc5652.py
98
+
99
+ _otherRecipientInfoMapUpdate = {
100
+ id_ori_keyTransPSK: KeyTransPSKRecipientInfo(),
101
+ id_ori_keyAgreePSK: KeyAgreePSKRecipientInfo(),
102
+ }
103
+
104
+ rfc5652.otherRecipientInfoMap.update(_otherRecipientInfoMapUpdate)