objects = find_objects_by_template(token, sessionOpt,
if (searchType == nssTokenSearchType_TokenForced) { objects = find_objects(token, sessionOpt, cert_template, ctsize, 1, statusOpt); } else { objects = find_objects_by_template(token, sessionOpt,
nssToken_FindCertificateByIssuerAndSerialNumber(  NSSToken *token,  nssSession *sessionOpt,  NSSDER *issuer,  NSSDER *serial,  nssTokenSearchType searchType,  PRStatus *statusOpt){    CK_ATTRIBUTE_PTR attr;    CK_ATTRIBUTE_PTR serialAttr;    CK_ATTRIBUTE cert_template[4];    CK_ULONG ctsize;    nssCryptokiObject **objects;    nssCryptokiObject *rvObject = NULL;    NSS_CK_TEMPLATE_START(cert_template, attr, ctsize);    /* Set the search to token/session only if provided */    if (searchType == nssTokenSearchType_SessionOnly) {	NSS_CK_SET_ATTRIBUTE_ITEM(attr, CKA_TOKEN, &g_ck_false);    } else if (searchType == nssTokenSearchType_TokenOnly) {	NSS_CK_SET_ATTRIBUTE_ITEM(attr, CKA_TOKEN, &g_ck_true);    }    /* Set the unique id */    NSS_CK_SET_ATTRIBUTE_ITEM(attr, CKA_CLASS,         &g_ck_class_cert);    NSS_CK_SET_ATTRIBUTE_ITEM(attr, CKA_ISSUER,         issuer);    serialAttr = attr;    NSS_CK_SET_ATTRIBUTE_ITEM(attr, CKA_SERIAL_NUMBER,  serial);    NSS_CK_TEMPLATE_FINISH(cert_template, attr, ctsize);    /* get the object handle */    objects = find_objects_by_template(token, sessionOpt,                                       cert_template, ctsize,                                       1, statusOpt);    if (objects) {	rvObject = objects[0];	nss_ZFreeIf(objects);    }    /*     * NSS used to incorrectly store serial numbers in their decoded form.     * because of this old tokens have decoded serial numbers.     */    if (!objects) {	NSSItem serialDecode;	PRStatus status;	status = nssToken_decodeSerialItem(serial, &serialDecode);	if (status != PR_SUCCESS) {	    return NULL;	}    	NSS_CK_SET_ATTRIBUTE_ITEM(serialAttr,CKA_SERIAL_NUMBER,&serialDecode);	objects = find_objects_by_template(token, sessionOpt,                                       cert_template, ctsize,                                       1, statusOpt);	if (objects) {	    rvObject = objects[0];	    nss_ZFreeIf(objects);	}    }    return rvObject;}