@@ -142,10 +142,18 @@ public class Seahorse.Pkcs11.CertificateWidget : Gtk.Box {
142
142
} else if (extension is Gcr . CertificateExtensionExtendedKeyUsage ) {
143
143
add_ext_key_usage(prefs_group,
144
144
(Gcr . CertificateExtensionExtendedKeyUsage ) extension);
145
+ } else if (extension is Gcr . CertificateExtensionCertificatePolicies ) {
146
+ add_cert_policies(prefs_group, (Gcr . CertificateExtensionCertificatePolicies ) extension);
145
147
} else if (extension is Gcr . CertificateExtensionSubjectKeyIdentifier ) {
146
148
add_ski(prefs_group, (Gcr . CertificateExtensionSubjectKeyIdentifier ) extension);
149
+ } else if (extension is Gcr . CertificateExtensionAuthorityKeyIdentifier ) {
150
+ add_aki(prefs_group, (Gcr . CertificateExtensionAuthorityKeyIdentifier ) extension);
151
+ } else if (extension is Gcr . CertificateExtensionAuthorityInfoAccess ) {
152
+ add_aia(prefs_group, (Gcr . CertificateExtensionAuthorityInfoAccess ) extension);
147
153
} else if (extension is Gcr . CertificateExtensionSubjectAltName ) {
148
154
add_san(prefs_group, (Gcr . CertificateExtensionSubjectAltName ) extension);
155
+ } else if (extension is Gcr . CertificateExtensionCrlDistributionPoints ) {
156
+ add_cdp(prefs_group, (Gcr . CertificateExtensionCrlDistributionPoints ) extension);
149
157
} else {
150
158
add_generic_extension(prefs_group, extension);
151
159
}
@@ -181,14 +189,48 @@ public class Seahorse.Pkcs11.CertificateWidget : Gtk.Box {
181
189
group. add(row);
182
190
}
183
191
192
+ private void add_cert_policies(Adw . PreferencesGroup group,
193
+ Gcr . CertificateExtensionCertificatePolicies ext) {
194
+ for (uint i = 0 ; i < ext. get_n_items(); i++ ) {
195
+ unowned var policy = ext. get_policy(i);
196
+ var row = create_property_row(_(" Policy" ), policy. get_name());
197
+ group. add(row);
198
+
199
+ for (uint j = 0 ; j < policy. get_n_items(); j++ ) {
200
+ var qualifier = (Gcr . CertificatePolicyQualifier ) policy. get_item(j);
201
+ row = create_property_row(_(" Policy Qualifier" ), qualifier. get_name());
202
+ group. add(row);
203
+ }
204
+ }
205
+ }
206
+
184
207
private void add_ski(Adw . PreferencesGroup group,
185
208
Gcr . CertificateExtensionSubjectKeyIdentifier ext) {
186
209
var keyid = bytes_to_hex(ext. get_key_id(), " :" );
187
- var row = create_property_row(_(" Subject Key Identifier" ), keyid);
210
+ var row = create_property_row(_(" Key Identifier" ), keyid);
211
+ row. add_css_class(" monospace" );
212
+ group. add(row);
213
+ }
214
+
215
+ private void add_aki(Adw . PreferencesGroup group,
216
+ Gcr . CertificateExtensionAuthorityKeyIdentifier ext) {
217
+ var keyid = bytes_to_hex(ext. get_key_id(), " :" );
218
+ var row = create_property_row(_(" Key Identifier" ), keyid);
188
219
row. add_css_class(" monospace" );
189
220
group. add(row);
190
221
}
191
222
223
+ private void add_aia(Adw . PreferencesGroup group,
224
+ Gcr . CertificateExtensionAuthorityInfoAccess ext) {
225
+ for (uint i = 0 ; i < ext. get_n_items(); i++ ) {
226
+ unowned var descr = ext. get_description(i);
227
+ var method = _(" Method: %s " ). printf(descr. get_method_name());
228
+ unowned var location = descr. get_location(). get_value();
229
+ var row = create_property_row(method, location);
230
+ group. add(row);
231
+ }
232
+ }
233
+
192
234
private void add_san(Adw . PreferencesGroup group,
193
235
Gcr . CertificateExtensionSubjectAltName ext) {
194
236
for (uint i = 0 ; i < ext. get_n_items(); i++ ) {
@@ -199,6 +241,22 @@ public class Seahorse.Pkcs11.CertificateWidget : Gtk.Box {
199
241
}
200
242
}
201
243
244
+ private void add_cdp(Adw . PreferencesGroup group,
245
+ Gcr . CertificateExtensionCrlDistributionPoints ext) {
246
+ for (uint i = 0 ; i < ext. get_n_items(); i++ ) {
247
+ unowned var endpoint = ext. get_distribution_point(i);
248
+
249
+ unowned var full_name = endpoint. get_full_name();
250
+ if (full_name != null ) {
251
+ string [] name_val = {};
252
+ for (uint j = 0 ; j < full_name. get_n_items(); j++ )
253
+ name_val + = full_name. get_name(j). get_value();
254
+ var row = create_property_row(_(" Distribution Point" ), string . joinv(" ;" , name_val));
255
+ group. add(row);
256
+ }
257
+ }
258
+ }
259
+
202
260
private void add_generic_extension(Adw . PreferencesGroup group,
203
261
Gcr . CertificateExtension ext) {
204
262
var value_str = bytes_to_hex(ext. value );
@@ -221,7 +279,7 @@ public class Seahorse.Pkcs11.CertificateWidget : Gtk.Box {
221
279
222
280
private string bytes_to_hex(Bytes bytes, string ? sep2char = null ) {
223
281
var result = new StringBuilder ();
224
- unowned var data = bytes. get_data();
282
+ unowned uint8 [] data = bytes. get_data();
225
283
for (uint i = 0 ; i < data. length; i++ ) {
226
284
if (sep2char != null && i > 0 )
227
285
result. append(sep2char);
0 commit comments