Skip to content

Commit

Permalink
verification: add missing max_chain_depth kwargs (pyca#9847)
Browse files Browse the repository at this point in the history
Missed these on the original PR.

Signed-off-by: William Woodruff <[email protected]>
  • Loading branch information
woodruffw authored Nov 9, 2023
1 parent 8caafd7 commit e7dbca6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
6 changes: 6 additions & 0 deletions docs/x509/verification.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ chain building, etc.

The verifier's validation time.

.. attribute:: max_chain_depth

:type: :class:`int`

The verifier's maximum intermediate CA chain depth.

.. attribute:: store

:type: :class:`Store`
Expand Down
12 changes: 10 additions & 2 deletions src/cryptography/x509/verification.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ def time(self, new_time: datetime.datetime) -> PolicyBuilder:
if self._time is not None:
raise ValueError("The validation time may only be set once.")

return PolicyBuilder(time=new_time, store=self._store)
return PolicyBuilder(
time=new_time,
store=self._store,
max_chain_depth=self._max_chain_depth,
)

def store(self, new_store: Store) -> PolicyBuilder:
"""
Expand All @@ -48,7 +52,11 @@ def store(self, new_store: Store) -> PolicyBuilder:
if self._store is not None:
raise ValueError("The trust store may only be set once.")

return PolicyBuilder(time=self._time, store=new_store)
return PolicyBuilder(
time=self._time,
store=new_store,
max_chain_depth=self._max_chain_depth,
)

def max_chain_depth(self, new_max_chain_depth: int) -> PolicyBuilder:
"""
Expand Down

0 comments on commit e7dbca6

Please sign in to comment.