nssToken_TraverseCertificatesByNickname(token, NULL, (NSSASCII7 *)nickname, &search);
nssToken_TraverseCertificatesByEmail(token, NULL, (NSSASCII7 *)nickname, &search);
PK11_FindCertFromNickname(char *nickname, void *wincx) {#ifdef NSS_CLASSIC    PK11SlotInfo *slot;    int count=0;    CK_OBJECT_HANDLE *certID = PK11_FindObjectsFromNickname(nickname,&slot,				 		CKO_CERTIFICATE, &count, wincx);    CERTCertificate *cert;    if (certID == CK_INVALID_HANDLE) return NULL;    cert = PK11_MakeCertFromHandle(slot,certID[0],NULL);    PK11_FreeSlot(slot);    PORT_Free(certID);    return cert;#else    CERTCertificate *rvCert = NULL;    NSSCertificate *cert = NULL;    NSSUsage usage;    char *delimit = NULL;    char *tokenName;    NSSTrustDomain *defaultTD = STAN_GetDefaultTrustDomain();    usage.anyUsage = PR_TRUE;    /* XXX login to slots ... */    if ((delimit = PORT_Strchr(nickname,':')) != NULL) {	NSSToken *token;	tokenName = nickname;	nickname = delimit + 1;	*delimit = '\0';	/* find token by name */	token = NSSTrustDomain_FindTokenByName(defaultTD, (NSSUTF8 *)tokenName);	if (token) {	    nssTokenCertSearch search;	    nssList *certList;	    certList = nssList_Create(NULL, PR_FALSE);	    (void)nssTrustDomain_GetCertsForNicknameFromCache(defaultTD, 	                                                      nickname, 	                                                      certList);	    /* set the search criteria */	    search.callback = get_newest_cert;	    search.cbarg = (void *)&cert;	    search.cached = certList;	    search.trustDomain = defaultTD;	    search.cryptoContext = NULL;	    /* find best cert on token */	    nssToken_TraverseCertificatesByNickname(token, NULL, 	                                            (NSSUTF8 *)nickname,	                                            &search);	    nssList_Destroy(certList);	    if (!cert) {		certList = nssList_Create(NULL, PR_FALSE);		(void)nssTrustDomain_GetCertsForEmailAddressFromCache(		                                                  defaultTD, 	                                                          nickname, 	                                                          certList);		search.cached = certList;		nssToken_TraverseCertificatesByNickname(token, NULL, 		                                        (NSSASCII7 *)nickname,		                                        &search);		nssList_Destroy(certList);	    }	}    } else {	/* search the whole trust domain */	cert = NSSTrustDomain_FindBestCertificateByNickname(                                                  defaultTD,                                                  (NSSUTF8 *)nickname,                                                  NULL,                                                  &usage,                                                  NULL);	if (!cert) {	    cert = NSSTrustDomain_FindCertificateByEmail(defaultTD, 		                                         (NSSASCII7 *)nickname,		                                          NULL, &usage, NULL);	}    }    if (cert) {	rvCert = STAN_GetCERTCertificate(cert);    }    if (delimit) {	*delimit = ':';    }    return rvCert;#endif}