Payload Level Security
- Import an “Existing Project into Workspace” contained in ~/FuseWorkshop/support/Lab12/Lab12.zip.
- Double-click on the camel-context.xml file.
- Add a Marshal component from the Transformation palette to the canvas.
- Create a link between the activeMQ component and the Marshal component.
- Create a link between the Marshal component and the Log component.
- Click on the Marshal component and click on the Properties tab.
Click on the Crypto data format.
Enter “DES” as Algorithm
Enter “secretKey” as Key Ref
Save the file (Ctrl+S).
- Click on the Source tab.
- Locate the <camelContext> element and paste before it the following code:
<crypt:keystore id="keyStore" |
---|
The KeyStore bean defines the location and characteristics of the key store, while the secretKey bean defines the reference id and characteristics of the key used to encrypt the message payload. | |
---|---|
- Save the file (Ctrl+S).
- Double-click on the pom.xml file and click on the Dependencies tab.
- Click on the Add button.
Complete the following values:
Group Id: org.apache.camel
- Artifact Id: camel-crypto
Version: ${camel-version}
Click OK.
- Click on the “pom.xml” tab.
- Locate the fabic8 plugin configuration by the end of the file.
- Delete the “features” line and replace it with:
<features>mq-fabric-camel camel-crypto</features> <bundles>wrap:mvn:com.google.code.spring-crypto-utils/spring-crypto-utils/1.3.0</bundles> |
---|
- Save the file (Ctrl+S).
- Open a terminal window
- CD to home and execute the following command:
keytool -genseckey -alias shared -keystore keystore.jceks -storepass secret -storetype JCEKS -keyalg DES |
---|
Keytool is a key and certificate management utility. It allows users to administer their own public/private key pairs and associated certificates for use in self-authentication or data integrity and authentication services, using digital signature | |
---|---|
- Press enter to accept the password.
- Go back to JBDS.
- Right-click on the Lab12 project, “Run As” -> “Maven build”
- In the Goals field enter “fabric8:deploy”.
- Click Apply and click Run.
- When the profile is deployed to Fuse, switch to the web browser.
- Click on the Containers tab.
- Click on the root container name.
- Select the 3 insight profiles, and click Remove.
- Click on the Add button.
- Enter “lab12” in the profile filter text box.
- Select lab12profile and click Add.
- Click on the Open icon.
- In the root web browser tab, click on the ActiveMQ tab.
- Click on the lab9 queue under root/Queue
- Click on the Send tab.
- Select “Plain text” as the Payload format.
- Enter any text in the payload field.
- Click on the Send Message button.
- Click on the Logs tab.
- You should see a new log message with the encrypted text:
- Close the root web browser tab.
- Click on the Containers tab again.
- Click on the root container name.
- Select the lab12Profile and click the Remove button.