certBag->tokenCAs = p12dcx->tokenCAs;
sec_pkcs12_decoder_create_cert(SEC_PKCS12DecoderContext *p12dcx,			       SECItem *derCert){    sec_PKCS12SafeBag *certBag;    SECOidData *oid;    SGNDigestInfo *digest;    SECItem *keyId;    SECStatus rv;    if(!p12dcx || p12dcx->error || !derCert) {	return NULL;    }    keyId = (SECItem *)PORT_ArenaZAlloc(p12dcx->arena, sizeof(SECItem));    if(!keyId) {	PORT_SetError(SEC_ERROR_NO_MEMORY);	return NULL;    }    digest = sec_pkcs12_compute_thumbprint(derCert);    if(!digest) {	return NULL;    }    rv = SECITEM_CopyItem(p12dcx->arena, keyId, &digest->digest);    SGN_DestroyDigestInfo(digest);    if(rv != SECSuccess) {	PORT_SetError(SEC_ERROR_NO_MEMORY);	return NULL;    }    oid = SECOID_FindOIDByTag(SEC_OID_PKCS12_V1_CERT_BAG_ID);    certBag = (sec_PKCS12SafeBag *)PORT_ArenaZAlloc(p12dcx->arena, 						    sizeof(sec_PKCS12SafeBag));    if(!certBag || !oid || (SECITEM_CopyItem(p12dcx->arena, 			&certBag->safeBagType, &oid->oid) != SECSuccess)) {	PORT_SetError(SEC_ERROR_NO_MEMORY);	return NULL;    }    certBag->slot = p12dcx->slot;    certBag->pwitem = p12dcx->pwitem;    certBag->swapUnicodeBytes = p12dcx->swapUnicodeBytes;    certBag->arena = p12dcx->arena;    oid = SECOID_FindOIDByTag(SEC_OID_PKCS9_X509_CERT);    certBag->safeBagContent.certBag =         (sec_PKCS12CertBag *)PORT_ArenaZAlloc(p12dcx->arena, 					      sizeof(sec_PKCS12CertBag));    if(!certBag->safeBagContent.certBag || !oid ||			(SECITEM_CopyItem(p12dcx->arena, 				 &certBag->safeBagContent.certBag->bagID,				 &oid->oid) != SECSuccess)) {	PORT_SetError(SEC_ERROR_NO_MEMORY);	return NULL;    }          if(SECITEM_CopyItem(p12dcx->arena, 			 &(certBag->safeBagContent.certBag->value.x509Cert),			 derCert) != SECSuccess) {	PORT_SetError(SEC_ERROR_NO_MEMORY);	return NULL;    }    if(sec_pkcs12_decoder_set_attribute_value(certBag, SEC_OID_PKCS9_LOCAL_KEY_ID,					keyId) != SECSuccess) {	return NULL;    }    return certBag;}