1 | <?php |
||
22 | class AttributeCertificate |
||
23 | { |
||
24 | /** |
||
25 | * Attribute certificate info. |
||
26 | * |
||
27 | * @var AttributeCertificateInfo $_acinfo |
||
28 | */ |
||
29 | protected $_acinfo; |
||
30 | |||
31 | /** |
||
32 | * Signature algorithm identifier. |
||
33 | * |
||
34 | * @var SignatureAlgorithmIdentifier $_signatureAlgorithm |
||
35 | */ |
||
36 | protected $_signatureAlgorithm; |
||
37 | |||
38 | /** |
||
39 | * Signature value. |
||
40 | * |
||
41 | * @var Signature $_signatureValue |
||
42 | */ |
||
43 | protected $_signatureValue; |
||
44 | |||
45 | /** |
||
46 | * Constructor. |
||
47 | * |
||
48 | * @param AttributeCertificateInfo $acinfo |
||
49 | * @param SignatureAlgorithmIdentifier $algo |
||
50 | * @param Signature $signature |
||
51 | */ |
||
52 | 5 | public function __construct(AttributeCertificateInfo $acinfo, |
|
59 | |||
60 | /** |
||
61 | * Initialize from ASN.1. |
||
62 | * |
||
63 | * @param Sequence $seq |
||
64 | * @return self |
||
65 | */ |
||
66 | 4 | public static function fromASN1(Sequence $seq): self |
|
80 | |||
81 | /** |
||
82 | * Initialize from DER data. |
||
83 | * |
||
84 | * @param string $data |
||
85 | * @return self |
||
86 | */ |
||
87 | 1 | public static function fromDER(string $data): self |
|
91 | |||
92 | /** |
||
93 | * Initialize from PEM. |
||
94 | * |
||
95 | * @param PEM $pem |
||
96 | * @throws \UnexpectedValueException |
||
97 | * @return self |
||
98 | */ |
||
99 | 2 | public static function fromPEM(PEM $pem): self |
|
106 | |||
107 | /** |
||
108 | * Get attribute certificate info. |
||
109 | * |
||
110 | * @return AttributeCertificateInfo |
||
111 | */ |
||
112 | 7 | public function acinfo(): AttributeCertificateInfo |
|
116 | |||
117 | /** |
||
118 | * Get signature algorithm identifier. |
||
119 | * |
||
120 | * @return SignatureAlgorithmIdentifier |
||
121 | */ |
||
122 | 2 | public function signatureAlgorithm(): SignatureAlgorithmIdentifier |
|
126 | |||
127 | /** |
||
128 | * Get signature value. |
||
129 | * |
||
130 | * @return Signature |
||
131 | */ |
||
132 | 1 | public function signatureValue(): Signature |
|
136 | |||
137 | /** |
||
138 | * Get ASN.1 structure. |
||
139 | * |
||
140 | * @return Sequence |
||
141 | */ |
||
142 | 4 | public function toASN1(): Sequence |
|
148 | |||
149 | /** |
||
150 | * Get attribute certificate as a DER. |
||
151 | * |
||
152 | * @return string |
||
153 | */ |
||
154 | 2 | public function toDER(): string |
|
158 | |||
159 | /** |
||
160 | * Get attribute certificate as a PEM. |
||
161 | * |
||
162 | * @return PEM |
||
163 | */ |
||
164 | 2 | public function toPEM(): PEM |
|
168 | |||
169 | /** |
||
170 | * Check whether attribute certificate is issued to the subject identified |
||
171 | * by given public key certificate. |
||
172 | * |
||
173 | * @param Certificate $cert Certificate |
||
174 | * @return boolean |
||
175 | */ |
||
176 | 13 | public function isHeldBy(Certificate $cert): bool |
|
183 | |||
184 | /** |
||
185 | * Check whether attribute certificate is issued by given public key |
||
186 | * certificate. |
||
187 | * |
||
188 | * @param Certificate $cert Certificate |
||
189 | * @return boolean |
||
190 | */ |
||
191 | 11 | public function isIssuedBy(Certificate $cert): bool |
|
198 | |||
199 | /** |
||
200 | * Verify signature. |
||
201 | * |
||
202 | * @param PublicKeyInfo $pubkey_info Signer's public key |
||
203 | * @param Crypto|null $crypto Crypto engine, use default if not set |
||
204 | * @return bool |
||
205 | */ |
||
206 | 10 | public function verify(PublicKeyInfo $pubkey_info, Crypto $crypto = null): bool |
|
213 | |||
214 | /** |
||
215 | * Get attribute certificate as a PEM formatted string. |
||
216 | * |
||
217 | * @return string |
||
218 | */ |
||
219 | 1 | public function __toString() |
|
223 | } |
||
224 |