Foren

Encrypting documents in Document & Media Library

Karim BOUAMI, geändert vor 10 Jahren.

Encrypting documents in Document & Media Library

New Member Beiträge: 2 Beitrittsdatum: 12.04.13 Neueste Beiträge
Hi,
I would like to encrypt the documents uploaded in Document & Media Library before storing it on a another server than the one LifeRay is in.
So how can I do that? I know how to change the storage location for the documents but for the encryption part, I'm not too sure how to do it exactly.
Please Help me!
Thanks in advance!
thumbnail
Jeffrey Handa, geändert vor 10 Jahren.

RE: Encrypting documents in Document & Media Library

Liferay Master Beiträge: 541 Beitrittsdatum: 01.12.08 Neueste Beiträge
Hi Karim,

You want Liferay to handle the encryption, and not just put the document on a drive that is encrypted? If that's the case I think I'd look at implementing a custom document store that extends com.liferay.portlet.documentlibrary.store.BaseStore. You can tell Liferay to use your custom store by setting the dl.store.impl property in your portal-ext.properties file. Take a look at the existing document stores to get an idea of how they work.

Regards,
Jeff
Karim BOUAMI, geändert vor 10 Jahren.

RE: Encrypting documents in Document & Media Library

New Member Beiträge: 2 Beitrittsdatum: 12.04.13 Neueste Beiträge
Hi Jeff,

First, thank you for your answer!
As for your answer, it's exactly as you said, I want LifeRay to handle the encryption. However Isn't there an easier way to do it than creating a document store (which seems as a hard feat)? I was thinking about using a class that would encrypt the document and on the other way decrypt the file when a user wants to download the document, the rest of the mecanisms would stay the same. Is it possible to do so? If it is possible, how can I manage to that?
Thanks in advance for the answers!
thumbnail
Jeffrey Handa, geändert vor 10 Jahren.

RE: Encrypting documents in Document & Media Library

Liferay Master Beiträge: 541 Beitrittsdatum: 01.12.08 Neueste Beiträge
Hi Karim,

I agree writing a new document store from scratch would be quite daunting, but if you extend Liferay's Advanced File System document store I think you would only have to modify/add a small amount of code. Since the original code is in portal-impl you might need to create your class in an EXT Plugin.

Another approach that you might consider would be to override the appropriate services in Liferay using a Service Wrapper Hook. The Document Library (DL) services are a little more complicated than other services so I recommend doing a little research before you start overriding services. If you have access to a copy of Liferay in Action, I'd recommend you take a look at Appendix E which has a very good summary of the Liferay 6.1 Documents API.

One other item to consider is if you want the contents of the uploaded files to be indexed and searchable through Liferay. As part of the upload process Liferay will attempt to index the contents of the file so if you didn't want them indexed for some reason that might have an impact on where you put your code.
thumbnail
Abhed Dekavadiya, geändert vor 10 Jahren.

RE: Encrypting documents in Document & Media Library

Junior Member Beiträge: 74 Beitrittsdatum: 05.10.10 Neueste Beiträge
Hello Jeffery,

I have a scenario where I am using Amazon S3 for document storage and I need to send an additional parameter to encrypt documents at S3 server side. For the same, there is no portal property or any overloaded method. So I will have to change the addFile() method of S3Store.java to add an additional line

s3Object.setServerSideEncryptionAlgorithm(S3Object.SERVER_SIDE_ENCRYPTION__AES256);


Now, considering this scenario and the service structure of document library, I see that only EXT plugin is the way to go ahead.
Do you see if I could still achieve this through Service Wrapper Hook ?

Thanks in advance!

regards,
Abhed Dekavadiya