One embodiment of the present invention provides a system for managing
keys. During operation, the system receives a request from a user at a
database to encrypt/decrypt data at the database. In response to this
request, the system sends a user-token to the user, wherein the
user-token includes a user-key encrypted with a user-secret thereby
enabling the user to decrypt the user-key with the user-secret. Next, the
system receives the decrypted user-key from the user. The system then
uses the user-key to encrypt/decrypt the data at the database. Finally,
the system deletes the user-key at the database.