NSS_CK_SET_ATTRIBUTE_UTF8(attr, CKA_LABEL,             cert->nickname);
NSS_CK_SET_ATTRIBUTE_UTF8(attr, CKA_LABEL,             nickname);
nssToken_ImportCertificate(  NSSToken *tok,  nssSession *sessionOpt,  NSSCertificate *cert,  PRBool asTokenObject){    nssCryptokiInstance *instance;    CK_CERTIFICATE_TYPE cert_type = CKC_X_509;    CK_OBJECT_HANDLE handle;    CK_ATTRIBUTE_PTR attr;    CK_ATTRIBUTE cert_tmpl[9];    CK_ULONG ctsize;    NSS_CK_TEMPLATE_START(cert_tmpl, attr, ctsize);    if (asTokenObject) {	NSS_CK_SET_ATTRIBUTE_ITEM(attr, CKA_TOKEN, &g_ck_true);    } else {	NSS_CK_SET_ATTRIBUTE_ITEM(attr, CKA_TOKEN, &g_ck_false);    }    NSS_CK_SET_ATTRIBUTE_ITEM(attr, CKA_CLASS,            &g_ck_class_cert);    NSS_CK_SET_ATTRIBUTE_VAR( attr, CKA_CERTIFICATE_TYPE,  cert_type);    NSS_CK_SET_ATTRIBUTE_ITEM(attr, CKA_ID,               &cert->id);    NSS_CK_SET_ATTRIBUTE_UTF8(attr, CKA_LABEL,             cert->nickname);    NSS_CK_SET_ATTRIBUTE_ITEM(attr, CKA_VALUE,            &cert->encoding);    NSS_CK_SET_ATTRIBUTE_ITEM(attr, CKA_ISSUER,           &cert->issuer);    NSS_CK_SET_ATTRIBUTE_ITEM(attr, CKA_SUBJECT,          &cert->subject);    NSS_CK_SET_ATTRIBUTE_ITEM(attr, CKA_SERIAL_NUMBER,    &cert->serial);    NSS_CK_TEMPLATE_FINISH(cert_tmpl, attr, ctsize);    /* Import the certificate onto the token */    handle = import_object(tok, sessionOpt, cert_tmpl, ctsize);    if (handle == CK_INVALID_HANDLE) {	return PR_FAILURE;    }    instance = create_cryptoki_instance(cert->object.arena,                                         tok, handle, asTokenObject);    if (!instance) {	/* XXX destroy object */	return PR_FAILURE;    }    nssList_Add(cert->object.instanceList, instance);    /* XXX Fix this! */    nssListIterator_Destroy(cert->object.instances);    cert->object.instances = nssList_CreateIterator(cert->object.instanceList);    return PR_SUCCESS;}