I am trying to build a blockchain on ethereum but keeping the data related to blocks in some distributed file storage system like IPFS or Storj and storing the hash of data in blocks. But we need our data to be private / shared, so to achieve that we are thinking of using some Key Management Service like NuCypher KMS. But we will have smart contracts on ethereum which can access the data and perform some operations. My question is, is this the correct approach or is this even possible?
Your smart contract can not access the data due to the following issues:
1) The data is outside the blockchain and contracts can't access anything outside the blockchain
2) Even if your contracts could access the data, the data would be encrypted (per your specification). If the contract can decrypt the data, it means anyone can decrypt the data as the cipher key is then available in the transactions / inside the contract.
There are some ideas about public key cryptography and so on to store private data within the blockchain but even if they work, the usage costs (gas costs) would be quite substantial. There are several posts about it on this forum, for example: How to cryptographically challenge a public/private address key pair? . Some more general discussion can be found at Storing private data on the ethereum blockchain
There is ongoing research into this field (privacy within Ethereum), namely zk-Snarks. Here's some info: https://blog.ethereum.org/2016/01/15/privacy-on-the-blockchain/