It has been a year since I had a chance to talk about Practical JOSE in Apache CXF at Apache Con NA 2015.
We have significantly improved CXF JOSE implementation since then, with Colm helping a lot with the code, tests, documentation. The code has become more thoroughly tested, the configuration – better, with the documentation being updated recently.
Production quality CXF STS service can now issue JOSE-protected JWT assertions and Fediz OpenId Connect project directly depends on JOSE in order to secure OIDC IdTokens.
But it is important to realize that doing JOSE does not mean you need to do OAuth2 in general or OpenId Connect in particular, though it is definitely true that understanding JOSE will help when you decide to work with OAuth2/OIDC.
As such, a web service developer can experiment with JOSE in a number of ways.
For example, have your service receiving a confidential String over 2-way HTTPS, then JWE-encrypt and save it to the database to ensure the data is safe or JWS-sign only and forward further, being assured the data won’t be modified, and choose between JWS Compact or JSON representations.
Have you already heard JOSE sequences have the data Base64 URL encoded ? Try JWS JSON with an unencoded payload option.
Another approach is let CXF do JOSE for you. Use CXF JOSE filters and make service data secured by typing few lines of text in the configuration properties.
These filters will do the best effort at streaming the outbound data while preparing JOSE sequences.
Would you like to link client JWT assertions obtained with the progressive services such as CXF STS to the data being protected ? Add a couple of filters.
I honestly think that JOSE is the best technology which can help many of us understand better what cryptography is.
Start with selecting a signature algorithm. You most likely have a Java JKS key store somewhere around, so go for ‘RS256’. Get the private key out and sign, then get a public key and validate as shown here.
Next try to encrypt, select RSA-OEPA to make it real fast given that you have this JKS store. Use a public key to secure a content encryption key generated by CXF for you and then do A128GCM content encryption. Finish with decrypting the content with a private key.
Works ? Interested in trying different key sizes or combinations of JOSE algorithms ? No problems, try them fast. Learn more about these algorithms next. See how it all works when the CXF JOSE filters do the work.
We’ve thought a lot on how to help developers start experimenting with JOSE as fast and easy as possible and I hope those of you who will start working with CXF JOSE code will help us make it even better.
Would like to use some other quality JOSE libraries such as these ones ? No problems, use them inside your custom JAX-RS filters or directly in the service code.
You may say, I’m not really seeing others use JOSE in regular HTTP services work. Let me finish with this advice: please do not worry about it, be a pioneer, experiment and find new interesting ways to secure your services and prepare them to work in the world of JOSE-protected tokens and data flowing everywhere.
Do JOSE today, convince your boss your team needs it :-), become a cryptography expert. Enjoy !
More about Sergey Beryozkin: a committer of Apache CXF and Apache Aries.
Sergey has focused on working with web services and XML technologies for over twenty years. He is currently the leader of the Apache CXF JAX-RS and OAuth2 implementation projects. As a software architect in the Application Integration Division of Talend, he focuses on Talend Service Factory and works with Talend colleagues on creating better support for REST.