Search This Blog

Thursday, May 29, 2014

You can't have an empty item 'SecretEncryptionKeys' in NotesDocument if there is no encryption enabled field on form


Probably you know, that item "SecretEncryptionKeys" is used for keeping a list of secret keys which are used for document fields encryption. IBM Lotus Notes creates this item automatically if you enable encryption for any field and select secret key on the last tab of form properties window.

Recently I had to remove such encryption for one application that used it before.

I quickly wrote simple code to unencrypt existing documents, something like this:

Dim s As New NotesSession
Dim col As NotesDocumentCollection
Dim doc As notesdocument

Set col = s.Currentdatabase.Unprocesseddocuments
Set doc = col.Getfirstdocument()
While Not doc Is Nothing 
doc.Encryptionkeys = ""
Call doc.Save(True, false)
Set doc = col.Getnextdocument(doc)

It correctly unencrypted all documents.
Then I disabled encryption for from fields and deselected all secret keys on the last tab of form properties. Everything looked find but when I tried to save one unencrypted document in UI I had got a following error message: "No encryptable fields found in document.  Encryptable fields must be specified in form."

After short investigation I found a reason - you can't have an empty item 'SecretEncryptionKeys' in NotesDocument if there is no field on form with enabled encryption. After I completely removed this item from all NotesDocuments the error disappeared.

No comments:

Post a Comment