if (cc->nickname) { c->nickname = nssUTF8_Create(arena, nssStringType_UTF8String, (NSSUTF8 *)cc->nickname, PORT_Strlen(cc->nickname)); }
STAN_GetNSSCertificate(CERTCertificate *cc){    NSSCertificate *c;    nssCryptokiInstance *instance;    NSSArena *arena;    PRStatus nssrv;    c = cc->nssCertificate;    if (c) {    	return c;    }    /* i don't think this should happen.  but if it can, need to create     * NSSCertificate from CERTCertificate values here.  */    /* Yup, it can happen. */    arena = NSSArena_Create();    if (!arena) {	return NULL;    }    c = nss_ZNEW(arena, NSSCertificate);    if (!c) {	nssArena_Destroy(arena);	return NULL;    }    NSSITEM_FROM_SECITEM(&c->encoding, &cc->derCert);    c->type = NSSCertificateType_PKIX;    nssrv = nssPKIObject_Initialize(&c->object, arena, cc->dbhandle, NULL);    if (nssrv != PR_SUCCESS) {	nssPKIObject_Destroy(&c->object);    }    nssItem_Create(arena,                   &c->issuer, cc->derIssuer.len, cc->derIssuer.data);    nssItem_Create(arena,                   &c->subject, cc->derSubject.len, cc->derSubject.data);    if (PR_TRUE) {	/* CERTCertificate stores serial numbers decoded.  I need the DER	* here.  sigh.	*/	SECItem derSerial;	CERT_SerialNumberFromDERCert(&cc->derCert, &derSerial);	nssItem_Create(arena, &c->serial, derSerial.len, derSerial.data);	PORT_Free(derSerial.data);    }    if (cc->nickname) {	c->nickname = nssUTF8_Create(arena,                                     nssStringType_UTF8String,                                     (NSSUTF8 *)cc->nickname,                                     PORT_Strlen(cc->nickname));    }    if (cc->emailAddr) {        c->email = nssUTF8_Create(arena,                                  nssStringType_PrintableString,                                  (NSSUTF8 *)cc->emailAddr,                                  PORT_Strlen(cc->emailAddr));    }    if (cc->slot) {	instance = nss_ZNEW(arena, nssCryptokiInstance);	instance->token = PK11Slot_GetNSSToken(cc->slot);	instance->handle = cc->pkcs11ID;	instance->isTokenObject = PR_TRUE;	nssList_Add(c->object.instanceList, instance);	/* XXX Fix this! */	nssListIterator_Destroy(c->object.instances);	c->object.instances = nssList_CreateIterator(c->object.instanceList);    }    c->decoding = create_decoded_pkix_cert_from_nss3cert(NULL, cc);    cc->nssCertificate = c;    return c;}