<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Antonio Carlos Reis on Medium]]></title>
        <description><![CDATA[Stories by Antonio Carlos Reis on Medium]]></description>
        <link>https://medium.com/@antoniocarlosreis?source=rss-118f49bcb832------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*HbQzf6Q4dfLmNWADuuN1WQ.jpeg</url>
            <title>Stories by Antonio Carlos Reis on Medium</title>
            <link>https://medium.com/@antoniocarlosreis?source=rss-118f49bcb832------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 13:09:40 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@antoniocarlosreis/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How To Encrypt Files Using GPG in WSO2 ESB]]></title>
            <link>https://medium.com/@antoniocarlosreis/how-to-encrypt-files-using-gpg-in-wso2-esb-1b612dc7abde?source=rss-118f49bcb832------2</link>
            <guid isPermaLink="false">https://medium.com/p/1b612dc7abde</guid>
            <category><![CDATA[wso2]]></category>
            <dc:creator><![CDATA[Antonio Carlos Reis]]></dc:creator>
            <pubDate>Mon, 21 May 2018 20:02:03 GMT</pubDate>
            <atom:updated>2018-05-21T20:02:03.441Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/637/1*IkFxZXVsks2X7tZphzm2Fw.png" /></figure><p>Sometimes we face some scenarios when it might be useful to encrypt files on WSO2 ESB. GPG is a cryptographic software suite that let us encrypt some files in our local system.</p><p>This post will guide you to fully set up your environment in order to achieve this task in your local WSO2 environment. You will first need to download GPG on your local machine (In my case I will be using gpg4win-3.1.1).</p><p>Once we have it installed, we need to create a new key pair. I will use Kleopatra to do that, click on File and new key pair. We will choose the first option (Create a personal openPGP key pair).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/963/1*wLEglTSYzEjO4x_eB-iRDg.png" /></figure><p>You will be asked to provide a name and email. It is really important to pay attention to the email you will use as it will be used in the GPG command to encrypt the file. In my example, I have entered the following values just for the purpose of this post.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/507/1*QpV0CB5wJJey9i2L99ofjw.png" /></figure><p>Next click on create and you will be asked to provide a passphrase. Once you have done it click on OK. Then click finish.</p><p>We will be using the following snippet of code for this example.</p><pre>&lt;property value=&quot;example@example.com&quot; name=&quot;emailKey&quot;/&gt;<br>&lt;property value=&quot;C:/trainning/folder1/&quot; name=&quot;inputFilePath&quot;/&gt;&lt;property value=&quot;C:/trainning/folder2/&quot; name=&quot;outputFilePath&quot;/&gt;<br>&lt;property value=&quot;example.txt&quot; name=&quot;inputFileName&quot;/&gt;<br>&lt;property value=&quot;encryptedExampleTXT.gpg&quot; name=&quot;outputFileName&quot;/&gt;</pre><pre>&lt;property expression=&quot;fn:concat($ctx:inputFilePath,$ctx:inputFileName)&quot; name=&quot;inputPathAndFileName&quot;/&gt;</pre><pre>&lt;property expression=&quot;fn:concat($ctx:outputFilePath,$ctx:outputFileName)&quot; name=&quot;outputPathAndFileName&quot;/&gt;</pre><pre>&lt;script language=&quot;js&quot;&gt;</pre><pre>&lt;![CDATA[var command = &quot;gpg -v --no-secmem-warning -r &quot; + String(mc.getProperty(&#39;emailKey&#39;)) + &quot; --always-trust --armor --output &quot; + String(mc.getProperty(&#39;outputPathAndFileName&#39;)) + &quot; --encrypt &quot; + String(mc.getProperty(&#39;inputPathAndFileName&#39;));</pre><pre>print(command.toString());</pre><pre>var process = java.lang.Runtime.getRuntime().exec(command);process.waitFor();]]&gt;</pre><pre>&lt;/script&gt;</pre><p>In our <em>emailKey </em>property, we will be using the key to encrypt the file, we could also use the fingerprint related to this <em>example@example.com</em> email key. The <em>inputFilePath </em>property is the path where the file we want to encrypt is located. We also have the <em>outputFilePath </em>property which is the path where we want to place the encrypted file. In this case, we chose to use different paths (input and output) just to show you could encrypt the file from one folder and place it in any local folder you want.</p><p>We also have the <em>inputFileName </em>and <em>outputFileName </em>properties which are the name of the file we want to encrypt and the name of the file we want to save respectively.</p><pre>print(command.toString());</pre><p>This line is very useful because we can use this command printed in the Eclipse console to test the GPG command in the command line tool apart from WSO2 to make sure everything is working properly with GPG. The GPG command should be similar to.</p><pre>gpg -v --no-secmem-warning -r <a href="/service/mailto:example@example.com">example@example.com</a> --always-trust --armor --output C:/trainning/folder2/encryptedExampleTXT.gpg --encrypt C:/trainning/folder1/example.txt</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y83VubryAwFTCtd3qWuFoA.png" /></figure><p>Once we run this command it should encrypt the example.txt file from folder1 and save the encrypted file (encryptedExampleTXT.gpg) in folder2. You will need to enter the passphrase in order to unlock the encryptedExampleTXT.gpg file.</p><p>One final step to make sure everything will work as expected is to restart your computer, for some reason the GPG command would not work on WSO2 ESB right away even if we restart Eclipse.</p><p>I would like to give a big thank you to <a href="https://medium.com/u/d5c57d15fcd3">Isaias Silva</a> for helping me with this.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1b612dc7abde" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>