orientdb icon indicating copy to clipboard operation
orientdb copied to clipboard

Encryption of Data at rest [moved]

Open lvca opened this issue 13 years ago • 58 comments

I would like to use OrientDB for a healthcare application in the U.S. One of the requirements is that the data be encrypted at rest. This could probably be done through writing drivers for a particular OS. We are currently using MySQL and have a third party driver to accomplish encryption at rest. It would be great if OrientDB had a built in capability to do this.

lvca avatar Dec 10 '12 14:12 lvca

We already support SSL connections

lvca avatar Oct 02 '14 17:10 lvca

@lvca this should probably be re-opened. This is not about encryption-on-the-wire (SSL), but rather storage encryption for data at rest. (e.g., on disk, or perhaps even in memory). See the mongodb docs @ http://docs.mongodb.org/manual/core/security-introduction/ - "To encrypt document or field level data, write custom encryption and decryption routines or use a commercial solutions such as the Vormetric Data Security Platform." I think that's more or less what this particular ticket is after.

mandrachek avatar Feb 19 '15 01:02 mandrachek

@lvca I agree with @mandrachek - this issue should probably be reopened.

We're using Baasbox (http://www.baasbox.com/), which incorporates OrientDB, on a project. The ISMS requirements from our client stipulate that data are encrypted at rest.

This is different from either encryption on the wire (SSL) or filesystem encryption. See http://www.teamshatter.com/topics/general/team-shatter-exclusive/encrypting-data-at-rest/ for some further reasons why it's important.

What do you think?

edwardkay avatar Mar 02 '15 14:03 edwardkay

Reopened. Guys, this is quite easy to support but we'd need a few days. Any chance to receive a sponsorship to develop it?

lvca avatar Mar 02 '15 15:03 lvca

Thanks @lvca. Would love to offer sponsorship if we could but sadly there's no capacity in our project budget :(

edwardkay avatar Mar 02 '15 15:03 edwardkay

@lvca we are interested in this and depending by the necessary effort, we could develop it, if you will give us the right advices. Please drop me an email....

giastfader avatar Mar 02 '15 16:03 giastfader

@giastfader it would be great: a new feature by BaasBox ;-) You can write an implementation of com.orientechnologies.orient.core.compression.OCompression interface and register into OCompressionFactory singleton. Example, you call your implementation as "encrypted". In order to activate it on a new cluster use:

ALTER CLUSTER MyCluster COMPRESSION encrypted

We store the database compression inside storage configuration, but we never exposed it on ALTER DATABASE command.

lvca avatar Mar 02 '15 17:03 lvca

Where do we read/store the key?

giastfader avatar Mar 02 '15 17:03 giastfader

@giastfader Thanks for your reply. As @lvca says, direct BaasBox contributions to OrientDB would be great and is very encouraging from our point of view.

As we're using BaasBox as a product, please could DB encryption be enabled/disabled via arguments passed to the start script or similar, i.e. not needing us to recompile the Play project.

Could you store the key in a Java keystore?

edwardkay avatar Mar 02 '15 17:03 edwardkay

We already have config/cert folder, what best place?

lvca avatar Mar 02 '15 17:03 lvca

Hi @lvca I'm working on this issue. Since there are a lot of different kind of Exceptions that can be thrown during the crypt/decrypt process what do the methods of OCompression* classes are supposed to do? I see that, for example, into the OZIPCompression.compress() method an IllegalStateException is raised if an IO operation goes wrong. Is it fine to raise always that exception ?

giastfader avatar Apr 20 '15 14:04 giastfader

You could also raise OSecurityException.

lvca avatar Apr 20 '15 14:04 lvca

Hey @giastfader I was merging this in develop, but unfortunately you didn't sign the clahub agreement (for the Apache2 license). Please could you do that? Thanks in advance.

lvca avatar Aug 06 '15 16:08 lvca

Waiting for you to electronic signing the CLA, I saw you use 2 new global settings:

STORAGE_ENCRYPTION_DES_KEY("encryption.des_key",
  "The simmetric key to use to encrypt/descript data at rest using the DES alghorithm, stored in BASE64. The key must be 64 bits long. Default is \"T1JJRU5UREI=\" (ORIENTDB).",String.class,"T1JJRU5UREI="),
STORAGE_ENCRYPTION_AES_KEY("encryption.aes_key",
  "The simmetric key to use to encrypt/descript data at rest using the AES alghorithm, stored in BASE64. The key must be 128 or 256 bits. Default is \"T1JJRU5UREJfSVNfQ09PTA==\" (ORIENTDB_IS_COOL).",String.class,"T1JJRU5UREJfSVNfQ09PTA=="),

I think it would be much better don't setting any password by default and check if password is null, an exception is raised. In this way the user can't do mistakes. WDYT?

lvca avatar Aug 09 '15 19:08 lvca

Spelling: "simmetric" should be "symmetric"

compensator avatar Aug 10 '15 13:08 compensator

@compensator you're right, I copied the original piece of code with no paying attention to the names.

lvca avatar Aug 11 '15 08:08 lvca

Hi guys, I'm merging this PR today.

lvca avatar Aug 11 '15 08:08 lvca

After reviewing it, keys are global, so if you have 2 database you can't have different keys. This should be per-db/storage.

lvca avatar Aug 11 '15 12:08 lvca

Ok, done. The password now can be passed as "STORAGE_COMPRESSION_OPTIONS" setting before creating the database.

    final ODatabase db = new ODatabaseDocumentTx("plocal:target/testCreatedAESEncryptedDatabase");
    db.setProperty(OGlobalConfiguration.STORAGE_COMPRESSION_OPTIONS.getKey(), "T1JJRU5UREJfSVNfQ09PTA==");
    db.create();
    db.command(new OCommandSQL("create class TestEncryption")).execute();
    db.command(new OCommandSQL("alter cluster TestEncryption compression aes-encrypted")).execute();

And the same for opening it:

    db.setProperty(OGlobalConfiguration.STORAGE_COMPRESSION_OPTIONS.getKey(), "T1JJRU5UREJfSVNfQ09PTA==");
    db.open("admin", "admin");

lvca avatar Aug 11 '15 16:08 lvca

But if not specified, global setting is taken. There are no 2 different settings for DES and AES, but just STORAGE_COMPRESSION_OPTIONS.

lvca avatar Aug 11 '15 16:08 lvca