if (!haveMatch && ((unsigned char *)key->data)[0] == 0) {  SHA1_HashBuf( hashKey, key->data + 1, key->size - 1); haveMatch = SECITEM_ItemsAreEqual(keyData->id,&result); }
pk11_key_collect(DBT *key, DBT *data, void *arg){    pk11KeyData *keyData;    NSSLOWKEYPrivateKey *privKey = NULL;    SECItem tmpDBKey;    PK11Slot *slot;        keyData = (pk11KeyData *)arg;    slot = keyData->slot;    tmpDBKey.data = key->data;    tmpDBKey.len = key->size;    PORT_Assert(slot->keyDB);    if (!keyData->strict && keyData->id) {	SECItem result;	PRBool haveMatch;	unsigned char hashKey[SHA1_LENGTH];	result.data = hashKey;	result.len = sizeof(hashKey);	if (keyData->id->len == 0) {	    haveMatch = PR_TRUE; /* taking any key */	} else {	    SHA1_HashBuf( hashKey, key->data, key->size ); /* match id */	    haveMatch = SECITEM_ItemsAreEqual(keyData->id,&result);	}	if (haveMatch) {	    if (keyData->classFlags & NSC_PRIVATE)  {		pk11_addHandle(keyData->searchHandles,			pk11_mkHandle(slot,&tmpDBKey,PK11_TOKEN_TYPE_PRIV));	    }	    if (keyData->classFlags & NSC_PUBLIC) {		pk11_addHandle(keyData->searchHandles,			pk11_mkHandle(slot,&tmpDBKey,PK11_TOKEN_TYPE_PUB));	    }	    /* NSC_KEY Already handled */	}	return SECSuccess;    }    privKey = nsslowkey_FindKeyByPublicKey(keyData->slot->keyDB, &tmpDBKey, 						 keyData->slot->password);    if ( privKey == NULL ) {	goto loser;    }    if (isSecretKey(privKey)) {	if ((keyData->classFlags & NSC_KEY) && 		pk11_tokenMatch(keyData->slot, &tmpDBKey, PK11_TOKEN_TYPE_KEY,			keyData->template, keyData->templ_count)) {	    pk11_addHandle(keyData->searchHandles,		pk11_mkHandle(keyData->slot, &tmpDBKey, PK11_TOKEN_TYPE_KEY));	}    } else {	if ((keyData->classFlags & NSC_PRIVATE) && 		pk11_tokenMatch(keyData->slot, &tmpDBKey, PK11_TOKEN_TYPE_PRIV,			keyData->template, keyData->templ_count)) {	    pk11_addHandle(keyData->searchHandles,		pk11_mkHandle(keyData->slot,&tmpDBKey,PK11_TOKEN_TYPE_PRIV));	}	if ((keyData->classFlags & NSC_PUBLIC) && 		pk11_tokenMatch(keyData->slot, &tmpDBKey, PK11_TOKEN_TYPE_PUB,			keyData->template, keyData->templ_count)) {	    pk11_addHandle(keyData->searchHandles,		pk11_mkHandle(keyData->slot, &tmpDBKey,PK11_TOKEN_TYPE_PUB));	}    }loser:    if ( privKey ) {	nsslowkey_DestroyPrivateKey(privKey);    }    return(SECSuccess);}