You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucenenet.apache.org by Srini V <vg...@gmail.com> on 2017/05/08 16:09:51 UTC

Encrypting Index files

Team,  Did we thought of encrypting index files for security.

Thanks
Sri

RE: Encrypting Index files

Posted by Shad Storhaug <sh...@shadstorhaug.com>.
Sri,

As Lucene.Net is a port of Lucene the plan is not to add any additional features that don't exist in Java Lucene (other than perhaps features that might make usage with .NET easier). 

Search functionality is expected to be fast and encryption would certainly slow it down. In general, I would say this isn't a good candidate for a feature. That said, you should be discussing new features with the Lucene (Java) team, not here.

------------------------------------------------------------------------------------

Lucene.Net does have extensibility that can accommodate encryption though - you can create your own codec to store data in any format you want. You can supply your own codec by creating a custom codec factory that subclasses DefaultCodecFactory and setting it by using the following line at application startup:

Codec.SetCodecFactory(new MyCodecFactory());

You need to subclass the Codec class to provide your codec implementation. You can either use convention-based naming or override the name with the [CodecName("My")] attribute. To use convention-based naming, the codec class name should end with a "Codec" suffix. The name that will be used within Lucene.Net and stored inside of your index will be the class name excluding the suffix. For example, if your codec class is named MyCodec, the name used for Lucene.Net will by "My" unless it is overridden with the [CodecName] attribute.

In your custom codec factory's constructor (MyCodecFactory), you should then call either PutCodecType(Type) or ScanForCodecs(Assembly) to make Lucene.Net recognize your custom codec type. You can optionally provide the codec via dependency injection by overriding GetCodec(Type) (codecs should all be singleton instances), which allows you to create codecs with injected constructor arguments.

There are 2 additional extension points for DocValuesFormat and PostingsFormat that each have their own factory that you would use similarly to supplying a custom codec, though I am not sure whether they would be required since you can just return them from your custom Codec type. You really only need to use this if you plan on using these formats in more than one codec.

You can also override existing codecs by using the same names as the ones in Lucene.Net, so you could in theory apply encryption to existing codecs by subclassing them, tweaking their implementation, and using the [CodecName] attribute with the same name.

See the Java API documentation for more information about how you might write your own codec format: https://lucene.apache.org/core/4_8_0/core/org/apache/lucene/codecs/package-summary.html

Thanks,
Shad Storhaug (NightOwl888)



-----Original Message-----
From: Srini V [mailto:vgeneral7@gmail.com] 
Sent: Monday, May 8, 2017 11:10 PM
To: dev@lucenenet.apache.org
Subject: Encrypting Index files

Team,  Did we thought of encrypting index files for security.

Thanks
Sri

Re: Encrypting Index files

Posted by "Oren Eini (Ayende Rahien)" <ay...@ayende.com>.
We are doing that in RavenDB.
This is pretty complex, because you need to make sure that the on disk data
is encrypted but seekable.
Note that for in memory data, you can't encrypt anything.

*Hibernating Rhinos Ltd  *

Oren Eini* l CEO l *Mobile: + 972-52-548-6969

Office: +972-4-622-7811 *l *Fax: +972-153-4-622-7811



On Mon, May 8, 2017 at 7:09 PM, Srini V <vg...@gmail.com> wrote:

> Team,  Did we thought of encrypting index files for security.
>
> Thanks
> Sri
>