CERTCertificate *certCert = STAN_GetCERTCertificate(c);
CERTCertificate *certCert = STAN_GetCERTCertificateOrRelease(c);
PK11_FindCertsFromNickname(char *nickname, void *wincx) {#ifdef NSS_CLASSIC    PK11SlotInfo *slot;    int i,count = 0;    CK_OBJECT_HANDLE *certID = PK11_FindObjectsFromNickname(nickname,&slot,				 		CKO_CERTIFICATE, &count, wincx);    CERTCertList *certList = NULL;    if (certID == NULL) return NULL;    certList= CERT_NewCertList();    for (i=0; i < count; i++) {    	CERTCertificate *cert = PK11_MakeCertFromHandle(slot,certID[i],NULL);	if (cert) CERT_AddCertToListTail(certList,cert);    }    if (CERT_LIST_HEAD(certList) == NULL) {	CERT_DestroyCertList(certList);	certList = NULL;    }    PK11_FreeSlot(slot);    PORT_Free(certID);    return certList;#else    char *nickCopy;    char *delimit = NULL;    char *tokenName;    int i;    CERTCertList *certList = NULL;    nssPKIObjectCollection *collection = NULL;    NSSCertificate **foundCerts = NULL;    NSSTrustDomain *defaultTD = STAN_GetDefaultTrustDomain();    NSSCertificate *c;    NSSToken *token;    PK11SlotInfo *slot;    SECStatus rv;    nickCopy = PORT_Strdup(nickname);    if ((delimit = PORT_Strchr(nickCopy,':')) != NULL) {	tokenName = nickCopy;	nickname = delimit + 1;	*delimit = '\0';	/* find token by name */	token = NSSTrustDomain_FindTokenByName(defaultTD, (NSSUTF8 *)tokenName);	if (token) {	    slot = PK11_ReferenceSlot(token->pk11slot);	} else {	    slot = NULL;	}	*delimit = ':';    } else {	slot = PK11_GetInternalKeySlot();	token = PK11Slot_GetNSSToken(slot);    }    if (token) {	PRStatus status;	nssList *nameList;	nssCryptokiObject **instances;	nssTokenSearchType tokenOnly = nssTokenSearchType_TokenOnly;   	rv = pk11_AuthenticateUnfriendly(slot, PR_TRUE, wincx);	if (rv != SECSuccess) {	    PK11_FreeSlot(slot);    	    if (nickCopy) PORT_Free(nickCopy);	    return NULL;	}	collection = nssCertificateCollection_Create(defaultTD, NULL);	if (!collection) {	    PK11_FreeSlot(slot);	    if (nickCopy) PORT_Free(nickCopy);	    return NULL;	}	nameList = nssList_Create(NULL, PR_FALSE);	if (!nameList) {	    PK11_FreeSlot(slot);	    if (nickCopy) PORT_Free(nickCopy);	    return NULL;	}	(void)nssTrustDomain_GetCertsForNicknameFromCache(defaultTD,	                                                  nickname, 	                                                  nameList);	transfer_token_certs_to_collection(nameList, token, collection);	instances = nssToken_FindCertificatesByNickname(token,	                                                NULL,	                                                nickname,	                                                tokenOnly,	                                                0,	                                                &status);	nssPKIObjectCollection_AddInstances(collection, instances, 0);	nss_ZFreeIf(instances);	nssList_Destroy(nameList);	foundCerts = nssPKIObjectCollection_GetCertificates(collection,	                                                    NULL, 0, NULL);	nssPKIObjectCollection_Destroy(collection);    }    if (slot) {	PK11_FreeSlot(slot);    }    if (nickCopy) PORT_Free(nickCopy);    if (foundCerts) {	PRTime now = PR_Now();	certList = CERT_NewCertList();	for (i=0, c = *foundCerts; c; c = foundCerts[++i]) {	    CERTCertificate *certCert = STAN_GetCERTCertificate(c);	    if (certCert) {		CERT_AddCertToListSorted(certList, certCert,			CERT_SortCBValidity, &now);	    }	}	if (CERT_LIST_HEAD(certList) == NULL) {	    CERT_DestroyCertList(certList);	    certList = NULL;	}	nss_ZFreeIf(foundCerts);    }    return certList;#endif}