Code Snippet to Clear Encryption from Lotus Notes Documents (Data Notes)

Mindwatering Incorporated

Author: Tripp W Black

Created: 02/14/2013 at 12:14 PM

 

Category:
Notes Developer Tips
LotusScript

Issue:
You wish to clear encryption in an application to migrate it from an IBM Lotus Notes Client-based application to IBM Websphere, but need to decrypt the documents first so you can export the data notes to CSV files.
If the application is in use by only a small handful of people this can be done by each user clearing his/her encryption (or you with their IDs and passwords switching locations). If it has LOTS of people, this is going to be tedious.

Solution:
1. Create a custom view that shows only encrypted documents (that have the $Seal field(s) ). Make it categorized by the LastModBy field that computes w/@UserName upon each save. (We had such a field.)

2. For the new custom view, create a new view action button, "Remove Encryption" with the following pseudo code to loop through all selected encrypted / signed Lotus data notes and remove encryption:

Get current view ( uiV as NotesUIView)
Get doc collection (col as NotesDocumentCollection) of uiV.Documents
Loop through documents, Call the function below to remove the $Seal and re-save.

Function RemoveSeal(doc as NotesDocument) as Integer
' removes encryption from the current document for the current user

On Error Got FErrorHander

' make any modification
Call doc.ReplaceItemValue("DummyField", "IgnoreMe")
Call doc.Save(True, False)
' remove the old keys
While doc.HasItem("$Seal")
' remove seal field(s) - there may be more than one
Call doc.RemoveItem("$Seal")
Wend
' remove the temp field
While doc.HasItem("DummyField")
' remove seal field(s) - there may be more than one
Call doc.RemoveItem("DummyField")
Wend
' save again
Call doc.Save(True, False)
' return success
RemoveSeal = 1

FExit:
Exit Function

FErrorHandler:
"Error: " & Error$ & " (" & Cstr(Err) & "), line: " & Cstr(Erl) & "."
Resume FExit
End Function


3. Embed the new custom view into a new page. Set the view to only display/show the category for the current user (@UserName).

4. Send the users an e-mail. The e-mail should contain:
a. Link to the new Page.
b. Instructions to select all (CNTL+A) all the documents in the view (which is actually all in their category - they last modified) and to click the "Remove Encryption" button.

Note: Any errors will be printed to their status bar.





previous page