if (trustFlags & CERTDB_VALID_CA) { return (PK11Attribute *)&pk11_StaticValidDelegatorAttr; }
pk11_FindTrustAttribute(PK11TokenObject *object, CK_ATTRIBUTE_TYPE type){    NSSLOWCERTCertificate *cert;    unsigned char hash[SHA1_LENGTH];    SECItem *item;    PK11Attribute *attr;    unsigned int trustFlags;    switch (type) {    case CKA_PRIVATE:	return (PK11Attribute *) &pk11_StaticFalseAttr;    case CKA_MODIFIABLE:	return (PK11Attribute *) &pk11_StaticTrueAttr;    case CKA_SENSITIVE:	return NULL;    default:	break;    }    cert = pk11_getCert(object);    if (cert == NULL) {	return NULL;    }    switch (type) {    case CKA_CERT_SHA1_HASH:	SHA1_HashBuf(hash,cert->derCert.data,cert->derCert.len);	return pk11_NewTokenAttribute(type,hash,SHA1_LENGTH, PR_TRUE);    case CKA_CERT_MD5_HASH:	MD5_HashBuf(hash,cert->derCert.data,cert->derCert.len);	return pk11_NewTokenAttribute(type,hash,MD5_LENGTH, PR_TRUE);    case CKA_ISSUER:	return pk11_NewTokenAttribute(type,cert->derIssuer.data,						cert->derIssuer.len, PR_FALSE);    case CKA_SERIAL_NUMBER:	item = SEC_ASN1EncodeItem(NULL,NULL,cert,pk11_SerialTemplate);	if (item == NULL) break;	attr = pk11_NewTokenAttribute(type, item->data, item->len, PR_TRUE);	SECITEM_FreeItem(item,PR_TRUE);	return attr;    case CKA_TRUST_CLIENT_AUTH:	trustFlags = cert->trust->sslFlags & CERTDB_TRUSTED_CLIENT_CA ?		cert->trust->sslFlags | CERTDB_TRUSTED_CA : 0 ;	goto trust;    case CKA_TRUST_SERVER_AUTH:	trustFlags = cert->trust->sslFlags;	goto trust;    case CKA_TRUST_EMAIL_PROTECTION:	trustFlags = cert->trust->emailFlags;	goto trust;    case CKA_TRUST_CODE_SIGNING:	trustFlags = cert->trust->objectSigningFlags;trust:	if (trustFlags & CERTDB_TRUSTED_CA ) {	    return (PK11Attribute *)&pk11_StaticTrustedDelegatorAttr;	}	if (trustFlags & CERTDB_TRUSTED) {	    return (PK11Attribute *)&pk11_StaticTrustedAttr;	}	if (trustFlags & CERTDB_NOT_TRUSTED) {	    return (PK11Attribute *)&pk11_StaticUnTrustedAttr;	}	if (trustFlags & CERTDB_TRUSTED_UNKNOWN) {	    return (PK11Attribute *)&pk11_StaticTrustUnknownAttr;	}	if (trustFlags & CERTDB_VALID_PEER) {	    return (PK11Attribute *)&pk11_StaticValidPeerAttr;	}	return (PK11Attribute *)&pk11_StaticMustVerifyAttr;    default:	break;    }    return NULL;}