views:

1360

answers:

11

My company is going to be storing sensitive data for our customers, and will be encrypting data using one of the managed .NET encryption algorithm classes. Most of the work is done, but we haven't figured out how/where to store the key. I've done some light searching and reading, and it seems like a hardware solution might be the most secure. Does anyone have any recommendations on a key storage solution or method?

A: 

Microsoft Rights Management Server (RMS) has a similar problem. It just solves it by encrypting its configuration with a master password. ...A password on a password, if you will.

spoulson
A: 

But then you still have to encrypt/store/control/whatever the master password somewhere/somehow, which in my case doesn't really solve anything.

Daniel Schaffer
Right - check my answer, regarding DPAPI. This solves the whole key management/storage issue.
AviD
A: 

Your best bet is to physically secure the hardware the key is on. Also, don't ever write it to disk - find some way to prevent that section of memory from being paged to disk. When encrypting/decrypting the key needs to be loaded into memory, and with unsecure hardware there's always this venue of attack.

There are, like you said, hardware encryption devices but they don't scale - all encryption/decryption passes through the chip.

Kyle Cronin
The SecureString class in .Net solves the paged-to-disk problem.
Joel Coehoorn
A: 

You can encrypt the symmetric key using another symmetric key that is derived from a password using something like PBKDF2.

Have the user present a password, generate a new key used to encrypt the data, generate another key using the password, then encrypt and store the data encryption key.

It isn't as secure as using a hardware token, but it might still be good enough and is pretty easy to use.

sock
A: 

I think I misunderstood your question. What you're asking for is not in scope of how the application handles its key storage, but rather how your company will store it.

In that case, you have two obvious choices:

  • Physical: Write to USB drive, burn to CD, etc. Store in physically secure location. But you run into the recursive problem: where do you store the key to the vault? Typically, you delegate 2 or more people (or a team) to hold the keys.

  • Software: Cyber-Ark Private Ark is what my company uses to store its secret digital information. We store all our admin passwords, license keys, private keys, etc. It works by running a Windows "vault" server that is not joined to a domain, firewalls all ports except its own, and stores all its data encrypted on disk. Users access through a web interface that first authenticates the user, then securely communicates with the vault server via explorer-like interface. All changes and versions are logged. But, this also has the same recursive problem... a master admin access CD. This is stored in our physical vault with limited access.

spoulson
A: 

Thanks for your replies, everyone.

spoulson, the issue is actually both the "scopes" that you mentioned. I suppose I should have been clearer.

The data itself, as well as the logic that encrypts it and decrypts it is abstracted away into an ASP.NET profile provider. This profile provider allows both encrypted profile properties as well as plain text ones. The encrypted property values are stored in exactly the same way the plain text ones are - with the obvious exception that they've been encrypted.

That said, the key will need to be able to be summoned for one of three reasons:

  1. The authorized web application, running on an authorized server, needs to encrypt data.
  2. Same as #1, but for decrypting the data.
  3. Authorized members of our business team need to view the encrypted data.

The way I'm imagining it is that nobody would ever actually know the key - there would be a piece of software controlling the actual encrypting and decrypting of data. That said, the key still needs to come from somewhere.

Full disclosure - if you couldn't already tell, I've never done anything like this before, so if I'm completely off base in my perception of how this should work, by all means, let me know.

Daniel Schaffer
A: 

Use a hard-coded key to encrypt the generated key before writing it out. Then you can write it anywhere.

Yes you can find the hard-coded key, but so long as you're assuming it's OK to store a symmetric key anywhere, it's not less secure.

Jason Cohen
A: 

Depending on your application you could use the Diffie-Hellman method for two parties to securely agree on a symmetric key.

After an initial, secure exchange, the key is agreed upon and the rest of the session (or a new session) can use this new symmetric key.

Jason Cohen
+5  A: 

There only two real solutions for (the technical aspect of) this problem. Assuming it's only the application itself that needs access the key...

  1. Hardware Security Module (HSM) - usually pretty expensive, and not simple to implement. Can be dedicated appliance (e.g. nCipher) or specific token (e.g. Alladin eToken). And then you still have to define how to handle that hardware...

  2. DPAPI (Windows Data Protection API). There are classes for this in System.Security.Cryptography (ProtectedMemory, ProtectedStorage, etc). This hands off key management to the OS - and it handles it well. Used in "USER_MODE", DPAPI will lock decryption of the key to the single user that encrypted it. (Without getting too detailed, the user's password is part of the encryption/decryption scheme - and no, changing the password does not foul it up.)

ADDED: Best to use DPAPI for protecting your master key, and not encrypting your application's data directly. And don't forget to set strong ACLs on your encrypted key...

AviD
+1  A: 

In response to #3 of this answer from the OP

One way for authorized members to be able to view the encrypted data, but without them actually knowing the key would be to use key escrow (rsa labs) (wikipedia)

In summary the key is broken up into seperate parts and given to 'trustees'. Due to the nature of private keys each segment is useless to by its self. Yet if data is needed to be decrypted then the 'trustees' can assemble thier segments into the whole key.

roo
A: 

We have the same problem, and have been through the same process.
We need to have a process start up on one computer (client) which then logs in to a second computer (database server).

We currently believe that the best practice would be:

  • Operator manually starts the process on client PC.
  • Client PC prompts operator for his personal login credentials.
  • Operator enters his credentials.
  • Client PC uses these to login to the database server.
  • Client PC requests its own login credentials from database server.
  • Database server checks that operator's login credentials are authorised to get the client process' credentials and returns them to the client PC.
  • Client PC logs out of datbase server.
  • Client PC logs back into database server using its own credentials.

Effectively, the operator's login password is the key, but it isn't stored anywhere.

AJ