@@ -14,122 +14,122 @@ |
||
14 | 14 | */ |
15 | 15 | class NameConstraintsExtension extends Extension |
16 | 16 | { |
17 | - /** |
|
18 | - * Permitted subtrees. |
|
19 | - * |
|
20 | - * @var GeneralSubtrees|null $_permitted |
|
21 | - */ |
|
22 | - protected $_permitted; |
|
17 | + /** |
|
18 | + * Permitted subtrees. |
|
19 | + * |
|
20 | + * @var GeneralSubtrees|null $_permitted |
|
21 | + */ |
|
22 | + protected $_permitted; |
|
23 | 23 | |
24 | - /** |
|
25 | - * Excluded subtrees. |
|
26 | - * |
|
27 | - * @var GeneralSubtrees|null $_excluded |
|
28 | - */ |
|
29 | - protected $_excluded; |
|
24 | + /** |
|
25 | + * Excluded subtrees. |
|
26 | + * |
|
27 | + * @var GeneralSubtrees|null $_excluded |
|
28 | + */ |
|
29 | + protected $_excluded; |
|
30 | 30 | |
31 | - /** |
|
32 | - * Constructor. |
|
33 | - * |
|
34 | - * @param bool $critical |
|
35 | - * @param GeneralSubtrees $permitted |
|
36 | - * @param GeneralSubtrees $excluded |
|
37 | - */ |
|
38 | - public function __construct($critical, GeneralSubtrees $permitted = null, |
|
39 | - GeneralSubtrees $excluded = null) |
|
40 | - { |
|
41 | - parent::__construct(self::OID_NAME_CONSTRAINTS, $critical); |
|
42 | - $this->_permitted = $permitted; |
|
43 | - $this->_excluded = $excluded; |
|
44 | - } |
|
31 | + /** |
|
32 | + * Constructor. |
|
33 | + * |
|
34 | + * @param bool $critical |
|
35 | + * @param GeneralSubtrees $permitted |
|
36 | + * @param GeneralSubtrees $excluded |
|
37 | + */ |
|
38 | + public function __construct($critical, GeneralSubtrees $permitted = null, |
|
39 | + GeneralSubtrees $excluded = null) |
|
40 | + { |
|
41 | + parent::__construct(self::OID_NAME_CONSTRAINTS, $critical); |
|
42 | + $this->_permitted = $permitted; |
|
43 | + $this->_excluded = $excluded; |
|
44 | + } |
|
45 | 45 | |
46 | - /** |
|
47 | - * |
|
48 | - * {@inheritdoc} |
|
49 | - * @return self |
|
50 | - */ |
|
51 | - protected static function _fromDER($data, $critical) |
|
52 | - { |
|
53 | - $seq = Sequence::fromDER($data); |
|
54 | - $permitted = null; |
|
55 | - $excluded = null; |
|
56 | - if ($seq->hasTagged(0)) { |
|
57 | - $permitted = GeneralSubtrees::fromASN1( |
|
58 | - $seq->getTagged(0) |
|
59 | - ->asImplicit(Element::TYPE_SEQUENCE) |
|
60 | - ->asSequence()); |
|
61 | - } |
|
62 | - if ($seq->hasTagged(1)) { |
|
63 | - $excluded = GeneralSubtrees::fromASN1( |
|
64 | - $seq->getTagged(1) |
|
65 | - ->asImplicit(Element::TYPE_SEQUENCE) |
|
66 | - ->asSequence()); |
|
67 | - } |
|
68 | - return new self($critical, $permitted, $excluded); |
|
69 | - } |
|
46 | + /** |
|
47 | + * |
|
48 | + * {@inheritdoc} |
|
49 | + * @return self |
|
50 | + */ |
|
51 | + protected static function _fromDER($data, $critical) |
|
52 | + { |
|
53 | + $seq = Sequence::fromDER($data); |
|
54 | + $permitted = null; |
|
55 | + $excluded = null; |
|
56 | + if ($seq->hasTagged(0)) { |
|
57 | + $permitted = GeneralSubtrees::fromASN1( |
|
58 | + $seq->getTagged(0) |
|
59 | + ->asImplicit(Element::TYPE_SEQUENCE) |
|
60 | + ->asSequence()); |
|
61 | + } |
|
62 | + if ($seq->hasTagged(1)) { |
|
63 | + $excluded = GeneralSubtrees::fromASN1( |
|
64 | + $seq->getTagged(1) |
|
65 | + ->asImplicit(Element::TYPE_SEQUENCE) |
|
66 | + ->asSequence()); |
|
67 | + } |
|
68 | + return new self($critical, $permitted, $excluded); |
|
69 | + } |
|
70 | 70 | |
71 | - /** |
|
72 | - * Whether permitted subtrees are present. |
|
73 | - * |
|
74 | - * @return bool |
|
75 | - */ |
|
76 | - public function hasPermittedSubtrees() |
|
77 | - { |
|
78 | - return isset($this->_permitted); |
|
79 | - } |
|
71 | + /** |
|
72 | + * Whether permitted subtrees are present. |
|
73 | + * |
|
74 | + * @return bool |
|
75 | + */ |
|
76 | + public function hasPermittedSubtrees() |
|
77 | + { |
|
78 | + return isset($this->_permitted); |
|
79 | + } |
|
80 | 80 | |
81 | - /** |
|
82 | - * Get permitted subtrees. |
|
83 | - * |
|
84 | - * @throws \LogicException |
|
85 | - * @return GeneralSubtrees |
|
86 | - */ |
|
87 | - public function permittedSubtrees() |
|
88 | - { |
|
89 | - if (!$this->hasPermittedSubtrees()) { |
|
90 | - throw new \LogicException("No permitted subtrees."); |
|
91 | - } |
|
92 | - return $this->_permitted; |
|
93 | - } |
|
81 | + /** |
|
82 | + * Get permitted subtrees. |
|
83 | + * |
|
84 | + * @throws \LogicException |
|
85 | + * @return GeneralSubtrees |
|
86 | + */ |
|
87 | + public function permittedSubtrees() |
|
88 | + { |
|
89 | + if (!$this->hasPermittedSubtrees()) { |
|
90 | + throw new \LogicException("No permitted subtrees."); |
|
91 | + } |
|
92 | + return $this->_permitted; |
|
93 | + } |
|
94 | 94 | |
95 | - /** |
|
96 | - * Whether excluded subtrees are present. |
|
97 | - * |
|
98 | - * @return bool |
|
99 | - */ |
|
100 | - public function hasExcludedSubtrees() |
|
101 | - { |
|
102 | - return isset($this->_excluded); |
|
103 | - } |
|
95 | + /** |
|
96 | + * Whether excluded subtrees are present. |
|
97 | + * |
|
98 | + * @return bool |
|
99 | + */ |
|
100 | + public function hasExcludedSubtrees() |
|
101 | + { |
|
102 | + return isset($this->_excluded); |
|
103 | + } |
|
104 | 104 | |
105 | - /** |
|
106 | - * Get excluded subtrees. |
|
107 | - * |
|
108 | - * @throws \LogicException |
|
109 | - * @return GeneralSubtrees |
|
110 | - */ |
|
111 | - public function excludedSubtrees() |
|
112 | - { |
|
113 | - if (!$this->hasExcludedSubtrees()) { |
|
114 | - throw new \LogicException("No excluded subtrees."); |
|
115 | - } |
|
116 | - return $this->_excluded; |
|
117 | - } |
|
105 | + /** |
|
106 | + * Get excluded subtrees. |
|
107 | + * |
|
108 | + * @throws \LogicException |
|
109 | + * @return GeneralSubtrees |
|
110 | + */ |
|
111 | + public function excludedSubtrees() |
|
112 | + { |
|
113 | + if (!$this->hasExcludedSubtrees()) { |
|
114 | + throw new \LogicException("No excluded subtrees."); |
|
115 | + } |
|
116 | + return $this->_excluded; |
|
117 | + } |
|
118 | 118 | |
119 | - /** |
|
120 | - * |
|
121 | - * {@inheritdoc} |
|
122 | - * @return Sequence |
|
123 | - */ |
|
124 | - protected function _valueASN1() |
|
125 | - { |
|
126 | - $elements = array(); |
|
127 | - if (isset($this->_permitted)) { |
|
128 | - $elements[] = new ImplicitlyTaggedType(0, $this->_permitted->toASN1()); |
|
129 | - } |
|
130 | - if (isset($this->_excluded)) { |
|
131 | - $elements[] = new ImplicitlyTaggedType(1, $this->_excluded->toASN1()); |
|
132 | - } |
|
133 | - return new Sequence(...$elements); |
|
134 | - } |
|
119 | + /** |
|
120 | + * |
|
121 | + * {@inheritdoc} |
|
122 | + * @return Sequence |
|
123 | + */ |
|
124 | + protected function _valueASN1() |
|
125 | + { |
|
126 | + $elements = array(); |
|
127 | + if (isset($this->_permitted)) { |
|
128 | + $elements[] = new ImplicitlyTaggedType(0, $this->_permitted->toASN1()); |
|
129 | + } |
|
130 | + if (isset($this->_excluded)) { |
|
131 | + $elements[] = new ImplicitlyTaggedType(1, $this->_excluded->toASN1()); |
|
132 | + } |
|
133 | + return new Sequence(...$elements); |
|
134 | + } |
|
135 | 135 | } |
@@ -17,215 +17,215 @@ |
||
17 | 17 | */ |
18 | 18 | class AAControlsExtension extends Extension |
19 | 19 | { |
20 | - /** |
|
21 | - * Path length contraint. |
|
22 | - * |
|
23 | - * @var int|null $_pathLenConstraint |
|
24 | - */ |
|
25 | - protected $_pathLenConstraint; |
|
20 | + /** |
|
21 | + * Path length contraint. |
|
22 | + * |
|
23 | + * @var int|null $_pathLenConstraint |
|
24 | + */ |
|
25 | + protected $_pathLenConstraint; |
|
26 | 26 | |
27 | - /** |
|
28 | - * Permitted attributes. |
|
29 | - * |
|
30 | - * Array of OID's. |
|
31 | - * |
|
32 | - * @var string[]|null $_permittedAttrs |
|
33 | - */ |
|
34 | - protected $_permittedAttrs; |
|
27 | + /** |
|
28 | + * Permitted attributes. |
|
29 | + * |
|
30 | + * Array of OID's. |
|
31 | + * |
|
32 | + * @var string[]|null $_permittedAttrs |
|
33 | + */ |
|
34 | + protected $_permittedAttrs; |
|
35 | 35 | |
36 | - /** |
|
37 | - * Excluded attributes. |
|
38 | - * |
|
39 | - * Array of OID's. |
|
40 | - * |
|
41 | - * @var string[]|null $_excludedAttrs |
|
42 | - */ |
|
43 | - protected $_excludedAttrs; |
|
36 | + /** |
|
37 | + * Excluded attributes. |
|
38 | + * |
|
39 | + * Array of OID's. |
|
40 | + * |
|
41 | + * @var string[]|null $_excludedAttrs |
|
42 | + */ |
|
43 | + protected $_excludedAttrs; |
|
44 | 44 | |
45 | - /** |
|
46 | - * Whether to permit unspecified attributes. |
|
47 | - * |
|
48 | - * @var bool $_permitUnSpecified |
|
49 | - */ |
|
50 | - protected $_permitUnSpecified; |
|
45 | + /** |
|
46 | + * Whether to permit unspecified attributes. |
|
47 | + * |
|
48 | + * @var bool $_permitUnSpecified |
|
49 | + */ |
|
50 | + protected $_permitUnSpecified; |
|
51 | 51 | |
52 | - /** |
|
53 | - * Constructor. |
|
54 | - * |
|
55 | - * @param bool $critical |
|
56 | - * @param int|null $path_len |
|
57 | - * @param string[]|null $permitted |
|
58 | - * @param string[]|null $excluded |
|
59 | - * @param bool $permit_unspecified |
|
60 | - */ |
|
61 | - public function __construct($critical, $path_len = null, array $permitted = null, |
|
62 | - array $excluded = null, $permit_unspecified = true) |
|
63 | - { |
|
64 | - parent::__construct(self::OID_AA_CONTROLS, $critical); |
|
65 | - $this->_pathLenConstraint = $path_len; |
|
66 | - $this->_permittedAttrs = $permitted; |
|
67 | - $this->_excludedAttrs = $excluded; |
|
68 | - $this->_permitUnSpecified = $permit_unspecified; |
|
69 | - } |
|
52 | + /** |
|
53 | + * Constructor. |
|
54 | + * |
|
55 | + * @param bool $critical |
|
56 | + * @param int|null $path_len |
|
57 | + * @param string[]|null $permitted |
|
58 | + * @param string[]|null $excluded |
|
59 | + * @param bool $permit_unspecified |
|
60 | + */ |
|
61 | + public function __construct($critical, $path_len = null, array $permitted = null, |
|
62 | + array $excluded = null, $permit_unspecified = true) |
|
63 | + { |
|
64 | + parent::__construct(self::OID_AA_CONTROLS, $critical); |
|
65 | + $this->_pathLenConstraint = $path_len; |
|
66 | + $this->_permittedAttrs = $permitted; |
|
67 | + $this->_excludedAttrs = $excluded; |
|
68 | + $this->_permitUnSpecified = $permit_unspecified; |
|
69 | + } |
|
70 | 70 | |
71 | - /** |
|
72 | - * |
|
73 | - * {@inheritdoc} |
|
74 | - * @return self |
|
75 | - */ |
|
76 | - protected static function _fromDER($data, $critical) |
|
77 | - { |
|
78 | - $seq = Sequence::fromDER($data); |
|
79 | - $path_len = null; |
|
80 | - $permitted = null; |
|
81 | - $excluded = null; |
|
82 | - $permit_unspecified = true; |
|
83 | - $idx = 0; |
|
84 | - if ($seq->has($idx, Element::TYPE_INTEGER)) { |
|
85 | - $path_len = $seq->at($idx++) |
|
86 | - ->asInteger() |
|
87 | - ->number(); |
|
88 | - } |
|
89 | - if ($seq->hasTagged(0)) { |
|
90 | - $attr_seq = $seq->getTagged(0) |
|
91 | - ->asImplicit(Element::TYPE_SEQUENCE) |
|
92 | - ->asSequence(); |
|
93 | - $permitted = array_map( |
|
94 | - function (UnspecifiedType $el) { |
|
95 | - return $el->asObjectIdentifier()->oid(); |
|
96 | - }, $attr_seq->elements()); |
|
97 | - $idx++; |
|
98 | - } |
|
99 | - if ($seq->hasTagged(1)) { |
|
100 | - $attr_seq = $seq->getTagged(1) |
|
101 | - ->asImplicit(Element::TYPE_SEQUENCE) |
|
102 | - ->asSequence(); |
|
103 | - $excluded = array_map( |
|
104 | - function (UnspecifiedType $el) { |
|
105 | - return $el->asObjectIdentifier()->oid(); |
|
106 | - }, $attr_seq->elements()); |
|
107 | - $idx++; |
|
108 | - } |
|
109 | - if ($seq->has($idx, Element::TYPE_BOOLEAN)) { |
|
110 | - $permit_unspecified = $seq->at($idx++) |
|
111 | - ->asBoolean() |
|
112 | - ->value(); |
|
113 | - } |
|
114 | - return new self($critical, $path_len, $permitted, $excluded, |
|
115 | - $permit_unspecified); |
|
116 | - } |
|
71 | + /** |
|
72 | + * |
|
73 | + * {@inheritdoc} |
|
74 | + * @return self |
|
75 | + */ |
|
76 | + protected static function _fromDER($data, $critical) |
|
77 | + { |
|
78 | + $seq = Sequence::fromDER($data); |
|
79 | + $path_len = null; |
|
80 | + $permitted = null; |
|
81 | + $excluded = null; |
|
82 | + $permit_unspecified = true; |
|
83 | + $idx = 0; |
|
84 | + if ($seq->has($idx, Element::TYPE_INTEGER)) { |
|
85 | + $path_len = $seq->at($idx++) |
|
86 | + ->asInteger() |
|
87 | + ->number(); |
|
88 | + } |
|
89 | + if ($seq->hasTagged(0)) { |
|
90 | + $attr_seq = $seq->getTagged(0) |
|
91 | + ->asImplicit(Element::TYPE_SEQUENCE) |
|
92 | + ->asSequence(); |
|
93 | + $permitted = array_map( |
|
94 | + function (UnspecifiedType $el) { |
|
95 | + return $el->asObjectIdentifier()->oid(); |
|
96 | + }, $attr_seq->elements()); |
|
97 | + $idx++; |
|
98 | + } |
|
99 | + if ($seq->hasTagged(1)) { |
|
100 | + $attr_seq = $seq->getTagged(1) |
|
101 | + ->asImplicit(Element::TYPE_SEQUENCE) |
|
102 | + ->asSequence(); |
|
103 | + $excluded = array_map( |
|
104 | + function (UnspecifiedType $el) { |
|
105 | + return $el->asObjectIdentifier()->oid(); |
|
106 | + }, $attr_seq->elements()); |
|
107 | + $idx++; |
|
108 | + } |
|
109 | + if ($seq->has($idx, Element::TYPE_BOOLEAN)) { |
|
110 | + $permit_unspecified = $seq->at($idx++) |
|
111 | + ->asBoolean() |
|
112 | + ->value(); |
|
113 | + } |
|
114 | + return new self($critical, $path_len, $permitted, $excluded, |
|
115 | + $permit_unspecified); |
|
116 | + } |
|
117 | 117 | |
118 | - /** |
|
119 | - * Check whether path length constraint is present. |
|
120 | - * |
|
121 | - * @return bool |
|
122 | - */ |
|
123 | - public function hasPathLen() |
|
124 | - { |
|
125 | - return isset($this->_pathLenConstraint); |
|
126 | - } |
|
118 | + /** |
|
119 | + * Check whether path length constraint is present. |
|
120 | + * |
|
121 | + * @return bool |
|
122 | + */ |
|
123 | + public function hasPathLen() |
|
124 | + { |
|
125 | + return isset($this->_pathLenConstraint); |
|
126 | + } |
|
127 | 127 | |
128 | - /** |
|
129 | - * Get path length constraint. |
|
130 | - * |
|
131 | - * @throws \LogicException |
|
132 | - * @return int |
|
133 | - */ |
|
134 | - public function pathLen() |
|
135 | - { |
|
136 | - if (!$this->hasPathLen()) { |
|
137 | - throw new \LogicException("pathLen not set."); |
|
138 | - } |
|
139 | - return $this->_pathLenConstraint; |
|
140 | - } |
|
128 | + /** |
|
129 | + * Get path length constraint. |
|
130 | + * |
|
131 | + * @throws \LogicException |
|
132 | + * @return int |
|
133 | + */ |
|
134 | + public function pathLen() |
|
135 | + { |
|
136 | + if (!$this->hasPathLen()) { |
|
137 | + throw new \LogicException("pathLen not set."); |
|
138 | + } |
|
139 | + return $this->_pathLenConstraint; |
|
140 | + } |
|
141 | 141 | |
142 | - /** |
|
143 | - * Check whether permitted attributes are present. |
|
144 | - * |
|
145 | - * @return bool |
|
146 | - */ |
|
147 | - public function hasPermittedAttrs() |
|
148 | - { |
|
149 | - return isset($this->_permittedAttrs); |
|
150 | - } |
|
142 | + /** |
|
143 | + * Check whether permitted attributes are present. |
|
144 | + * |
|
145 | + * @return bool |
|
146 | + */ |
|
147 | + public function hasPermittedAttrs() |
|
148 | + { |
|
149 | + return isset($this->_permittedAttrs); |
|
150 | + } |
|
151 | 151 | |
152 | - /** |
|
153 | - * Get OID's of permitted attributes. |
|
154 | - * |
|
155 | - * @throws \LogicException |
|
156 | - * @return string[] |
|
157 | - */ |
|
158 | - public function permittedAttrs() |
|
159 | - { |
|
160 | - if (!$this->hasPermittedAttrs()) { |
|
161 | - throw new \LogicException("permittedAttrs not set."); |
|
162 | - } |
|
163 | - return $this->_permittedAttrs; |
|
164 | - } |
|
152 | + /** |
|
153 | + * Get OID's of permitted attributes. |
|
154 | + * |
|
155 | + * @throws \LogicException |
|
156 | + * @return string[] |
|
157 | + */ |
|
158 | + public function permittedAttrs() |
|
159 | + { |
|
160 | + if (!$this->hasPermittedAttrs()) { |
|
161 | + throw new \LogicException("permittedAttrs not set."); |
|
162 | + } |
|
163 | + return $this->_permittedAttrs; |
|
164 | + } |
|
165 | 165 | |
166 | - /** |
|
167 | - * Check whether excluded attributes are present. |
|
168 | - * |
|
169 | - * @return bool |
|
170 | - */ |
|
171 | - public function hasExcludedAttrs() |
|
172 | - { |
|
173 | - return isset($this->_excludedAttrs); |
|
174 | - } |
|
166 | + /** |
|
167 | + * Check whether excluded attributes are present. |
|
168 | + * |
|
169 | + * @return bool |
|
170 | + */ |
|
171 | + public function hasExcludedAttrs() |
|
172 | + { |
|
173 | + return isset($this->_excludedAttrs); |
|
174 | + } |
|
175 | 175 | |
176 | - /** |
|
177 | - * Get OID's of excluded attributes. |
|
178 | - * |
|
179 | - * @throws \LogicException |
|
180 | - * @return string[] |
|
181 | - */ |
|
182 | - public function excludedAttrs() |
|
183 | - { |
|
184 | - if (!$this->hasExcludedAttrs()) { |
|
185 | - throw new \LogicException("excludedAttrs not set."); |
|
186 | - } |
|
187 | - return $this->_excludedAttrs; |
|
188 | - } |
|
176 | + /** |
|
177 | + * Get OID's of excluded attributes. |
|
178 | + * |
|
179 | + * @throws \LogicException |
|
180 | + * @return string[] |
|
181 | + */ |
|
182 | + public function excludedAttrs() |
|
183 | + { |
|
184 | + if (!$this->hasExcludedAttrs()) { |
|
185 | + throw new \LogicException("excludedAttrs not set."); |
|
186 | + } |
|
187 | + return $this->_excludedAttrs; |
|
188 | + } |
|
189 | 189 | |
190 | - /** |
|
191 | - * Whether to permit attributes that are not explicitly specified in |
|
192 | - * neither permitted nor excluded list. |
|
193 | - * |
|
194 | - * @return bool |
|
195 | - */ |
|
196 | - public function permitUnspecified() |
|
197 | - { |
|
198 | - return $this->_permitUnSpecified; |
|
199 | - } |
|
190 | + /** |
|
191 | + * Whether to permit attributes that are not explicitly specified in |
|
192 | + * neither permitted nor excluded list. |
|
193 | + * |
|
194 | + * @return bool |
|
195 | + */ |
|
196 | + public function permitUnspecified() |
|
197 | + { |
|
198 | + return $this->_permitUnSpecified; |
|
199 | + } |
|
200 | 200 | |
201 | - /** |
|
202 | - * |
|
203 | - * {@inheritdoc} |
|
204 | - * @return Sequence |
|
205 | - */ |
|
206 | - protected function _valueASN1() |
|
207 | - { |
|
208 | - $elements = array(); |
|
209 | - if (isset($this->_pathLenConstraint)) { |
|
210 | - $elements[] = new Integer($this->_pathLenConstraint); |
|
211 | - } |
|
212 | - if (isset($this->_permittedAttrs)) { |
|
213 | - $oids = array_map( |
|
214 | - function ($oid) { |
|
215 | - return new ObjectIdentifier($oid); |
|
216 | - }, $this->_permittedAttrs); |
|
217 | - $elements[] = new ImplicitlyTaggedType(0, new Sequence(...$oids)); |
|
218 | - } |
|
219 | - if (isset($this->_excludedAttrs)) { |
|
220 | - $oids = array_map( |
|
221 | - function ($oid) { |
|
222 | - return new ObjectIdentifier($oid); |
|
223 | - }, $this->_excludedAttrs); |
|
224 | - $elements[] = new ImplicitlyTaggedType(1, new Sequence(...$oids)); |
|
225 | - } |
|
226 | - if ($this->_permitUnSpecified !== true) { |
|
227 | - $elements[] = new Boolean(false); |
|
228 | - } |
|
229 | - return new Sequence(...$elements); |
|
230 | - } |
|
201 | + /** |
|
202 | + * |
|
203 | + * {@inheritdoc} |
|
204 | + * @return Sequence |
|
205 | + */ |
|
206 | + protected function _valueASN1() |
|
207 | + { |
|
208 | + $elements = array(); |
|
209 | + if (isset($this->_pathLenConstraint)) { |
|
210 | + $elements[] = new Integer($this->_pathLenConstraint); |
|
211 | + } |
|
212 | + if (isset($this->_permittedAttrs)) { |
|
213 | + $oids = array_map( |
|
214 | + function ($oid) { |
|
215 | + return new ObjectIdentifier($oid); |
|
216 | + }, $this->_permittedAttrs); |
|
217 | + $elements[] = new ImplicitlyTaggedType(0, new Sequence(...$oids)); |
|
218 | + } |
|
219 | + if (isset($this->_excludedAttrs)) { |
|
220 | + $oids = array_map( |
|
221 | + function ($oid) { |
|
222 | + return new ObjectIdentifier($oid); |
|
223 | + }, $this->_excludedAttrs); |
|
224 | + $elements[] = new ImplicitlyTaggedType(1, new Sequence(...$oids)); |
|
225 | + } |
|
226 | + if ($this->_permitUnSpecified !== true) { |
|
227 | + $elements[] = new Boolean(false); |
|
228 | + } |
|
229 | + return new Sequence(...$elements); |
|
230 | + } |
|
231 | 231 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | ->asImplicit(Element::TYPE_SEQUENCE) |
92 | 92 | ->asSequence(); |
93 | 93 | $permitted = array_map( |
94 | - function (UnspecifiedType $el) { |
|
94 | + function(UnspecifiedType $el) { |
|
95 | 95 | return $el->asObjectIdentifier()->oid(); |
96 | 96 | }, $attr_seq->elements()); |
97 | 97 | $idx++; |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | ->asImplicit(Element::TYPE_SEQUENCE) |
102 | 102 | ->asSequence(); |
103 | 103 | $excluded = array_map( |
104 | - function (UnspecifiedType $el) { |
|
104 | + function(UnspecifiedType $el) { |
|
105 | 105 | return $el->asObjectIdentifier()->oid(); |
106 | 106 | }, $attr_seq->elements()); |
107 | 107 | $idx++; |
@@ -211,14 +211,14 @@ discard block |
||
211 | 211 | } |
212 | 212 | if (isset($this->_permittedAttrs)) { |
213 | 213 | $oids = array_map( |
214 | - function ($oid) { |
|
214 | + function($oid) { |
|
215 | 215 | return new ObjectIdentifier($oid); |
216 | 216 | }, $this->_permittedAttrs); |
217 | 217 | $elements[] = new ImplicitlyTaggedType(0, new Sequence(...$oids)); |
218 | 218 | } |
219 | 219 | if (isset($this->_excludedAttrs)) { |
220 | 220 | $oids = array_map( |
221 | - function ($oid) { |
|
221 | + function($oid) { |
|
222 | 222 | return new ObjectIdentifier($oid); |
223 | 223 | }, $this->_excludedAttrs); |
224 | 224 | $elements[] = new ImplicitlyTaggedType(1, new Sequence(...$oids)); |
@@ -17,139 +17,139 @@ |
||
17 | 17 | * @link https://tools.ietf.org/html/rfc5755#section-4.3.2 |
18 | 18 | */ |
19 | 19 | class TargetInformationExtension extends Extension implements |
20 | - \Countable, |
|
21 | - \IteratorAggregate |
|
20 | + \Countable, |
|
21 | + \IteratorAggregate |
|
22 | 22 | { |
23 | - /** |
|
24 | - * Targets elements. |
|
25 | - * |
|
26 | - * @var Targets[] $_targets |
|
27 | - */ |
|
28 | - protected $_targets; |
|
23 | + /** |
|
24 | + * Targets elements. |
|
25 | + * |
|
26 | + * @var Targets[] $_targets |
|
27 | + */ |
|
28 | + protected $_targets; |
|
29 | 29 | |
30 | - /** |
|
31 | - * Targets[] merged to single Targets. |
|
32 | - * |
|
33 | - * @var Targets|null |
|
34 | - */ |
|
35 | - private $_merged; |
|
30 | + /** |
|
31 | + * Targets[] merged to single Targets. |
|
32 | + * |
|
33 | + * @var Targets|null |
|
34 | + */ |
|
35 | + private $_merged; |
|
36 | 36 | |
37 | - /** |
|
38 | - * Constructor. |
|
39 | - * |
|
40 | - * @param bool $critical |
|
41 | - * @param Targets ...$targets |
|
42 | - */ |
|
43 | - public function __construct($critical, Targets ...$targets) |
|
44 | - { |
|
45 | - parent::__construct(self::OID_TARGET_INFORMATION, $critical); |
|
46 | - $this->_targets = $targets; |
|
47 | - } |
|
37 | + /** |
|
38 | + * Constructor. |
|
39 | + * |
|
40 | + * @param bool $critical |
|
41 | + * @param Targets ...$targets |
|
42 | + */ |
|
43 | + public function __construct($critical, Targets ...$targets) |
|
44 | + { |
|
45 | + parent::__construct(self::OID_TARGET_INFORMATION, $critical); |
|
46 | + $this->_targets = $targets; |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * Initialize from one or more Target objects. |
|
51 | - * |
|
52 | - * Extension criticality shall be set to true as specified by RFC 5755. |
|
53 | - * |
|
54 | - * @param Target ...$target |
|
55 | - * @return TargetInformationExtension |
|
56 | - */ |
|
57 | - public static function fromTargets(Target ...$target) |
|
58 | - { |
|
59 | - return new self(true, new Targets(...$target)); |
|
60 | - } |
|
49 | + /** |
|
50 | + * Initialize from one or more Target objects. |
|
51 | + * |
|
52 | + * Extension criticality shall be set to true as specified by RFC 5755. |
|
53 | + * |
|
54 | + * @param Target ...$target |
|
55 | + * @return TargetInformationExtension |
|
56 | + */ |
|
57 | + public static function fromTargets(Target ...$target) |
|
58 | + { |
|
59 | + return new self(true, new Targets(...$target)); |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * Reset internal state on clone. |
|
64 | - */ |
|
65 | - public function __clone() |
|
66 | - { |
|
67 | - $this->_merged = null; |
|
68 | - } |
|
62 | + /** |
|
63 | + * Reset internal state on clone. |
|
64 | + */ |
|
65 | + public function __clone() |
|
66 | + { |
|
67 | + $this->_merged = null; |
|
68 | + } |
|
69 | 69 | |
70 | - /** |
|
71 | - * |
|
72 | - * {@inheritdoc} |
|
73 | - * @return self |
|
74 | - */ |
|
75 | - protected static function _fromDER($data, $critical) |
|
76 | - { |
|
77 | - $targets = array_map( |
|
78 | - function (UnspecifiedType $el) { |
|
79 | - return Targets::fromASN1($el->asSequence()); |
|
80 | - }, Sequence::fromDER($data)->elements()); |
|
81 | - return new self($critical, ...$targets); |
|
82 | - } |
|
70 | + /** |
|
71 | + * |
|
72 | + * {@inheritdoc} |
|
73 | + * @return self |
|
74 | + */ |
|
75 | + protected static function _fromDER($data, $critical) |
|
76 | + { |
|
77 | + $targets = array_map( |
|
78 | + function (UnspecifiedType $el) { |
|
79 | + return Targets::fromASN1($el->asSequence()); |
|
80 | + }, Sequence::fromDER($data)->elements()); |
|
81 | + return new self($critical, ...$targets); |
|
82 | + } |
|
83 | 83 | |
84 | - /** |
|
85 | - * Get all targets. |
|
86 | - * |
|
87 | - * @return Targets |
|
88 | - */ |
|
89 | - public function targets() |
|
90 | - { |
|
91 | - if (!isset($this->_merged)) { |
|
92 | - $a = array(); |
|
93 | - foreach ($this->_targets as $targets) { |
|
94 | - $a = array_merge($a, $targets->all()); |
|
95 | - } |
|
96 | - $this->_merged = new Targets(...$a); |
|
97 | - } |
|
98 | - return $this->_merged; |
|
99 | - } |
|
84 | + /** |
|
85 | + * Get all targets. |
|
86 | + * |
|
87 | + * @return Targets |
|
88 | + */ |
|
89 | + public function targets() |
|
90 | + { |
|
91 | + if (!isset($this->_merged)) { |
|
92 | + $a = array(); |
|
93 | + foreach ($this->_targets as $targets) { |
|
94 | + $a = array_merge($a, $targets->all()); |
|
95 | + } |
|
96 | + $this->_merged = new Targets(...$a); |
|
97 | + } |
|
98 | + return $this->_merged; |
|
99 | + } |
|
100 | 100 | |
101 | - /** |
|
102 | - * Get all name targets. |
|
103 | - * |
|
104 | - * @return Target[] |
|
105 | - */ |
|
106 | - public function names() |
|
107 | - { |
|
108 | - return $this->targets()->nameTargets(); |
|
109 | - } |
|
101 | + /** |
|
102 | + * Get all name targets. |
|
103 | + * |
|
104 | + * @return Target[] |
|
105 | + */ |
|
106 | + public function names() |
|
107 | + { |
|
108 | + return $this->targets()->nameTargets(); |
|
109 | + } |
|
110 | 110 | |
111 | - /** |
|
112 | - * Get all group targets. |
|
113 | - * |
|
114 | - * @return Target[] |
|
115 | - */ |
|
116 | - public function groups() |
|
117 | - { |
|
118 | - return $this->targets()->groupTargets(); |
|
119 | - } |
|
111 | + /** |
|
112 | + * Get all group targets. |
|
113 | + * |
|
114 | + * @return Target[] |
|
115 | + */ |
|
116 | + public function groups() |
|
117 | + { |
|
118 | + return $this->targets()->groupTargets(); |
|
119 | + } |
|
120 | 120 | |
121 | - /** |
|
122 | - * |
|
123 | - * @see \X509\Certificate\Extension\Extension::_valueASN1() |
|
124 | - * @return Sequence |
|
125 | - */ |
|
126 | - protected function _valueASN1() |
|
127 | - { |
|
128 | - $elements = array_map( |
|
129 | - function (Targets $targets) { |
|
130 | - return $targets->toASN1(); |
|
131 | - }, $this->_targets); |
|
132 | - return new Sequence(...$elements); |
|
133 | - } |
|
121 | + /** |
|
122 | + * |
|
123 | + * @see \X509\Certificate\Extension\Extension::_valueASN1() |
|
124 | + * @return Sequence |
|
125 | + */ |
|
126 | + protected function _valueASN1() |
|
127 | + { |
|
128 | + $elements = array_map( |
|
129 | + function (Targets $targets) { |
|
130 | + return $targets->toASN1(); |
|
131 | + }, $this->_targets); |
|
132 | + return new Sequence(...$elements); |
|
133 | + } |
|
134 | 134 | |
135 | - /** |
|
136 | - * |
|
137 | - * @see \Countable::count() |
|
138 | - * @return int |
|
139 | - */ |
|
140 | - public function count() |
|
141 | - { |
|
142 | - return count($this->targets()); |
|
143 | - } |
|
135 | + /** |
|
136 | + * |
|
137 | + * @see \Countable::count() |
|
138 | + * @return int |
|
139 | + */ |
|
140 | + public function count() |
|
141 | + { |
|
142 | + return count($this->targets()); |
|
143 | + } |
|
144 | 144 | |
145 | - /** |
|
146 | - * Get iterator for targets. |
|
147 | - * |
|
148 | - * @see \IteratorAggregate::getIterator() |
|
149 | - * @return \ArrayIterator |
|
150 | - */ |
|
151 | - public function getIterator() |
|
152 | - { |
|
153 | - return new \ArrayIterator($this->targets()->all()); |
|
154 | - } |
|
145 | + /** |
|
146 | + * Get iterator for targets. |
|
147 | + * |
|
148 | + * @see \IteratorAggregate::getIterator() |
|
149 | + * @return \ArrayIterator |
|
150 | + */ |
|
151 | + public function getIterator() |
|
152 | + { |
|
153 | + return new \ArrayIterator($this->targets()->all()); |
|
154 | + } |
|
155 | 155 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | protected static function _fromDER($data, $critical) |
76 | 76 | { |
77 | 77 | $targets = array_map( |
78 | - function (UnspecifiedType $el) { |
|
78 | + function(UnspecifiedType $el) { |
|
79 | 79 | return Targets::fromASN1($el->asSequence()); |
80 | 80 | }, Sequence::fromDER($data)->elements()); |
81 | 81 | return new self($critical, ...$targets); |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | protected function _valueASN1() |
127 | 127 | { |
128 | 128 | $elements = array_map( |
129 | - function (Targets $targets) { |
|
129 | + function(Targets $targets) { |
|
130 | 130 | return $targets->toASN1(); |
131 | 131 | }, $this->_targets); |
132 | 132 | return new Sequence(...$elements); |
@@ -11,34 +11,34 @@ |
||
11 | 11 | */ |
12 | 12 | class NoRevocationAvailableExtension extends Extension |
13 | 13 | { |
14 | - /** |
|
15 | - * Constructor. |
|
16 | - * |
|
17 | - * @param bool $critical |
|
18 | - */ |
|
19 | - public function __construct($critical) |
|
20 | - { |
|
21 | - parent::__construct(self::OID_NO_REV_AVAIL, $critical); |
|
22 | - } |
|
14 | + /** |
|
15 | + * Constructor. |
|
16 | + * |
|
17 | + * @param bool $critical |
|
18 | + */ |
|
19 | + public function __construct($critical) |
|
20 | + { |
|
21 | + parent::__construct(self::OID_NO_REV_AVAIL, $critical); |
|
22 | + } |
|
23 | 23 | |
24 | - /** |
|
25 | - * |
|
26 | - * {@inheritdoc} |
|
27 | - * @return self |
|
28 | - */ |
|
29 | - protected static function _fromDER($data, $critical) |
|
30 | - { |
|
31 | - NullType::fromDER($data); |
|
32 | - return new self($critical); |
|
33 | - } |
|
24 | + /** |
|
25 | + * |
|
26 | + * {@inheritdoc} |
|
27 | + * @return self |
|
28 | + */ |
|
29 | + protected static function _fromDER($data, $critical) |
|
30 | + { |
|
31 | + NullType::fromDER($data); |
|
32 | + return new self($critical); |
|
33 | + } |
|
34 | 34 | |
35 | - /** |
|
36 | - * |
|
37 | - * {@inheritdoc} |
|
38 | - * @return NullType |
|
39 | - */ |
|
40 | - protected function _valueASN1() |
|
41 | - { |
|
42 | - return new NullType(); |
|
43 | - } |
|
35 | + /** |
|
36 | + * |
|
37 | + * {@inheritdoc} |
|
38 | + * @return NullType |
|
39 | + */ |
|
40 | + protected function _valueASN1() |
|
41 | + { |
|
42 | + return new NullType(); |
|
43 | + } |
|
44 | 44 | } |
@@ -11,16 +11,16 @@ |
||
11 | 11 | */ |
12 | 12 | class FreshestCRLExtension extends CRLDistributionPointsExtension |
13 | 13 | { |
14 | - /** |
|
15 | - * Constructor. |
|
16 | - * |
|
17 | - * @param bool $critical |
|
18 | - * @param DistributionPoint ...$distribution_points |
|
19 | - */ |
|
20 | - public function __construct($critical, |
|
21 | - DistributionPoint ...$distribution_points) |
|
22 | - { |
|
23 | - Extension::__construct(self::OID_FRESHEST_CRL, $critical); |
|
24 | - $this->_distributionPoints = $distribution_points; |
|
25 | - } |
|
14 | + /** |
|
15 | + * Constructor. |
|
16 | + * |
|
17 | + * @param bool $critical |
|
18 | + * @param DistributionPoint ...$distribution_points |
|
19 | + */ |
|
20 | + public function __construct($critical, |
|
21 | + DistributionPoint ...$distribution_points) |
|
22 | + { |
|
23 | + Extension::__construct(self::OID_FRESHEST_CRL, $critical); |
|
24 | + $this->_distributionPoints = $distribution_points; |
|
25 | + } |
|
26 | 26 | } |
@@ -12,133 +12,133 @@ |
||
12 | 12 | * @link https://tools.ietf.org/html/rfc5280#section-4.2.1.12 |
13 | 13 | */ |
14 | 14 | class ExtendedKeyUsageExtension extends Extension implements |
15 | - \Countable, |
|
16 | - \IteratorAggregate |
|
15 | + \Countable, |
|
16 | + \IteratorAggregate |
|
17 | 17 | { |
18 | - const OID_SERVER_AUTH = "1.3.6.1.5.5.7.3.1"; |
|
19 | - const OID_CLIENT_AUTH = "1.3.6.1.5.5.7.3.2"; |
|
20 | - const OID_CODE_SIGNING = "1.3.6.1.5.5.7.3.3"; |
|
21 | - const OID_EMAIL_PROTECTION = "1.3.6.1.5.5.7.3.4"; |
|
22 | - const OID_IPSEC_END_SYSTEM = "1.3.6.1.5.5.7.3.5"; |
|
23 | - const OID_IPSEC_TUNNEL = "1.3.6.1.5.5.7.3.6"; |
|
24 | - const OID_IPSEC_USER = "1.3.6.1.5.5.7.3.7"; |
|
25 | - const OID_TIME_STAMPING = "1.3.6.1.5.5.7.3.8"; |
|
26 | - const OID_OCSP_SIGNING = "1.3.6.1.5.5.7.3.9"; |
|
27 | - const OID_DVCS = "1.3.6.1.5.5.7.3.10"; |
|
28 | - const OID_SBGP_CERT_AA_SERVER_AUTH = "1.3.6.1.5.5.7.3.11"; |
|
29 | - const OID_SCVP_RESPONDER = "1.3.6.1.5.5.7.3.12"; |
|
30 | - const OID_EAP_OVER_PPP = "1.3.6.1.5.5.7.3.13"; |
|
31 | - const OID_EAP_OVER_LAN = "1.3.6.1.5.5.7.3.14"; |
|
32 | - const OID_SCVP_SERVER = "1.3.6.1.5.5.7.3.15"; |
|
33 | - const OID_SCVP_CLIENT = "1.3.6.1.5.5.7.3.16"; |
|
34 | - const OID_IPSEC_IKE = "1.3.6.1.5.5.7.3.17"; |
|
35 | - const OID_CAPWAP_AC = "1.3.6.1.5.5.7.3.18"; |
|
36 | - const OID_CAPWAP_WTP = "1.3.6.1.5.5.7.3.19"; |
|
37 | - const OID_SIP_DOMAIN = "1.3.6.1.5.5.7.3.20"; |
|
38 | - const OID_SECURE_SHELL_CLIENT = "1.3.6.1.5.5.7.3.21"; |
|
39 | - const OID_SECURE_SHELL_SERVER = "1.3.6.1.5.5.7.3.22"; |
|
40 | - const OID_SEND_ROUTER = "1.3.6.1.5.5.7.3.23"; |
|
41 | - const OID_SEND_PROXY = "1.3.6.1.5.5.7.3.24"; |
|
42 | - const OID_SEND_OWNER = "1.3.6.1.5.5.7.3.25"; |
|
43 | - const OID_SEND_PROXIED_OWNER = "1.3.6.1.5.5.7.3.26"; |
|
44 | - const OID_CMC_CA = "1.3.6.1.5.5.7.3.27"; |
|
45 | - const OID_CMC_RA = "1.3.6.1.5.5.7.3.28"; |
|
46 | - const OID_CMC_ARCHIVE = "1.3.6.1.5.5.7.3.29"; |
|
18 | + const OID_SERVER_AUTH = "1.3.6.1.5.5.7.3.1"; |
|
19 | + const OID_CLIENT_AUTH = "1.3.6.1.5.5.7.3.2"; |
|
20 | + const OID_CODE_SIGNING = "1.3.6.1.5.5.7.3.3"; |
|
21 | + const OID_EMAIL_PROTECTION = "1.3.6.1.5.5.7.3.4"; |
|
22 | + const OID_IPSEC_END_SYSTEM = "1.3.6.1.5.5.7.3.5"; |
|
23 | + const OID_IPSEC_TUNNEL = "1.3.6.1.5.5.7.3.6"; |
|
24 | + const OID_IPSEC_USER = "1.3.6.1.5.5.7.3.7"; |
|
25 | + const OID_TIME_STAMPING = "1.3.6.1.5.5.7.3.8"; |
|
26 | + const OID_OCSP_SIGNING = "1.3.6.1.5.5.7.3.9"; |
|
27 | + const OID_DVCS = "1.3.6.1.5.5.7.3.10"; |
|
28 | + const OID_SBGP_CERT_AA_SERVER_AUTH = "1.3.6.1.5.5.7.3.11"; |
|
29 | + const OID_SCVP_RESPONDER = "1.3.6.1.5.5.7.3.12"; |
|
30 | + const OID_EAP_OVER_PPP = "1.3.6.1.5.5.7.3.13"; |
|
31 | + const OID_EAP_OVER_LAN = "1.3.6.1.5.5.7.3.14"; |
|
32 | + const OID_SCVP_SERVER = "1.3.6.1.5.5.7.3.15"; |
|
33 | + const OID_SCVP_CLIENT = "1.3.6.1.5.5.7.3.16"; |
|
34 | + const OID_IPSEC_IKE = "1.3.6.1.5.5.7.3.17"; |
|
35 | + const OID_CAPWAP_AC = "1.3.6.1.5.5.7.3.18"; |
|
36 | + const OID_CAPWAP_WTP = "1.3.6.1.5.5.7.3.19"; |
|
37 | + const OID_SIP_DOMAIN = "1.3.6.1.5.5.7.3.20"; |
|
38 | + const OID_SECURE_SHELL_CLIENT = "1.3.6.1.5.5.7.3.21"; |
|
39 | + const OID_SECURE_SHELL_SERVER = "1.3.6.1.5.5.7.3.22"; |
|
40 | + const OID_SEND_ROUTER = "1.3.6.1.5.5.7.3.23"; |
|
41 | + const OID_SEND_PROXY = "1.3.6.1.5.5.7.3.24"; |
|
42 | + const OID_SEND_OWNER = "1.3.6.1.5.5.7.3.25"; |
|
43 | + const OID_SEND_PROXIED_OWNER = "1.3.6.1.5.5.7.3.26"; |
|
44 | + const OID_CMC_CA = "1.3.6.1.5.5.7.3.27"; |
|
45 | + const OID_CMC_RA = "1.3.6.1.5.5.7.3.28"; |
|
46 | + const OID_CMC_ARCHIVE = "1.3.6.1.5.5.7.3.29"; |
|
47 | 47 | |
48 | - /** |
|
49 | - * Purpose OID's. |
|
50 | - * |
|
51 | - * @var string[] $_purposes |
|
52 | - */ |
|
53 | - protected $_purposes; |
|
48 | + /** |
|
49 | + * Purpose OID's. |
|
50 | + * |
|
51 | + * @var string[] $_purposes |
|
52 | + */ |
|
53 | + protected $_purposes; |
|
54 | 54 | |
55 | - /** |
|
56 | - * Constructor. |
|
57 | - * |
|
58 | - * @param bool $critical |
|
59 | - * @param string ...$purposes |
|
60 | - */ |
|
61 | - public function __construct($critical, ...$purposes) |
|
62 | - { |
|
63 | - parent::__construct(self::OID_EXT_KEY_USAGE, $critical); |
|
64 | - $this->_purposes = $purposes; |
|
65 | - } |
|
55 | + /** |
|
56 | + * Constructor. |
|
57 | + * |
|
58 | + * @param bool $critical |
|
59 | + * @param string ...$purposes |
|
60 | + */ |
|
61 | + public function __construct($critical, ...$purposes) |
|
62 | + { |
|
63 | + parent::__construct(self::OID_EXT_KEY_USAGE, $critical); |
|
64 | + $this->_purposes = $purposes; |
|
65 | + } |
|
66 | 66 | |
67 | - /** |
|
68 | - * |
|
69 | - * {@inheritdoc} |
|
70 | - * @return self |
|
71 | - */ |
|
72 | - protected static function _fromDER($data, $critical) |
|
73 | - { |
|
74 | - $purposes = array_map( |
|
75 | - function (UnspecifiedType $el) { |
|
76 | - return $el->asObjectIdentifier()->oid(); |
|
77 | - }, Sequence::fromDER($data)->elements()); |
|
78 | - return new self($critical, ...$purposes); |
|
79 | - } |
|
67 | + /** |
|
68 | + * |
|
69 | + * {@inheritdoc} |
|
70 | + * @return self |
|
71 | + */ |
|
72 | + protected static function _fromDER($data, $critical) |
|
73 | + { |
|
74 | + $purposes = array_map( |
|
75 | + function (UnspecifiedType $el) { |
|
76 | + return $el->asObjectIdentifier()->oid(); |
|
77 | + }, Sequence::fromDER($data)->elements()); |
|
78 | + return new self($critical, ...$purposes); |
|
79 | + } |
|
80 | 80 | |
81 | - /** |
|
82 | - * Whether purposes are present. |
|
83 | - * |
|
84 | - * If multiple purposes are checked, all must be present. |
|
85 | - * |
|
86 | - * @param string ...$oids |
|
87 | - * @return bool |
|
88 | - */ |
|
89 | - public function has(...$oids) |
|
90 | - { |
|
91 | - foreach ($oids as $oid) { |
|
92 | - if (!in_array($oid, $this->_purposes)) { |
|
93 | - return false; |
|
94 | - } |
|
95 | - } |
|
96 | - return true; |
|
97 | - } |
|
81 | + /** |
|
82 | + * Whether purposes are present. |
|
83 | + * |
|
84 | + * If multiple purposes are checked, all must be present. |
|
85 | + * |
|
86 | + * @param string ...$oids |
|
87 | + * @return bool |
|
88 | + */ |
|
89 | + public function has(...$oids) |
|
90 | + { |
|
91 | + foreach ($oids as $oid) { |
|
92 | + if (!in_array($oid, $this->_purposes)) { |
|
93 | + return false; |
|
94 | + } |
|
95 | + } |
|
96 | + return true; |
|
97 | + } |
|
98 | 98 | |
99 | - /** |
|
100 | - * Get key usage purpose OID's. |
|
101 | - * |
|
102 | - * @return string[] |
|
103 | - */ |
|
104 | - public function purposes() |
|
105 | - { |
|
106 | - return $this->_purposes; |
|
107 | - } |
|
99 | + /** |
|
100 | + * Get key usage purpose OID's. |
|
101 | + * |
|
102 | + * @return string[] |
|
103 | + */ |
|
104 | + public function purposes() |
|
105 | + { |
|
106 | + return $this->_purposes; |
|
107 | + } |
|
108 | 108 | |
109 | - /** |
|
110 | - * |
|
111 | - * {@inheritdoc} |
|
112 | - * @return Sequence |
|
113 | - */ |
|
114 | - protected function _valueASN1() |
|
115 | - { |
|
116 | - $elements = array_map( |
|
117 | - function ($oid) { |
|
118 | - return new ObjectIdentifier($oid); |
|
119 | - }, $this->_purposes); |
|
120 | - return new Sequence(...$elements); |
|
121 | - } |
|
109 | + /** |
|
110 | + * |
|
111 | + * {@inheritdoc} |
|
112 | + * @return Sequence |
|
113 | + */ |
|
114 | + protected function _valueASN1() |
|
115 | + { |
|
116 | + $elements = array_map( |
|
117 | + function ($oid) { |
|
118 | + return new ObjectIdentifier($oid); |
|
119 | + }, $this->_purposes); |
|
120 | + return new Sequence(...$elements); |
|
121 | + } |
|
122 | 122 | |
123 | - /** |
|
124 | - * Get the number of purposes. |
|
125 | - * |
|
126 | - * @see \Countable::count() |
|
127 | - * @return int |
|
128 | - */ |
|
129 | - public function count() |
|
130 | - { |
|
131 | - return count($this->_purposes); |
|
132 | - } |
|
123 | + /** |
|
124 | + * Get the number of purposes. |
|
125 | + * |
|
126 | + * @see \Countable::count() |
|
127 | + * @return int |
|
128 | + */ |
|
129 | + public function count() |
|
130 | + { |
|
131 | + return count($this->_purposes); |
|
132 | + } |
|
133 | 133 | |
134 | - /** |
|
135 | - * Get iterator for usage purposes. |
|
136 | - * |
|
137 | - * @see \IteratorAggregate::getIterator() |
|
138 | - * @return \ArrayIterator |
|
139 | - */ |
|
140 | - public function getIterator() |
|
141 | - { |
|
142 | - return new \ArrayIterator($this->_purposes); |
|
143 | - } |
|
134 | + /** |
|
135 | + * Get iterator for usage purposes. |
|
136 | + * |
|
137 | + * @see \IteratorAggregate::getIterator() |
|
138 | + * @return \ArrayIterator |
|
139 | + */ |
|
140 | + public function getIterator() |
|
141 | + { |
|
142 | + return new \ArrayIterator($this->_purposes); |
|
143 | + } |
|
144 | 144 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | protected static function _fromDER($data, $critical) |
73 | 73 | { |
74 | 74 | $purposes = array_map( |
75 | - function (UnspecifiedType $el) { |
|
75 | + function(UnspecifiedType $el) { |
|
76 | 76 | return $el->asObjectIdentifier()->oid(); |
77 | 77 | }, Sequence::fromDER($data)->elements()); |
78 | 78 | return new self($critical, ...$purposes); |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | protected function _valueASN1() |
115 | 115 | { |
116 | 116 | $elements = array_map( |
117 | - function ($oid) { |
|
117 | + function($oid) { |
|
118 | 118 | return new ObjectIdentifier($oid); |
119 | 119 | }, $this->_purposes); |
120 | 120 | return new Sequence(...$elements); |
@@ -9,32 +9,32 @@ |
||
9 | 9 | */ |
10 | 10 | class UnknownExtension extends Extension |
11 | 11 | { |
12 | - /** |
|
13 | - * Extension value. |
|
14 | - * |
|
15 | - * @var Element $_element |
|
16 | - */ |
|
17 | - protected $_element; |
|
12 | + /** |
|
13 | + * Extension value. |
|
14 | + * |
|
15 | + * @var Element $_element |
|
16 | + */ |
|
17 | + protected $_element; |
|
18 | 18 | |
19 | - /** |
|
20 | - * Constructor. |
|
21 | - * |
|
22 | - * @param string $oid |
|
23 | - * @param bool $critical |
|
24 | - * @param Element $data |
|
25 | - */ |
|
26 | - public function __construct($oid, $critical, Element $data) |
|
27 | - { |
|
28 | - parent::__construct($oid, $critical); |
|
29 | - $this->_element = $data; |
|
30 | - } |
|
19 | + /** |
|
20 | + * Constructor. |
|
21 | + * |
|
22 | + * @param string $oid |
|
23 | + * @param bool $critical |
|
24 | + * @param Element $data |
|
25 | + */ |
|
26 | + public function __construct($oid, $critical, Element $data) |
|
27 | + { |
|
28 | + parent::__construct($oid, $critical); |
|
29 | + $this->_element = $data; |
|
30 | + } |
|
31 | 31 | |
32 | - /** |
|
33 | - * |
|
34 | - * {@inheritdoc} |
|
35 | - */ |
|
36 | - protected function _valueASN1() |
|
37 | - { |
|
38 | - return $this->_element; |
|
39 | - } |
|
32 | + /** |
|
33 | + * |
|
34 | + * {@inheritdoc} |
|
35 | + */ |
|
36 | + protected function _valueASN1() |
|
37 | + { |
|
38 | + return $this->_element; |
|
39 | + } |
|
40 | 40 | } |
@@ -11,51 +11,51 @@ |
||
11 | 11 | */ |
12 | 12 | class InhibitAnyPolicyExtension extends Extension |
13 | 13 | { |
14 | - /** |
|
15 | - * |
|
16 | - * @var int $_skipCerts |
|
17 | - */ |
|
18 | - protected $_skipCerts; |
|
14 | + /** |
|
15 | + * |
|
16 | + * @var int $_skipCerts |
|
17 | + */ |
|
18 | + protected $_skipCerts; |
|
19 | 19 | |
20 | - /** |
|
21 | - * Constructor. |
|
22 | - * |
|
23 | - * @param bool $critical |
|
24 | - * @param int $skip_certs |
|
25 | - */ |
|
26 | - public function __construct($critical, $skip_certs) |
|
27 | - { |
|
28 | - parent::__construct(self::OID_INHIBIT_ANY_POLICY, $critical); |
|
29 | - $this->_skipCerts = $skip_certs; |
|
30 | - } |
|
20 | + /** |
|
21 | + * Constructor. |
|
22 | + * |
|
23 | + * @param bool $critical |
|
24 | + * @param int $skip_certs |
|
25 | + */ |
|
26 | + public function __construct($critical, $skip_certs) |
|
27 | + { |
|
28 | + parent::__construct(self::OID_INHIBIT_ANY_POLICY, $critical); |
|
29 | + $this->_skipCerts = $skip_certs; |
|
30 | + } |
|
31 | 31 | |
32 | - /** |
|
33 | - * |
|
34 | - * {@inheritdoc} |
|
35 | - * @return self |
|
36 | - */ |
|
37 | - protected static function _fromDER($data, $critical) |
|
38 | - { |
|
39 | - return new self($critical, Integer::fromDER($data)->number()); |
|
40 | - } |
|
32 | + /** |
|
33 | + * |
|
34 | + * {@inheritdoc} |
|
35 | + * @return self |
|
36 | + */ |
|
37 | + protected static function _fromDER($data, $critical) |
|
38 | + { |
|
39 | + return new self($critical, Integer::fromDER($data)->number()); |
|
40 | + } |
|
41 | 41 | |
42 | - /** |
|
43 | - * Get value. |
|
44 | - * |
|
45 | - * @return int |
|
46 | - */ |
|
47 | - public function skipCerts() |
|
48 | - { |
|
49 | - return $this->_skipCerts; |
|
50 | - } |
|
42 | + /** |
|
43 | + * Get value. |
|
44 | + * |
|
45 | + * @return int |
|
46 | + */ |
|
47 | + public function skipCerts() |
|
48 | + { |
|
49 | + return $this->_skipCerts; |
|
50 | + } |
|
51 | 51 | |
52 | - /** |
|
53 | - * |
|
54 | - * {@inheritdoc} |
|
55 | - * @return Integer |
|
56 | - */ |
|
57 | - protected function _valueASN1() |
|
58 | - { |
|
59 | - return new Integer($this->_skipCerts); |
|
60 | - } |
|
52 | + /** |
|
53 | + * |
|
54 | + * {@inheritdoc} |
|
55 | + * @return Integer |
|
56 | + */ |
|
57 | + protected function _valueASN1() |
|
58 | + { |
|
59 | + return new Integer($this->_skipCerts); |
|
60 | + } |
|
61 | 61 | } |
@@ -12,95 +12,95 @@ |
||
12 | 12 | * @link https://tools.ietf.org/html/rfc5280#section-4.2.1.13 |
13 | 13 | */ |
14 | 14 | class CRLDistributionPointsExtension extends Extension implements |
15 | - \Countable, |
|
16 | - \IteratorAggregate |
|
15 | + \Countable, |
|
16 | + \IteratorAggregate |
|
17 | 17 | { |
18 | - /** |
|
19 | - * Distribution points. |
|
20 | - * |
|
21 | - * @var DistributionPoint[] $_distributionPoints |
|
22 | - */ |
|
23 | - protected $_distributionPoints; |
|
18 | + /** |
|
19 | + * Distribution points. |
|
20 | + * |
|
21 | + * @var DistributionPoint[] $_distributionPoints |
|
22 | + */ |
|
23 | + protected $_distributionPoints; |
|
24 | 24 | |
25 | - /** |
|
26 | - * Constructor. |
|
27 | - * |
|
28 | - * @param bool $critical |
|
29 | - * @param DistributionPoint ...$distribution_points |
|
30 | - */ |
|
31 | - public function __construct($critical, |
|
32 | - DistributionPoint ...$distribution_points) |
|
33 | - { |
|
34 | - parent::__construct(self::OID_CRL_DISTRIBUTION_POINTS, $critical); |
|
35 | - $this->_distributionPoints = $distribution_points; |
|
36 | - } |
|
25 | + /** |
|
26 | + * Constructor. |
|
27 | + * |
|
28 | + * @param bool $critical |
|
29 | + * @param DistributionPoint ...$distribution_points |
|
30 | + */ |
|
31 | + public function __construct($critical, |
|
32 | + DistributionPoint ...$distribution_points) |
|
33 | + { |
|
34 | + parent::__construct(self::OID_CRL_DISTRIBUTION_POINTS, $critical); |
|
35 | + $this->_distributionPoints = $distribution_points; |
|
36 | + } |
|
37 | 37 | |
38 | - /** |
|
39 | - * |
|
40 | - * {@inheritdoc} |
|
41 | - * @return self |
|
42 | - */ |
|
43 | - protected static function _fromDER($data, $critical) |
|
44 | - { |
|
45 | - $dps = array_map( |
|
46 | - function (UnspecifiedType $el) { |
|
47 | - return DistributionPoint::fromASN1($el->asSequence()); |
|
48 | - }, Sequence::fromDER($data)->elements()); |
|
49 | - if (!count($dps)) { |
|
50 | - throw new \UnexpectedValueException( |
|
51 | - "CRLDistributionPoints must have" . |
|
52 | - " at least one DistributionPoint."); |
|
53 | - } |
|
54 | - // late static bound, extended by Freshest CRL extension |
|
55 | - return new static($critical, ...$dps); |
|
56 | - } |
|
38 | + /** |
|
39 | + * |
|
40 | + * {@inheritdoc} |
|
41 | + * @return self |
|
42 | + */ |
|
43 | + protected static function _fromDER($data, $critical) |
|
44 | + { |
|
45 | + $dps = array_map( |
|
46 | + function (UnspecifiedType $el) { |
|
47 | + return DistributionPoint::fromASN1($el->asSequence()); |
|
48 | + }, Sequence::fromDER($data)->elements()); |
|
49 | + if (!count($dps)) { |
|
50 | + throw new \UnexpectedValueException( |
|
51 | + "CRLDistributionPoints must have" . |
|
52 | + " at least one DistributionPoint."); |
|
53 | + } |
|
54 | + // late static bound, extended by Freshest CRL extension |
|
55 | + return new static($critical, ...$dps); |
|
56 | + } |
|
57 | 57 | |
58 | - /** |
|
59 | - * |
|
60 | - * {@inheritdoc} |
|
61 | - * @return Sequence |
|
62 | - */ |
|
63 | - protected function _valueASN1() |
|
64 | - { |
|
65 | - if (!count($this->_distributionPoints)) { |
|
66 | - throw new \LogicException("No distribution points."); |
|
67 | - } |
|
68 | - $elements = array_map( |
|
69 | - function (DistributionPoint $dp) { |
|
70 | - return $dp->toASN1(); |
|
71 | - }, $this->_distributionPoints); |
|
72 | - return new Sequence(...$elements); |
|
73 | - } |
|
58 | + /** |
|
59 | + * |
|
60 | + * {@inheritdoc} |
|
61 | + * @return Sequence |
|
62 | + */ |
|
63 | + protected function _valueASN1() |
|
64 | + { |
|
65 | + if (!count($this->_distributionPoints)) { |
|
66 | + throw new \LogicException("No distribution points."); |
|
67 | + } |
|
68 | + $elements = array_map( |
|
69 | + function (DistributionPoint $dp) { |
|
70 | + return $dp->toASN1(); |
|
71 | + }, $this->_distributionPoints); |
|
72 | + return new Sequence(...$elements); |
|
73 | + } |
|
74 | 74 | |
75 | - /** |
|
76 | - * Get distribution points. |
|
77 | - * |
|
78 | - * @return DistributionPoint[] |
|
79 | - */ |
|
80 | - public function distributionPoints() |
|
81 | - { |
|
82 | - return $this->_distributionPoints; |
|
83 | - } |
|
75 | + /** |
|
76 | + * Get distribution points. |
|
77 | + * |
|
78 | + * @return DistributionPoint[] |
|
79 | + */ |
|
80 | + public function distributionPoints() |
|
81 | + { |
|
82 | + return $this->_distributionPoints; |
|
83 | + } |
|
84 | 84 | |
85 | - /** |
|
86 | - * Get the number of distribution points. |
|
87 | - * |
|
88 | - * @see \Countable::count() |
|
89 | - * @return int |
|
90 | - */ |
|
91 | - public function count() |
|
92 | - { |
|
93 | - return count($this->_distributionPoints); |
|
94 | - } |
|
85 | + /** |
|
86 | + * Get the number of distribution points. |
|
87 | + * |
|
88 | + * @see \Countable::count() |
|
89 | + * @return int |
|
90 | + */ |
|
91 | + public function count() |
|
92 | + { |
|
93 | + return count($this->_distributionPoints); |
|
94 | + } |
|
95 | 95 | |
96 | - /** |
|
97 | - * Get iterator for distribution points. |
|
98 | - * |
|
99 | - * @see \IteratorAggregate::getIterator() |
|
100 | - * @return \ArrayIterator |
|
101 | - */ |
|
102 | - public function getIterator() |
|
103 | - { |
|
104 | - return new \ArrayIterator($this->_distributionPoints); |
|
105 | - } |
|
96 | + /** |
|
97 | + * Get iterator for distribution points. |
|
98 | + * |
|
99 | + * @see \IteratorAggregate::getIterator() |
|
100 | + * @return \ArrayIterator |
|
101 | + */ |
|
102 | + public function getIterator() |
|
103 | + { |
|
104 | + return new \ArrayIterator($this->_distributionPoints); |
|
105 | + } |
|
106 | 106 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | protected static function _fromDER($data, $critical) |
44 | 44 | { |
45 | 45 | $dps = array_map( |
46 | - function (UnspecifiedType $el) { |
|
46 | + function(UnspecifiedType $el) { |
|
47 | 47 | return DistributionPoint::fromASN1($el->asSequence()); |
48 | 48 | }, Sequence::fromDER($data)->elements()); |
49 | 49 | if (!count($dps)) { |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | throw new \LogicException("No distribution points."); |
67 | 67 | } |
68 | 68 | $elements = array_map( |
69 | - function (DistributionPoint $dp) { |
|
69 | + function(DistributionPoint $dp) { |
|
70 | 70 | return $dp->toASN1(); |
71 | 71 | }, $this->_distributionPoints); |
72 | 72 | return new Sequence(...$elements); |