Removing document encryption

Here's the method to remove the encription from a NotesDocument object through LotusScript (details at the end of the message).

1- The user needs the encryption key to decrypt the document in the first time.

2- Modify the document (any field)

3- Save the doc

4- Remove all the $Seal items from the document

5- Save the document

Here's the function I used:

Function RemoveSeal(doc As NotesDocument)
doc.tmp_x = "1" 'Modify the doc
Call doc.Save(True,False) 'Save without encryption

While doc.HasItem("$Seal") 'Remove all the $Seal
Call doc.RemoveItem("$Seal")

Call doc.save(True,False)
End Function

Details of the solution:

1- A NotesDocument allways has to be encrypted (call doc.Encrypt) before saved to keep the document encrypted. If not, the document is saved with all its items decrypted.

2- A $Seal item is added to a NotesDocument each time the doc.Encrypt is called. The $Seal items are removed when the document is saved through the UI Document (Form). A document can then have many $Seal items.

3- Since the $Seal items IsEncrypted property = True, all the $Seal items are encrypted when you call the doc.Encrypt. And an other $Seal is added aferwards.

4- Since you need all the encryption keys for the $Seal items to open or save a document, you need to remove them all to get rid of the encryption. and since many of them are encrypted, you need to save the doc without encryption to see them all (and remove them).

5- You can then save the document without any encryption or add a new Encryption key if needed using the commands :
doc.EncryptionKeys = "MyKey"
call doc.Encrypt
call doc.Save()

N.B. Since I found almost NO DOCUMENTATION on any of this, I had to come up with my personal deductions and tests. So, if you have more accurate information on all of this, I would be glad to hear from you. Email me at dufort@email.com or email the editor@searchDomino.com and searchDomino will post your feedback here.

This was first published in August 2001

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.