Re: Display TLS certificate in the GUI



On Fri, Jun 24, 2016 at 8:06 AM Jay Strict <jay strict posteo de> wrote:
Hello list,

in a Gnome Shell extension I want to connect with libsoup to a https://
URI which has a self-signed certificate.
My intention is to let the extension display the certificate to the user
and let the user decide whether to trust the certificate.

[...] 
However, the line
let cert = msg.tls_certificate.certificate;
ist not exectuted. It prints an error message:

======================================================================
(gnome-shell:543): Gjs-WARNING **: JS ERROR: Error: Unable to introspect
element-type of container in GValue
======================================================================


Can someone help me understand this error message?

Unfortunately, it means that you can't use that property in GJS. The documentation for that property from the C API [1] says it is of type GByteArray*, and the GJS source code seems to suggest that such values are explicitly not yet supported in GJS [2].
 
Has someone a suggestion for a better solution?

If you just wanted the data you could use the 'certificate-pem' property [3]. As the documentation states, "This property and the “certificate” property represent the same data, just in different forms."

However, it seems like you can't construct a Gcr.Certificate object from the PEM-encoded data. I don't have a good solution for this.

[1] https://developer.gnome.org/gio/unstable/GTlsCertificate.html#GTlsCertificate--certificate 
[2] https://git.gnome.org/browse/gjs/tree/gi/value.cpp#n875
[3] https://developer.gnome.org/gio/unstable/GTlsCertificate.html#GTlsCertificate--certificate-pem



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]