1 | <?php |
||
17 | class CertificationPathBuilder |
||
18 | { |
||
19 | /** |
||
20 | * Trust anchors. |
||
21 | * |
||
22 | * @var CertificateBundle |
||
23 | */ |
||
24 | protected $_trustList; |
||
25 | |||
26 | /** |
||
27 | * Constructor. |
||
28 | * |
||
29 | * @param CertificateBundle $trust_list List of trust anchors |
||
30 | */ |
||
31 | 9 | public function __construct(CertificateBundle $trust_list) |
|
35 | |||
36 | /** |
||
37 | * Get all certification paths to given target certificate from |
||
38 | * any trust anchor. |
||
39 | * |
||
40 | * @param Certificate $target Target certificate |
||
41 | * @param CertificateBundle|null $intermediate Optional intermediate |
||
42 | * certificates |
||
43 | * @return CertificationPath[] |
||
44 | */ |
||
45 | 9 | public function allPathsToTarget(Certificate $target, |
|
55 | |||
56 | /** |
||
57 | * Resolve all possible certification paths from any trust anchor to |
||
58 | * the target certificate, using optional intermediate certificates. |
||
59 | * |
||
60 | * Helper method for allPathsToTarget to be called recursively. |
||
61 | * |
||
62 | * @todo Implement loop detection |
||
63 | * @param Certificate $target |
||
64 | * @param CertificateBundle $intermediate |
||
65 | * @return array[] Array of arrays containing path certificates |
||
66 | */ |
||
67 | 9 | private function _resolvePathsToTarget(Certificate $target, |
|
98 | |||
99 | /** |
||
100 | * Get shortest path to given target certificate from any trust anchor. |
||
101 | * |
||
102 | * @param Certificate $target Target certificate |
||
103 | * @param CertificateBundle|null $intermediate Optional intermediate |
||
104 | * certificates |
||
105 | * @throws PathBuildingException |
||
106 | * @return CertificationPath |
||
107 | */ |
||
108 | 8 | public function shortestPathToTarget(Certificate $target, |
|
121 | |||
122 | /** |
||
123 | * Find all issuers of the target certificate from a given bundle. |
||
124 | * |
||
125 | * @param Certificate $target Target certificate |
||
126 | * @param CertificateBundle $bundle Certificates to search |
||
127 | * @return Certificate[] |
||
128 | */ |
||
129 | 9 | protected function _findIssuers(Certificate $target, |
|
152 | } |
||
153 |