---
title: Mule Encryption
description: This tutorial covers step by step how to encrypt using Mulesoft's Anypoint platform, beginning with installation all the way through to configuration.
image: https://blog.avenuecode.com/hubfs/Images/Blog/MuleSoft-mules-1.jpg
---

[AvenueCode.com](https://avenuecode.com) [News](https://avenuecode.com/news) [Contact](https://avenuecode.com/contact)

[![Avenue Code Snippets Logo](https://blog.avenuecode.com/hubfs/Avenue%20Code%20New%20Logos%20-%202023/AC-Snippets---Black.png)](https://blog.avenuecode.com/?hsLang=en-us) *menu*

- Technology
  
  [Cloud](https://blog.avenuecode.com/blog/topic/cloud?hsLang=en-us) [Delivery Infrastructure](https://blog.avenuecode.com/blog/topic/delivery-infrastructure?hsLang=en-us) [Web Experience](https://blog.avenuecode.com/blog/topic/web-experience?hsLang=en-us) [Agile Mindset](https://blog.avenuecode.com/blog/topic/agile-mindset?hsLang=en-us) [Quality First](https://blog.avenuecode.com/blog/topic/quality-first?hsLang=en-us)
  
  [Design](https://blog.avenuecode.com/blog/topic/design?hsLang=en-us) [Solution Architecture](https://blog.avenuecode.com/blog/topic/solution-architecture?hsLang=en-us) [Data & ML](https://blog.avenuecode.com/blog/topic/data-and-machine-learning?hsLang=en-us) [Mobile Experience](https://blog.avenuecode.com/blog/topic/mobile-experience?hsLang=en-us)
- [Whitepapers](https://blog.avenuecode.com/blog/topic/whitepapers?hsLang=en-us)
- [Spotlight](https://blog.avenuecode.com/blog/topic/spotlight?hsLang=en-us)
- [Extraordinary Women in Tech](https://blog.avenuecode.com/blog/topic/extraordinary-women-in-tech?hsLang=en-us)
- [Avenue Code Culture](https://blog.avenuecode.com/blog/topic/avenue-code-culture?hsLang=en-us)

- [Cloud](https://blog.avenuecode.com/blog/topic/cloud?hsLang=en-us)
- [Design](https://blog.avenuecode.com/blog/topic/design?hsLang=en-us)
- [Delivery Infrastructure](https://blog.avenuecode.com/blog/topic/delivery-infrastructure?hsLang=en-us)
- [Solution Architecture](https://blog.avenuecode.com/blog/topic/solution-architecture?hsLang=en-us)
- [Web Experience](https://blog.avenuecode.com/blog/topic/web-experience?hsLang=en-us)
- [Data & ML](https://blog.avenuecode.com/blog/topic/data-and-machine-learning?hsLang=en-us)
- [Agile Mindset](https://blog.avenuecode.com/blog/topic/agile-mindset?hsLang=en-us)
- [Mobile Experience](https://blog.avenuecode.com/blog/topic/mobile-experience?hsLang=en-us)
- [Quality First](https://blog.avenuecode.com/blog/topic/quality-first?hsLang=en-us)
- [Whitepapers](https://blog.avenuecode.com/blog/topic/whitepapers?hsLang=en-us)
- [Spotlight](https://blog.avenuecode.com/blog/topic/spotlight?hsLang=en-us)
- [Extraordinary Women in Tech](https://blog.avenuecode.com/blog/topic/extraordinary-women-in-tech?hsLang=en-us)
- [Avenue Code Culture](https://blog.avenuecode.com/blog/topic/avenue-code-culture?hsLang=en-us)

# [Mule Encryption](https://blog.avenuecode.com/mule-jce-encryption)

- [Tweet](https://twitter.com/share)

*perm\_identity* [Anupam Gogoi](https://blog.avenuecode.com/mule-jce-encryption/author/anupam-gogoi?hsLang=en-us)

*schedule* 1/18/17 9:53 PM

> “Do not reinvent the wheel.” That’s the principle Mule applies when it comes to Mule Message Security. [Anypoint Enterprise Security](https://docs.mulesoft.com/mule-user-guide/v/3.8/anypoint-enterprise-security) is a suite that comes bundled with all the necessary modules/methods for applying security to Mule Service Oriented Architecture (SOA) implementations and Web services.

## Objectives

My main concern regarding the security was [Mule Message Encryption](https://docs.mulesoft.com/mule-user-guide/v/3.8/mule-message-encryption-processor). Mule provides three extraordinary **Encryption Strategies**:

- **JCE Encrypter**: encrypts stream, byte\[\] or string.
- **XML Encrypter**: encrypts string, encrypts individual fields using xpath expressions.
- **PGP Encrypter**: encrypts stream, byte\[\] or string. In this blog post I will try to explain how to configure **Anypoint Studio** for applying encryption strategies to mule messages using the **JCE Encrypter**.

## Let's Jump Right In!

Time to get our hands dirty. We'll cover everything we can, beginning with the installation of **Anypoint Enterprise Security**. We'll also go over troubleshooting practices during the installation process.

## Installation of Anypoint Enterprise Security

I am using **Mule 3.8.2 EE** for this experiment. Take a look at this [link](https://docs.mulesoft.com/mule-user-guide/v/3.8/installing-anypoint-enterprise-security) if you'd like to dive into the installation guide in detail. Here is a screenshot:

![Mulesoft 1.png](https://blog.avenuecode.com/hs-fs/hubfs/Images/Blog/Mulesoft%201.png?width=912&height=611&name=Mulesoft%201.png)

Please select the **Premium** bundle and proceed. In my case I could not install the software initially. If the same problem continues in your case please uncheck the “Contact all update sites during install to find required software” checkbox.

After successful installation, restart your Anypoint studio. You should see the following components under the security group palettes.

![Mulesoft 2.png](https://blog.avenuecode.com/hs-fs/hubfs/Images/Blog/Mulesoft%202.png?width=810&height=790&name=Mulesoft%202.png)

Now you are ready to go!

## Creating a Mule Maven Project

Let’s create a simple Mule Maven project using Anypoint Studio. The most important point is to add the following repository in the **pom.xml** file.

`<repository> `

`   <id>mulesoft-public</id>`

`   <name>MuleSoft Public Repository</name>`

`   <url>https://repository.mulesoft.org/nexus/content/repositories/public/</url>`

`   <layout>default</layout>`

`</repository> `

## Creating a Simple Flow

Let’s create a simple flow. The scenario is as follows: we send some JSON data to an HTTP endpoint. Then, the JSON data is encrypted using **JCE Encryption Strategy**, and we log the encrypted data. After that, we simply decrypt the encrypted data and log it. Here is diagram of the flow.

## ![Mulesoft 3.png](https://blog.avenuecode.com/hs-fs/hubfs/Images/Blog/Mulesoft%203.png?width=848&height=202&name=Mulesoft%203.png)

## Digging Into JCE Encryption

“The **Java Cryptography Extension (JCE)** is an officially released Standard Extension to the Java Platform and part of Java **Cryptography** Architecture. **JCE** provides a framework and implementation for **encryption**, key generation and key agreement, and Message Authentication Code (MAC) algorithms.”

#### Step 1

First let’s configure a global Encryption element.

![Mulesoft 4.png](https://blog.avenuecode.com/hs-fs/hubfs/Images/Blog/Mulesoft%204.png?width=625&height=630&name=Mulesoft%204.png)

Be sure to select the Default Encryptor dropdown as JCE\_ENCRYPTER. I have named the global element as **JCE**.

#### Step 2

Now, having configured the global Encryption element in **step 1**, we'll configure the Encryption component (labeled as **JCE Encryption** in the flow. This is a Encryption palette found under the Security category of Mule palettes). Here is the screen shot:

``

In the **Connector Configuration**, please select the global encryption element(JCE) that we previously defined in **step 1**. In the **Operation** dropdown, select **Encrypt**. In the **Input Reference** field, I am adding the whole payload (JSON data) for encryption. Don't forget that you can use MEL expression here to encrypt some part of the payload too. Since we are using JCE\_ENCRYPTER in this example, our next step is to configure it. Select the Define attributes radio button in the **JCE encrypter Strategy Configuration for operation category**.

**Key**: Must be a 16 digit phrase.

**Key Password**: (whatever you wish)

**Algorithm**: Choose an algorithm from the dropdown list.

**Encryption Mode**: Choose from the dropdown list.

That’s it. You are ready to go! There is another way to make it more secure using Keystore, but that's another topic for another day.

#### Step 3

In **step 2** we have successfully encrypted the message. Next, let’s decrypt the encrypted message. Here we are going to configure the component labelled as **Decrypt payload**. (This is nothing but an **Encryption palette** found under the Security category of Mule palettes. Here is the configuration:

![Mulesoft 6.png](https://blog.avenuecode.com/hs-fs/hubfs/Images/Blog/Mulesoft%206.png?width=891&height=810&name=Mulesoft%206.png)

As you can see, this configuration is almost same as for encryption. The only difference is the **Operation: Decrypt**.

## Testing

Finally, let's run the project and then send a POST request with JSON payload. I am using Postman for this operation. Observing the Anypoint console, you can see the encrypted message as well as decrypted message.

![Mulesoft 7.png](https://blog.avenuecode.com/hs-fs/hubfs/Images/Blog/Mulesoft%207.png?width=797&height=482&name=Mulesoft%207.png)

Source code can be found [here](https://github.com/anupamgogoi0907/muleapps).

**Final note**: You can use mvn **eclipse:eclipse** to import the maven dependencies.

Thanks for reading! Hopefully this was helpful. Any questions? Let me know in the comments!

---

### Author

# Anupam Gogoi

 Anupam Gogoi is an Integration Engineer at Avenue Code. He has been working in software development for about 9 years, implementing solutions in Java technologies as well as in SOA domain. He is a hardcore JAVA and MIDDLEWARE evangelist.

---

### Related Posts

### New Horizons for Solution Architects

[READ MORE](https://blog.avenuecode.com/new-horizons-for-solution-architects?hsLang=en-us)

### How to Use Circuit Breaker Resilience in Your API Integration

[READ MORE](https://blog.avenuecode.com/how-to-use-circuit-breaker-resilience-in-your-api-integration?hsLang=en-us)

### How to Run Rust from Python

[READ MORE](https://blog.avenuecode.com/how-to-run-rust-from-python?hsLang=en-us)

### Deep Dive into MuleSoft Internals - API Tracking

[READ MORE](https://blog.avenuecode.com/what-you-need-to-know-about-api-tracking-in-mulesoft?hsLang=en-us)

### Leave a Comment!

### Avenue Code Social

[![Facebook Icon](https://blog.avenuecode.com/hubfs/Images/Blog/facebook.png?t=1486470796564)](https://www.facebook.com/avenuecode)

[![Twitter Icon](https://blog.avenuecode.com/hubfs/Images/Blog/twitter.png?t=1486470796842)](https://twitter.com/AvenueCode)

[![LinkedIn Icon](https://blog.avenuecode.com/hubfs/Images/Blog/linkedin.png?t=1486470796556)](https://www.linkedin.com/company/avenue-code)

### Newsletter

Want to stay on top of all tips and news from Avenue Code?

### Popular Snippets

![ac-logo-inverted.svg](https://blog.avenuecode.com/hubfs/Images/Logos/ac-logo-inverted.svg "ac-logo-inverted.svg")

### About Us

- [Who We Are](https://www.avenuecode.com/who-we-are)
- [What We Do](https://www.avenuecode.com/what-we-do)
- [Portfolio](https://www.avenuecode.com/portfolio)
- [Partners](https://www.avenuecode.com/partners)
- [News](https://www.avenuecode.com/news)
- [Events](https://www.avenuecode.com/events)
- [Blog](https://blog.avenuecode.com/)
- [Contact](https://www.avenuecode.com/contact)

### Our Offices

San Francisco

[+1 415 766 4178](tel:+553125161448) [ac.inquiries@avenuecode.com](mailto:brazil.info@avenuecode.com)

Belo Horizonte

[+55 31 2516 1448](tel:+553125161448) [brazil.info@avenuecode.com](mailto:brazil.info@avenuecode.com)

São Paulo

[+55 11 3205 3232](tel:+553125161448) [brazil.info@avenuecode.com](mailto:brazil.info@avenuecode.com)

### We're Hiring!

- [Belo Horizonte](https://www.avenuecode.com/who-we-are)
- [New York](https://www.avenuecode.com/what-we-do)
- [San Francisco](https://www.avenuecode.com/portfolio)
- [São Paulo](https://www.avenuecode.com/partners)

---

©2015 - 2017 Avenue Code

[![Facebook Icon](https://blog.avenuecode.com/hubfs/Images/Icons/facebook-2.png)](https://www.facebook.com/avenuecode) [![Twitter Icon](https://blog.avenuecode.com/hubfs/Images/Icons/twitter-2.png)](https://twitter.com/AvenueCode) [![LinkedIn Icon](https://blog.avenuecode.com/hubfs/Images/Icons/linkedin-2.png)](https://www.linkedin.com/company/avenue-code) [![Glassdoor Icon](https://blog.avenuecode.com/hubfs/Images/Icons/glassdoor-icon-1.png)](https://www.glassdoor.com/Overview/Working-at-Avenue-Code-EI_IE456173.11,22.htm) [![YouTube Icon](https://blog.avenuecode.com/hubfs/Images/Icons/youtube-2.png)](https://www.youtube.com/user/AvenueCodePlay)

/\*\* DISQUS SCRIPTS \*\*/ Please enable JavaScript to view the [comments powered by Disqus.](http://disqus.com/?ref_noscript)

© 2026 Avenue Code

```json
{
  "@context" : "https://schema.org",
  "@type" : "BlogPosting",
  "author" : {
    "@type" : "Person",
    "name" : "Anupam Gogoi",
    "url" : "https://blog.avenuecode.com/author/anupam-gogoi"
  },
  "datePublished" : "2017-01-18T23:53:00.000Z",
  "headline" : "Mule Encryption",
  "image" : [ "https://blog.avenuecode.com/hubfs/Images/Blog/MuleSoft-mules-1.jpg" ],
  "mainEntityOfPage" : {
    "@id" : "https://blog.avenuecode.com/mule-jce-encryption",
    "@type" : "WebPage"
  },
  "publisher" : {
    "@type" : "Organization",
    "logo" : {
      "@type" : "ImageObject",
      "url" : "https://blog.avenuecode.com/hubfs/Avenue%20Code%20New%20Logos%20-%202023/Avenue%20Code-primary%20versions_LOGO%20HORIZONTAL%20group%201-7.png"
    },
    "name" : "Avenue Code"
  }
}
```