1 | <?php |
||
20 | class AttributeCertificate |
||
21 | { |
||
22 | /** |
||
23 | * Attribute certificate info. |
||
24 | * |
||
25 | * @var AttributeCertificateInfo $_acinfo |
||
26 | */ |
||
27 | protected $_acinfo; |
||
28 | |||
29 | /** |
||
30 | * Signature algorithm identifier. |
||
31 | * |
||
32 | * @var SignatureAlgorithmIdentifier $_signatureAlgorithm |
||
33 | */ |
||
34 | protected $_signatureAlgorithm; |
||
35 | |||
36 | /** |
||
37 | * Signature value. |
||
38 | * |
||
39 | * @var Signature $_signatureValue |
||
40 | */ |
||
41 | protected $_signatureValue; |
||
42 | |||
43 | /** |
||
44 | * Constructor |
||
45 | * |
||
46 | * @param AttributeCertificateInfo $acinfo |
||
47 | * @param SignatureAlgorithmIdentifier $algo |
||
48 | * @param Signature $signature |
||
49 | */ |
||
50 | 5 | public function __construct(AttributeCertificateInfo $acinfo, |
|
56 | |||
57 | /** |
||
58 | * Initialize from ASN.1. |
||
59 | * |
||
60 | * @param Sequence $seq |
||
61 | * @return self |
||
62 | */ |
||
63 | 4 | public static function fromASN1(Sequence $seq) { |
|
73 | |||
74 | /** |
||
75 | * Initialize from DER data. |
||
76 | * |
||
77 | * @param string $data |
||
78 | * @return self |
||
79 | */ |
||
80 | 1 | public static function fromDER($data) { |
|
83 | |||
84 | /** |
||
85 | * Initialize from PEM. |
||
86 | * |
||
87 | * @param PEM $pem |
||
88 | * @throws \UnexpectedValueException |
||
89 | * @return self |
||
90 | */ |
||
91 | 2 | public static function fromPEM(PEM $pem) { |
|
97 | |||
98 | /** |
||
99 | * Get attribute certificate info. |
||
100 | * |
||
101 | * @return AttributeCertificateInfo |
||
102 | */ |
||
103 | 7 | public function acinfo() { |
|
106 | |||
107 | /** |
||
108 | * Get signature algorithm identifier. |
||
109 | * |
||
110 | * @return SignatureAlgorithmIdentifier |
||
111 | */ |
||
112 | 2 | public function signatureAlgorithm() { |
|
115 | |||
116 | /** |
||
117 | * Get signature value. |
||
118 | * |
||
119 | * @return Signature |
||
120 | */ |
||
121 | 1 | public function signatureValue() { |
|
124 | |||
125 | /** |
||
126 | * Get ASN.1 structure. |
||
127 | * |
||
128 | * @return Sequence |
||
129 | */ |
||
130 | 4 | public function toASN1() { |
|
135 | |||
136 | /** |
||
137 | * Get attribute certificate as a DER. |
||
138 | * |
||
139 | * @return string |
||
140 | */ |
||
141 | 2 | public function toDER() { |
|
144 | |||
145 | /** |
||
146 | * Get attribute certificate as a PEM. |
||
147 | * |
||
148 | * @return PEM |
||
149 | */ |
||
150 | 2 | public function toPEM() { |
|
153 | |||
154 | /** |
||
155 | * Check whether attribute certificate is issued to the subject identified |
||
156 | * by given public key certificate. |
||
157 | * |
||
158 | * @param Certificate $cert Certificate |
||
159 | * @return boolean |
||
160 | */ |
||
161 | 13 | public function isHeldBy(Certificate $cert) { |
|
167 | |||
168 | /** |
||
169 | * Check whether attribute certificate is issued by given public key |
||
170 | * certificate. |
||
171 | * |
||
172 | * @param Certificate $cert Certificate |
||
173 | * @return boolean |
||
174 | */ |
||
175 | 11 | public function isIssuedBy(Certificate $cert) { |
|
181 | |||
182 | /** |
||
183 | * Verify signature. |
||
184 | * |
||
185 | * @param Crypto $crypto |
||
186 | * @param PublicKeyInfo $pubkey_info Signer's public key |
||
187 | * @return bool |
||
188 | */ |
||
189 | 10 | public function verify(Crypto $crypto, PublicKeyInfo $pubkey_info) { |
|
194 | |||
195 | /** |
||
196 | * Get attribute certificate as a PEM formatted string. |
||
197 | * |
||
198 | * @return string |
||
199 | */ |
||
200 | 1 | public function __toString() { |
|
203 | } |
||
204 |