コード例 #1
0
ファイル: frob-nss-trust.c プロジェクト: Distrotech/p11-kit
static void
dump_object (P11KitIter *iter,
             CK_ATTRIBUTE *attrs)
{
	CK_ATTRIBUTE label = { CKA_LABEL, };
	CK_ATTRIBUTE *attr;
	char *string;
	char *name;
	CK_RV rv;

	attr = p11_attrs_find_valid (attrs, CKA_LABEL);
	if (!attr) {
		rv = p11_kit_iter_load_attributes (iter, &label, 1);
		if (rv == CKR_OK)
			attr = &label;
	}

	if (attr)
		name = strndup (attr->pValue, attr->ulValueLen);
	else
		name = strdup ("unknown");

	string = p11_attrs_to_string (attrs, -1);
	printf ("\"%s\" = %s\n", name, string);
	free (string);

	free (label.pValue);
	free (name);
}
コード例 #2
0
ファイル: anchor.c プロジェクト: p11-glue/p11-kit
static const char *
description_for_object_at_iter (p11_kit_iter *iter)
{
	CK_OBJECT_CLASS klass;
	CK_ATTRIBUTE attrs[] = {
		{ CKA_CLASS, &klass, sizeof (klass) },
		{ CKA_INVALID },
	};

	const char *desc = "object";
	CK_RV rv;

	rv = p11_kit_iter_load_attributes (iter, attrs, 1);
	if (rv == CKR_OK)
		desc = p11_constant_nick (p11_constant_classes, klass);

	return desc;
}