Message body encryption
In the previous chapter, we saw how to encrypt a complete HTTP message using HTTPS. Now, we will explain how we can encrypt just the message body and the differences between each process. We start by constructing a simple example, and then, as we perform the respective tests of our implementation, we'll understand how it works.
In order not to spoil our previous project, we will build a new one. For this, we will execute the following commands in the terminal:
mvn archetype:generate -DgroupId=com.packtpub -DartifactId=encryption -DarchetypeArtifactId=webapp-javaee6 -DarchetypeGroupId=org.codehaus.mojo.archetypes
As seen earlier in this chapter, when you get asked for a version, change the default value of 1.0-SNAPSHOT
to 1.0
.
Of course, if you want, you can download all the source code from GitHub from the following URL:
https://github.com/restful-java-web-services-security/source-code/tree/master/chapter05/encryption
Now, let's import the project into Eclipse...