c = nssToken_FindCertificateByEncodedCertificate(tok, NULL, &derCert,
if (!nssToken_SearchCerts(tok)) { c = filter_token_certs_DER(tok, &derCert); } else { c = nssTrustDomain_GetCertByDERFromCache(td, &derCert); if (!c) { c = nssToken_FindCertificateByEncodedCertificate(tok, NULL, &derCert,
PK11_FindCertFromDERCert(PK11SlotInfo *slot, CERTCertificate *cert,								 void *wincx){#ifdef NSS_CLASSIC    CK_OBJECT_CLASS certClass = CKO_CERTIFICATE;    CK_ATTRIBUTE theTemplate[] = {	{ CKA_VALUE, NULL, 0 },	{ CKA_CLASS, NULL, 0 }    };    /* if you change the array, change the variable below as well */    int tsize = sizeof(theTemplate)/sizeof(theTemplate[0]);    CK_OBJECT_HANDLE certh;    CK_ATTRIBUTE *attrs = theTemplate;    SECStatus rv;    PK11_SETATTRS(attrs, CKA_VALUE, cert->derCert.data, 						cert->derCert.len); attrs++;    PK11_SETATTRS(attrs, CKA_CLASS, &certClass, sizeof(certClass));    /*     * issue the find     */    if ( !PK11_IsFriendly(slot)) {	rv = PK11_Authenticate(slot, PR_TRUE, wincx);	if (rv != SECSuccess) return NULL;    }    certh = pk11_getcerthandle(slot,cert,theTemplate,tsize);    if (certh == CK_INVALID_HANDLE) {	return NULL;    }    return PK11_MakeCertFromHandle(slot, certh, NULL);#else    CERTCertificate *rvCert = NULL;    NSSCertificate *c;    NSSDER derCert;    NSSToken *tok;    tok = PK11Slot_GetNSSToken(slot);    NSSITEM_FROM_SECITEM(&derCert, &cert->derCert);    /* XXX login to slots */    c = nssToken_FindCertificateByEncodedCertificate(tok, NULL, &derCert,                                                nssTokenSearchType_TokenOnly);    if (c) {	rvCert = STAN_GetCERTCertificate(c);    }    return rvCert;#endif} 