public static unsafe TlsCertificate NewFromPem(string data) { IntPtr native_data = GLib.Marshaller.StringToPtrGStrdup(data); IntPtr error = IntPtr.Zero; TlsCertificate result = new TlsCertificate(g_tls_certificate_new_from_pem(native_data, new IntPtr((long)System.Text.Encoding.UTF8.GetByteCount(data)), out error)); GLib.Marshaller.Free(native_data); if (error != IntPtr.Zero) { throw new GLib.GException(error); } return(result); }
static int Verify_cb(IntPtr inst, IntPtr identity, IntPtr trusted_ca) { try { TlsCertificate __obj = GLib.Object.GetObject(inst, false) as TlsCertificate; GLib.TlsCertificateFlags __result; __result = __obj.OnVerify(GLib.SocketConnectableAdapter.GetObject(identity, false), GLib.Object.GetObject(trusted_ca) as GLib.TlsCertificate); return((int)__result); } catch (Exception e) { GLib.ExceptionManager.RaiseUnhandledException(e, true); // NOTREACHED: above call does not return. throw e; } }