Edit
I am trying to develop a password managing tool for companies. My idea is that the passwords in some kind of database are encrypted with a master password which only the admin has.
Per department in a company there should be an own password, which lets the users of that department only access their passwords.
Lets look at an example.
- Department A
- Billing system, Password: "Hello"
- Department B
- Mail, Password: "World"
The passwords are encrypted with the master password of the admin. Lets just assume it is 0000. So in the database there would be something like this
- Department A
- Billing system, Password: encrypt("Hello",0000,'A')
- Department B
- Mail, Password: encrypt("World",0000,'B')
Furthermore, the password of department A would be 9999 and of department B 7777. Now I am searching for a possibility to decrypt the password of the billing system with the password 9999 and decrypt the mail password with 7777. But it should not be possible to decrypt the mail password with 9999 and vice versa.
- Billing system: decrypt(encrypt("Hello",0000,'A'), 9999) = "Hello"
- Billing system: decrypt(encrypt("Hello",0000,'A'), 7777) != "Hello"
- Mail: decrypt(encrypt("World",0000,'B'), 9999) != "World"
- Mail: decrypt(encrypt("World",0000,'B'), 7777) = "World"
Not that this it hard enough, the admin user must have the possibility to decrypt any password with his master password 0000
- Billing system: decrypt(encrypt("Hello",0000,'A'), 0000) = "Hello"
- Mail: decrypt(encrypt("World",0000,'B'), 0000) = "World"
I hope that my ideas are getting clearer now...