You need to sign in to do that
Don't have an account?

Encryption of Attachments
Has anyone done encryption of attachments using crypto class? What we want to do is encrypt attachments to all users and give only specific users to decrypt. Can someone share their code? I am new to this functionality and I would like to get some sample codes to get me started. Unfortunately, I can't find a whole lot of this use case here. And the sample codes provided here http://wiki.developerforce.com/page/Apex_Crypto_Class doesn't help me much either.
Any info is appreciated.
Thanks,
John
I've done encryption in general, and here's how I might go about it using the Crypto class:
1) Custom setting that stores a key.
2) Trigger that encrypts attachments on insert.
3. Create a controller that can decrypt an attachment (note, security check for authorization not included):
4. Create a page that can be used with the controller:
5. Create a VF page that lets users decrypt attachments by selecting one from a list (not included for brevity).
I use a Document that I'll store in the user's private document folder (My Documents), which is inaccessible to any other user. We can delete the attachment later after its been downloaded by the user to reclaim used space (I'd say probably an hour or so).
This is about 75% of what you need, the rest is just a page and some more logic.