mapdb icon indicating copy to clipboard operation
mapdb copied to clipboard

Encryption API

Open ruckc opened this issue 10 years ago • 4 comments

I'd like to use MapDB for a project, but we need proven encryption methods. Can you add support for encryption plugins? Something that we can just pass an EncryptionStrategy implementation or something similiar in for? This would be a great way to support future encryption based on JCA. I'd even donate an AES implementation based on JCA.

ruckc avatar Oct 09 '15 01:10 ruckc

MapDB had support for JCA & AES256 a few years ago (JDBM3). There was complete rewrite and it was not ported yet. I have plan to add into MapDB 2.1 release in a few months.

It will work at two levels:

  • Block encryption over entire storage at Volume level. This is slower but does not leak any information.
  • serializer wrapper. This encrypts only part of records such as Map values or keys. It leaks some information such as record size, hash order and comparation. It is faster.

If you need it urgently there are two options:

You could pay me and get it in a few days, it is about 4 hours work and I have reasonable prices.

Or you could write it yourself and send me a patch. MapDB source code is not that bad and I would do final polishing.

Relevant code for AES 256 from JDBM 3 is here: https://github.com/jankotek/JDBM3/blob/master/src/main/java/org/apache/jdbm/DBMaker.java#L298

Block layer is here: https://github.com/jankotek/mapdb/blob/master/src/main/java/org/mapdb/Volume.java#L1044

Serializer wrapper which does inflate compression is here. We need similar binary transformation, but for encryption. https://github.com/jankotek/mapdb/blob/master/src/main/java/org/mapdb/Serializer.java#L1912

jankotek avatar Oct 09 '15 11:10 jankotek

Moving to 3.0

jankotek avatar Feb 13 '16 17:02 jankotek

I can't seem to find any encryption support in v 3.0.3, has it been added? If not when are you planning to support encryption? I'll use v 1.0.6 for now as it seems popular (from maven stats) and supports encryption.

webstorms avatar Mar 28 '17 19:03 webstorms

Is encryption not supported in 4.0?

If not then can you please update the Serializer and Block links for reference.

abbasshah17 avatar May 08 '19 07:05 abbasshah17