I'm writing a project to securely store and share passwords between users, I've been doing tons of research into encryption algorithms, CSPRNGs, hashing algorithms, key stretching etc...
I just want to layout my thinking as to how to use all of these, to create the secure application - and hopefully someone(s) can point our flaws or direct me if I'm seeing things wrong:
So, first of all, I need to store hashes of account passwords (these are the account that log into the application to view the shared passwords).
After reading around, my understanding is that to make a hash "more secure", you need to use scrypt or bcrypt or pbkdv2. I've found an implementation of these in "CryptSharp" (hopefully this is a secure implementation) - also after further research (http://www.tarsnap.com/scrypt/scrypt.pdf) it looks like scrypt is a more secure way of creating a hash.
As the data will be shared between users, I shall need to make sure that the system uses a master encryption key for the entire project, and that this is stored securely.
My thinking here is generate an encryption key and initialization vector (3 of them - I'll explain why) - these will be generated with RNGCryptoServiceProvider, and all 3 will be concatenated into Key1|IV1|Key2|IV2|Key3|IV3 so that they can be split and used with the encryption algorithms.
I need some way of storing this concatenated string of IVs and Keys so after some research I came across Microsoft's Data Protection API (ProtectedMemory.Protect( secret, MemoryProtectionScope.SameLogon )) - my understanding with this, is that the App Pool will need to run under a user account, and "load profile" set to true. The resulting encrypted string will then be stored in an XML setting file.
With regards to encrypting the passwords to be shared, I read about cascading encryption (used in TrueCrypt). The encryption algorithms TrueCrypt uses are AES, TwoFish, and Serpent. I've found an implementation of these (http://www.bouncycastle.org/csharp/ - which again, I hope is a secure implementation). This is where the 3 IVs and Keys will be used; so effectively the data will be encrypted like so: Serpent(TwoFish(AES(data,key1),key2),key3).
So, these are my ideas to create a secure data storage system; am I over looking something? have I misunderstood something? should I be doing something more?
I appreciate any advice on this.