1 | <?php |
||
16 | class ExtendedKeyUsageExtension extends Extension implements |
||
17 | \Countable, |
||
18 | \IteratorAggregate |
||
19 | { |
||
20 | const OID_SERVER_AUTH = "1.3.6.1.5.5.7.3.1"; |
||
21 | const OID_CLIENT_AUTH = "1.3.6.1.5.5.7.3.2"; |
||
22 | const OID_CODE_SIGNING = "1.3.6.1.5.5.7.3.3"; |
||
23 | const OID_EMAIL_PROTECTION = "1.3.6.1.5.5.7.3.4"; |
||
24 | const OID_IPSEC_END_SYSTEM = "1.3.6.1.5.5.7.3.5"; |
||
25 | const OID_IPSEC_TUNNEL = "1.3.6.1.5.5.7.3.6"; |
||
26 | const OID_IPSEC_USER = "1.3.6.1.5.5.7.3.7"; |
||
27 | const OID_TIME_STAMPING = "1.3.6.1.5.5.7.3.8"; |
||
28 | const OID_OCSP_SIGNING = "1.3.6.1.5.5.7.3.9"; |
||
29 | const OID_DVCS = "1.3.6.1.5.5.7.3.10"; |
||
30 | const OID_SBGP_CERT_AA_SERVER_AUTH = "1.3.6.1.5.5.7.3.11"; |
||
31 | const OID_SCVP_RESPONDER = "1.3.6.1.5.5.7.3.12"; |
||
32 | const OID_EAP_OVER_PPP = "1.3.6.1.5.5.7.3.13"; |
||
33 | const OID_EAP_OVER_LAN = "1.3.6.1.5.5.7.3.14"; |
||
34 | const OID_SCVP_SERVER = "1.3.6.1.5.5.7.3.15"; |
||
35 | const OID_SCVP_CLIENT = "1.3.6.1.5.5.7.3.16"; |
||
36 | const OID_IPSEC_IKE = "1.3.6.1.5.5.7.3.17"; |
||
37 | const OID_CAPWAP_AC = "1.3.6.1.5.5.7.3.18"; |
||
38 | const OID_CAPWAP_WTP = "1.3.6.1.5.5.7.3.19"; |
||
39 | const OID_SIP_DOMAIN = "1.3.6.1.5.5.7.3.20"; |
||
40 | const OID_SECURE_SHELL_CLIENT = "1.3.6.1.5.5.7.3.21"; |
||
41 | const OID_SECURE_SHELL_SERVER = "1.3.6.1.5.5.7.3.22"; |
||
42 | const OID_SEND_ROUTER = "1.3.6.1.5.5.7.3.23"; |
||
43 | const OID_SEND_PROXY = "1.3.6.1.5.5.7.3.24"; |
||
44 | const OID_SEND_OWNER = "1.3.6.1.5.5.7.3.25"; |
||
45 | const OID_SEND_PROXIED_OWNER = "1.3.6.1.5.5.7.3.26"; |
||
46 | const OID_CMC_CA = "1.3.6.1.5.5.7.3.27"; |
||
47 | const OID_CMC_RA = "1.3.6.1.5.5.7.3.28"; |
||
48 | const OID_CMC_ARCHIVE = "1.3.6.1.5.5.7.3.29"; |
||
49 | |||
50 | /** |
||
51 | * Purpose OID's. |
||
52 | * |
||
53 | * @var string[] $_purposes |
||
54 | */ |
||
55 | protected $_purposes; |
||
56 | |||
57 | /** |
||
58 | * Constructor. |
||
59 | * |
||
60 | * @param bool $critical |
||
61 | * @param string ...$purposes |
||
62 | */ |
||
63 | 10 | public function __construct(bool $critical, string ...$purposes) |
|
68 | |||
69 | /** |
||
70 | * |
||
71 | * {@inheritdoc} |
||
72 | * @return self |
||
73 | */ |
||
74 | 9 | protected static function _fromDER(string $data, bool $critical): self |
|
82 | |||
83 | /** |
||
84 | * Whether purposes are present. |
||
85 | * |
||
86 | * If multiple purposes are checked, all must be present. |
||
87 | * |
||
88 | * @param string ...$oids |
||
89 | * @return bool |
||
90 | */ |
||
91 | 3 | public function has(string ...$oids): bool |
|
100 | |||
101 | /** |
||
102 | * Get key usage purpose OID's. |
||
103 | * |
||
104 | * @return string[] |
||
105 | */ |
||
106 | 1 | public function purposes(): array |
|
110 | |||
111 | /** |
||
112 | * |
||
113 | * {@inheritdoc} |
||
114 | * @return Sequence |
||
115 | */ |
||
116 | 15 | protected function _valueASN1(): Sequence |
|
124 | |||
125 | /** |
||
126 | * Get the number of purposes. |
||
127 | * |
||
128 | * @see \Countable::count() |
||
129 | * @return int |
||
130 | */ |
||
131 | 1 | public function count(): int |
|
135 | |||
136 | /** |
||
137 | * Get iterator for usage purposes. |
||
138 | * |
||
139 | * @see \IteratorAggregate::getIterator() |
||
140 | * @return \ArrayIterator |
||
141 | */ |
||
142 | 1 | public function getIterator(): \ArrayIterator |
|
146 | } |
||
147 |