Search code examples
x509glibgiogjs

How can I get the SHA1 fingerprint of a TlsCertificate in GJS?


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?


Solution

  • 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.