DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Last call! Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • A Complete Guide on How to Convert InputStream to String In Java
  • Adding Two Hours in DataWeave: Mule 4
  • How to Convert Files to Thumbnail Images in Java
  • Understanding Floating-Point Precision Issues in Java

Trending

  • Power BI Embedded Analytics — Part 2: Power BI Embedded Overview
  • How the Go Runtime Preempts Goroutines for Efficient Concurrency
  • Infrastructure as Code (IaC) Beyond the Basics
  • A Modern Stack for Building Scalable Systems
  1. DZone
  2. Data Engineering
  3. AI/ML
  4. Cryptography Module in Mule 4

Cryptography Module in Mule 4

By 
Pooja Bhosle user avatar
Pooja Bhosle
·
May. 18, 20 · Tutorial
Likes (2)
Comment
Save
Tweet
Share
8.1K Views

Join the DZone community and get the full member experience.

Join For Free

Steps to Use JCE Encrypt and JCE Decrypt Connectors

  1. Check if Crypto module is available in Mule Palette. If not, download it from exchange.
  2. Then, search for JCE in the Mule palette. The Crypto module should be visible now.

Mule pallette
3. To use Jce encrypt and decrypt connector, we need a keystore.

  • Generate a keystore using following command:  

keytool.exe -genseckey -alias jksvalue -keyalg Blowfish -keystore encKeystore.jceks -keysize 128 -storeType JCEKS

Alias name : jksvalue 

Algorithm used : Blowfish

Keystore file name : encKeystore

Keystore file type : jceks

 Using JCE encrypt

Keep the keystore and key passwords. These passwords need to be use in JCE configuration. 

  • Store the generated encKeystore.jceks file in resource folder of mule project.
  • Take Jce encrypt connector from the Mule palette and do the module configuration as shown below : 

Module configuration


Module configuration

We are using a symmetric key (same key for encryption and decryption). Add the symmetric key details using the + button in the above image. 

Adding symmetric key details


Configuring JCE key

Do the remaining configuration just shown in the above image. Note that the algorithm should be the same, which we used for creating the Keystore and the Key id in the above two images should be identical. 

Check the advanced section. 

Checking Keystore and key Id

The output of this component below is the encrypted value : 

Encrypted value

The encrypted value has a few characters, which cannot be shared or we cannot type it. Here comes the encoding part to convert the encrypted string to Base64 format.  

Encoding can be done using the below transformation:

Payload to Base 64

The output of encoding is below: 

Encoding below

In the same way, we have to first decode the payload and then decrypt it:

Encoding payload

Decrypting payload

Java Cryptography Extension Connector (mathematics) Algorithm Base64 Strings Convert (command) Command (computing) Data Types

Opinions expressed by DZone contributors are their own.

Related

  • A Complete Guide on How to Convert InputStream to String In Java
  • Adding Two Hours in DataWeave: Mule 4
  • How to Convert Files to Thumbnail Images in Java
  • Understanding Floating-Point Precision Issues in Java

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!