return SECFailure; }  if(key->removeExisting) { key->problem = PR_TRUE; key->error = SEC_ERROR_PKCS12_UNABLE_TO_IMPORT_KEY;
sec_pkcs12_add_key(sec_PKCS12SafeBag *key, SECItem *publicValue, 			KeyType keyType, unsigned int keyUsage, void *wincx){    SECStatus rv;    SECItem *nickName;    if(!key) {	return SECFailure;    }    if(key->removeExisting) {	key->problem = PR_TRUE;	key->error = SEC_ERROR_PKCS12_UNABLE_TO_IMPORT_KEY;	return SECFailure;    }    if(key->problem || key->noInstall) {	return SECSuccess;    }    nickName = sec_pkcs12_get_nickname(key);    switch(SECOID_FindOIDTag(&key->safeBagType))    {	case SEC_OID_PKCS12_V1_KEY_BAG_ID:	    rv = PK11_ImportPrivateKeyInfo(key->slot, 			  key->safeBagContent.pkcs8KeyBag, 			  nickName, publicValue, PR_TRUE, PR_TRUE,			  keyUsage,  wincx);	    break;	case SEC_OID_PKCS12_V1_PKCS8_SHROUDED_KEY_BAG_ID:	    rv = PK11_ImportEncryptedPrivateKeyInfo(key->slot,					key->safeBagContent.pkcs8ShroudedKeyBag,					key->pwitem, nickName, publicValue, 					PR_TRUE, PR_TRUE, keyType, keyUsage,					wincx);	    break;	default:	    key->error = SEC_ERROR_PKCS12_UNSUPPORTED_VERSION;	    key->problem = PR_TRUE;	    if(nickName) {		SECITEM_ZfreeItem(nickName, PR_TRUE);	    }	    return SECFailure;    }    key->installed = PR_TRUE;    if(nickName) {	SECITEM_ZfreeItem(nickName, PR_TRUE);    }					    if(rv != SECSuccess) {	key->error = SEC_ERROR_PKCS12_UNABLE_TO_IMPORT_KEY;	key->problem = PR_TRUE;    } else {	key->installed = PR_TRUE;    }    return rv;}