0

I'm trying to get a fingerprint of a Gio.TlsCertificate of a connection, which as I understand it is just a SHA1 checksum of the certificate in DER form. So I think I could use GLib.compute_checksum_for_data() on the certificate property of the Gio.TlsCertificate object, but any attempt to access that property results in:

JS ERROR: Error: Unable to introspect element-type of container in GValue

Is there a way I can access the certificate property, or an easier way to fingerprint a certificate in GLib?

andy.holmes
  • 3,383
  • 17
  • 28

1 Answers1

1

This looks like a bug in the generated introspection XML for Gio.TlsCertificate.certificate. I’ve filed an upstream bug about it.

In the meantime, you may be able to work around this by retrieving the property manually using g_object_get() and handling things that way; I don’t know what workarounds are exactly possible in JS.

Philip Withnall
  • 5,293
  • 14
  • 28
  • It was worth a shot (I keep forgetting about that function), but results in the same error. Generally the only workarounds in GJS are to use, or chain, other functions that provide the same functionality, but in this case I don't think there's another way to get the DER format. Probably it's not that commonly used for anything, although a `fingerprint()` function would be, I bet. Thanks for filing the bug report for me. – andy.holmes Sep 28 '17 at 01:46
  • A `fingerprint()` function (or property) would probably be useful to have upstream — do you want to file an upstream bug report about adding that (and making sure it’s introspectable!)? Thanks. – Philip Withnall Sep 28 '17 at 13:14