Blog

Encryption in XPages: Remember to Set Xsp Properties

  |   Blog   |   No comment

Regardless of recent announcements, XPages is still my preferred option for standalone rapid application web development. Once an appropriate level of understanding of the lifecycle is gained, there’s a comfortable level of logic in how it works. With controller classes in Java and XPages that contain predominantly Expression Language and short SSJS calls to the controller classes, there is a level of separation that feels nice. I’ve also learned to abandon any obsession over creating my own wrappers, once I realised that everything is a Java wrapper object, whether it’s a dominoDocument or dominoView datasource, an Object Data Source, a bean, or a Java object stored in the controller class. And using the Java debugger to develop against a local Domino serve, using ODA and the XPages OpenLog Logger functionality typically allows me to solve problems quickly enough.

I’m also happy enough with Domino Designer to dismiss the alternative of moving elsewhere – experience a couple of years ago showed me that whatever mix of IDE, database, server, development framework etc etc, there will always be something to complain about (unless you build it all yourself, and then anyone who has to pick up what you’ve done will find something to complain about!).

And there are some areas where Domino does things in a way that are much easier than building it yourself. (I would encourage everyone to have a go at building some of that functionality they take for granted on occasion – it’s very instructive and reassuring.) With FP8 providing encryption in XPages, this is one such strength of Domino. The problem is the lack of a “install-and-run” example. The IBM Knowledge Center has some good documentation. But after trying to get it working, I was still not able to encrypt. Thankfully I was able to reach out and get the solution, and obviously I was going to blog it.

The key step is to enable encryption in the xsp.properties file. You need to set xsp.domino.document.encryption=true. Once you’ve done that, you just need to follow the other steps – set up ID Vault, enable encryption on a field, add the properties to the dominoDocument datasource and then save the datasource. There’s no need to call the Document.encrypt() method, just use a “Save Document” simple action or (my preferred option) call dominoDocument.save().

AUTHOR - Paul Withers

Paul Withers is an IBM Lifetime Champion, has been an OpenNTF Board Member since 2013, has worked with Domino since R4.5, XPages since 2009, co-authored XPages Extension Library and was technical editor for Mastering XPages 2nd Edition. He is one of the developers on OpenNTF Domino API as well as contributor to a variety of other OpenNTF projects. For full bio, see https://paulswithers.github.io/professional/

No Comments

Post A Comment