Encryption of Data at rest [moved]
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.
We already support SSL connections
@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.
@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?
Reopened. Guys, this is quite easy to support but we'd need a few days. Any chance to receive a sponsorship to develop it?
Thanks @lvca. Would love to offer sponsorship if we could but sadly there's no capacity in our project budget :(
@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 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.
Where do we read/store the key?
@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?
We already have config/cert folder, what best place?
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 ?
You could also raise OSecurityException.
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.
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?
Spelling: "simmetric" should be "symmetric"
@compensator you're right, I copied the original piece of code with no paying attention to the names.
Hi guys, I'm merging this PR today.
After reviewing it, keys are global, so if you have 2 database you can't have different keys. This should be per-db/storage.
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");
But if not specified, global setting is taken. There are no 2 different settings for DES and AES, but just STORAGE_COMPRESSION_OPTIONS.