jspriggs
jspriggs

Reputation: 403

Creating a Java API Graph connection with encrypted OrientDB 2.2 database

I'm starting to do some work with the Orient 2.2 Beta release that is out to prep our project to utilize the new encryption functionality being included (http://orientdb.com/docs/last/Database-Encryption.html). I've seen the documents on how to create the connection to the database as a standard connection object, but I'm not seeing any way to pass the encryption key for connecting and using the OrientGraph/Factory java objects. Does anyone have any insight on how this works or if there's a way to set global config options with the OrientGraph/Factory java objects?

Upvotes: 1

Views: 206

Answers (1)

raj5045
raj5045

Reputation: 31

You can connect to an encrypted database in the following way:- Set the database encryption information in the OGlobalConfiguration.

OGlobalConfiguration.STORAGE_ENCRYPTION_KEY.setValue("your_encryption_key");
OGlobalConfiguration.STORAGE_ENCRYPTION_METHOD.setValue("aes/des");

We can now get the access to the encrypted database using graph APIs.

OrientGraphFactory ogf = new OrientGraphFactory(url, username, password);
OrientTransactionalGraph og = ogf.getTx();

If you are using java 6, you also need to set the following property:-

OGlobalConfiguration.SECURITY_USER_PASSWORD_DEFAULT_ALGORITHM.setValue("PBKDF2WithHmacSHA1");

The default value for this property is 'PBKDF2WithHmacSHA256' which is available since java 7.

Upvotes: 1

Related Questions