简体   繁体   English

使用加密的OrientDB 2.2数据库创建Java API Graph连接

[英]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 ). 我将开始使用Orient 2.2 Beta版本进行一些工作,该版本旨在为我们的项目做准备,以利用其中包含的新加密功能( 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. 我已经看过有关如何将数据库创建为标准连接对象的文档,但是我没有看到任何传递加密密钥以连接和使用OrientGraph / Factory Java对象的方法。 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? 是否有人对它的工作方式有任何见识,或者是否有办法使用OrientGraph / Factory Java对象设置全局配置选项?

You can connect to an encrypted database in the following way:- Set the database encryption information in the OGlobalConfiguration. 您可以通过以下方式连接到加密的数据库:-在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. 现在,我们可以使用图形API来访问加密的数据库。

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:- 如果您使用的是Java 6,则还需要设置以下属性:

OGlobalConfiguration.SECURITY_USER_PASSWORD_DEFAULT_ALGORITHM.setValue("PBKDF2WithHmacSHA1");

The default value for this property is 'PBKDF2WithHmacSHA256' which is available since java 7. 此属性的默认值为'PBKDF2WithHmacSHA256',自Java 7起可用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM