コード例 #1
0
ファイル: gcr-certificate.c プロジェクト: SuspiciouSx/gcr
/**
 * gcr_certificate_get_subject_name:
 * @self: a #GcrCertificate
 *
 * Get a name to represent the subject of this certificate.
 *
 * This will try to lookup the common name, orianizational unit,
 * organization in that order.
 *
 * Returns: the allocated subject name, or NULL if no subject name
 */
gchar *
gcr_certificate_get_subject_name (GcrCertificate *self)
{
	gchar *name;

	name = gcr_certificate_get_subject_part (self, "cn");
	if (name == NULL)
		name = gcr_certificate_get_subject_part (self, "ou");
	if (name == NULL)
		name = gcr_certificate_get_subject_part (self, "o");

	return name;
}
コード例 #2
0
ファイル: frob-tree-selector.c プロジェクト: Distrotech/gcr
static void
on_parser_parsed (GcrParser *parser, gpointer user_data)
{
	GcrSimpleCollection *collection = user_data;
	GcrSimpleCollection *testcol;
	GcrRenderer *renderer;
	gchar *group;

	renderer = gcr_renderer_create (gcr_parser_get_parsed_label (parser),
	                                gcr_parser_get_parsed_attributes (parser));
	if (renderer == NULL)
		return;

	if (GCR_IS_CERTIFICATE (renderer))
		group = gcr_certificate_get_subject_part (GCR_CERTIFICATE (renderer), "O");
	else
		group = g_strdup (G_OBJECT_TYPE_NAME (renderer));


	testcol = test_collection_instance (group);
	if (!gcr_simple_collection_contains (collection, G_OBJECT (testcol)))
		gcr_simple_collection_add (collection, G_OBJECT (testcol));

	gcr_simple_collection_add (GCR_SIMPLE_COLLECTION (testcol), G_OBJECT (renderer));
	g_object_unref (renderer);
	g_object_unref (testcol);
	g_free (group);
}
コード例 #3
0
/**
 * gcr_certificate_get_subject_cn:
 * @self: a #GcrCertificate
 * 
 * Get the common name of the subject of this certificate. 
 * 
 * The string returned should be freed by the caller when no longer
 * required.
 * 
 * Returns: The allocated subject CN, or NULL if no subject CN present.
 */
gchar* 
gcr_certificate_get_subject_cn (GcrCertificate *self)
{
	return gcr_certificate_get_subject_part (self, "cn");
}