<?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 Michal Kopyt on Medium]]></title>
        <description><![CDATA[Stories by Michal Kopyt on Medium]]></description>
        <link>https://medium.com/@placyd86?source=rss-b788266a3936------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Stories by Michal Kopyt on Medium</title>
            <link>https://medium.com/@placyd86?source=rss-b788266a3936------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 15 Nov 2026 21:19:23 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@placyd86/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 connect Windows trust store in Maven Java project]]></title>
            <link>https://medium.com/where-3-worlds-meet/how-to-connect-windows-trust-store-with-maven-java-project-cd6447ac8e47?source=rss-b788266a3936------2</link>
            <guid isPermaLink="false">https://medium.com/p/cd6447ac8e47</guid>
            <category><![CDATA[windows]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[maven]]></category>
            <dc:creator><![CDATA[Michal Kopyt]]></dc:creator>
            <pubDate>Tue, 29 Oct 2024 23:11:38 GMT</pubDate>
            <atom:updated>2025-01-22T10:18:21.566Z</atom:updated>
            <content:encoded><![CDATA[<p>This article explains how to configure Maven to use the Windows trust store instead of the default Java trust store.</p><p><strong>Why This Is Important</strong></p><p>If a certificate is not added to either the Windows trust store or the Java trust store, the following exception may occur:</p><pre>sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target</pre><p>This indicates that the system is attempting to connect to a host with an SSL certificate that is not trusted. This can lead to issues, such as failing to download dependencies from an artifact repository.</p><p>To resolve this, you need to add the target host’s SSL certificate to a trust store.</p><p>By default, Maven looks for certificates in the Java trust store, which is located here:</p><p><strong>For Java 8:</strong></p><pre>JAVA_HOME/jre/lib/security/cacerts</pre><p><strong>For Java 11:</strong></p><pre>$JAVA_HOME/lib/security/cacerts</pre><p>To add a certificate, use the following command:</p><pre>keytool -import -trustcacerts -alias &lt;your-alias&gt; \<br> -file /somewhere/in/filesystem/CACert.crt \<br> -keystore &quot;$JAVA_HOME/lib/security/cacerts&quot;</pre><p>If obtaining the certificate is problematic, you can try retrieving it with the following openssl command:</p><pre>echo | openssl s_client -connect your_server:443 2&gt;&amp;1 | sed -ne &#39;/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p&#39; &gt; CACert.crt</pre><p><strong>Using the Windows Trust Store</strong></p><p>Alternatively, you can add the certificate to the Windows trust store. This can be done by right-clicking the certificate file and selecting &quot;Install.&quot;</p><p>To make Maven recognize certificates from the Windows trust store, you need to update Maven’s settings by either:</p><ul><li>Adding the following line to the .mavenrc file in your user home directory:</li></ul><pre>MAVEN_OPTS=&quot;-Djavax.net.ssl.trustStoreType=Windows-ROOT&quot;</pre><ul><li>Setting the MAVEN_OPTS environment variable with the same value.</li></ul><p>For instance in Intellij IDEA this setting is here:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/982/1*w5L5wC9nr3kywah1WHLVyQ.png" /></figure><p>After adding the new certificate to the Windows trust store, a system reboot may be necessary for the changes to take effect.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cd6447ac8e47" width="1" height="1" alt=""><hr><p><a href="https://medium.com/where-3-worlds-meet/how-to-connect-windows-trust-store-with-maven-java-project-cd6447ac8e47">How to connect Windows trust store in Maven Java project</a> was originally published in <a href="https://medium.com/where-3-worlds-meet">Where 3 Worlds Meet</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[IBM MQ — Spring Boot mTLS]]></title>
            <link>https://medium.com/where-3-worlds-meet/configuring-ibm-mq-java-client-to-use-mtls-e47a92a4bb33?source=rss-b788266a3936------2</link>
            <guid isPermaLink="false">https://medium.com/p/e47a92a4bb33</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[mtls-authentication]]></category>
            <category><![CDATA[ibm-mq]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[spring-boot]]></category>
            <dc:creator><![CDATA[Michal Kopyt]]></dc:creator>
            <pubDate>Wed, 18 Sep 2024 20:53:01 GMT</pubDate>
            <atom:updated>2024-11-12T08:58:54.655Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*siQI-CyeyaPmc9rLrBnBxg.png" /></figure><p>This article describe how to establish connection between two parts, Client and Server using mutual TLS (mTLS). Client side is where JAVA Spring Boot service is deployed and Server side is an infrastructure where IBM MQ is. Below, I outline the necessary steps to configure an mTLS connection, with a primary focus on the client side.</p><h3>Client-Side Prerequisites</h3><p>The client must have its own keystore and truststore. The server’s certificate, used in the SSL handshake, should be imported into the client’s truststore (see the “Testing mTLS” section, step 2).</p><p><strong>Regarding the client’s keystore:</strong></p><ul><li>Generate an RSA keypair with a specific length.</li><li>Use this keypair to generate a CSR (Certificate Signing Request). Ensure the provided information is correct, as it will be used to generate the certificate. For example:</li></ul><pre>CN = example.com<br>OU = ACME Dep<br>O = ACME<br>L = California<br>S = San Francisco<br>C = US</pre><ul><li>Request a public or organizational Certificate Authority (CA) to sign your certificate.</li><li>Based on the CSR, the CA will issue the certificate along with any root or intermediate certificates.</li><li>Attach the signed certificate to the client’s keypair by running the following command:</li></ul><pre>1 keytool -importcert -keystore your_client_keystore.jks -alias your_keypair_alias -file signed_certificate.cer</pre><p>Ensure the alias matches the RSA keypair alias.</p><p>Once successful, you should see the message:</p><pre>Certificate reply was installed in keystore</pre><p>Alternatively, you can use KeyStore Explorer to import the CA reply by clicking on the keypair and selecting “Import CA Reply,” then choosing the certificate file.</p><h3>Changes in Source Code</h3><p>Dependencies for Spring Boot:</p><pre>    &lt;dependency&gt;<br>      &lt;groupId&gt;com.ibm.mq&lt;/groupId&gt;<br>      &lt;artifactId&gt;mq-jms-spring-boot-starter&lt;/artifactId&gt;<br>      &lt;version&gt;correct_version&lt;/version&gt;<br>    &lt;/dependency&gt;</pre><p>Cipher mapping for non-IBM Java SDK users:</p><p>If you’re not using the IBM Java SDK, add this Java option:</p><pre>1 -Dcom.ibm.mq.cfg.useIBMCipherMappings=false</pre><h3>Service configuration</h3><p>You can override built-in parameters to configure a standard IBM MQ TLS connection:</p><pre>ibm.mq:<br>  queueManager: queueManager_name<br>  channel: channel_name<br>  connName: connName(50060), connName(50060)<br>  user: John<br>  password: pass</pre><p>Other parameters were custom implementation needed to mTLS</p><pre> sslContextType: TLSv1.3 # it depends on server side requirements<br> trustStorePassword: passwordToTrustStore<br> trustStoreType: jks<br> trustStoreLocation: /dir/truststore.jks<br> keyStorePassword: passwordToKeyStore<br> keyStoreType: jks<br> keyStoreLocation: /dir/keystore.jks<br> transportType: 1<br> sslFipsRequired: false<br> property:<br> XMSC_WMQ_SSL_CIPHER_SPEC: &quot;&lt;put here CipherSpec&gt;&quot; # The name of the CipherSpec to be used on a TLS connection to a queue manager. The protocol used in negotiating the secure connection depends on the specified CipherSpec. It is important to ask server side about which algorithm was used.<br> # available options: https://www.ibm.com/docs/en/ibm-mq/9.4?topic=cipherspecs-cipherspec-order-in-tls-handshake</pre><p>For further CipherSpec options, refer to <a href="https://www.ibm.com/docs/en/ibm-mq/9.4?topic=cipherspecs-cipherspec-order-in-tls-handshake">IBM documentation</a>.</p><p><strong>Note:</strong> Full code implementation is not provided here. You will need to implement the JmsListenerContainerFactory&lt;DefaultMessageListenerContainer&gt; and ConnectionFactory beans. In the latter, manually initialize the SSL context to specify which keystore and truststore should be loaded.</p><h3>Server-Side Prerequisites</h3><p>The server side must have certificate in their truststore which will be used to authenticate the client <em>(your service). </em>We need to send Root CA, intermediate certificate or different client certificate to server side. <strong>That certificate should be also present in client keystore, attached to client RSA keypair.</strong></p><h3>mTLS Modes</h3><p>Mutual TLS in IBM MQ can be set to <strong>enforce </strong>mode. In this mode each client will need to connect to server via mTLS to establish connection.</p><p>Or we can ask to set it to <strong>optional.</strong> During the integration, we may ask server side to temporarily switch the mTLS mode to <strong>optional,</strong> so that you can run UAT tests and additionally works on the mTLS connection.</p><h3>Testing mTLS</h3><p>To verify that mTLS is working, enable SSL debugging by adding the following Java option:</p><pre>-Djavax.net.debug=ssl,handshake</pre><p>After restarting the service, you will see the full mTLS handshake process:</p><ol><li>Client connects to server</li><li>Server presents its TLS certificate</li><li>Client verifies the server’s certificate</li><li>Client presents its TLS certificate</li><li>Server verifies the client’s certificate</li><li>Server grants access</li><li>Client and server exchange information over encrypted TLS connection</li></ol><p>Note to 1) If credentials and addresses are correct, the client should pass the first step.</p><p>Note to 3) If the truststore is correctly configured, the client will pass this step.</p><p>Ad 4) The client will pass this step if:</p><p>a) The certificate is successfully attached to the keypair (in the keystore). The log should display:</p><pre> Produced client Certificate handshake message (<br> &quot;Certificates&quot;: [<br>   &quot;certificate&quot; : {<br>  &quot;version&quot;            : &quot;v3&quot;,<br>...</pre><p>If the certificate is missing, you’ll see an empty list:</p><pre>Produced client Certificate handshake message (<br> &quot;Certificates&quot;: &lt;empty list&gt;<br> )<br>...</pre><p>b) The server’s truststore contains the client’s certificate or root CA.</p><p>If no exceptions appear in the logs, the integration should be ready. You can ask the server to enforce mTLS mode or manually initiate a connection to IBM MQ to verify.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e47a92a4bb33" width="1" height="1" alt=""><hr><p><a href="https://medium.com/where-3-worlds-meet/configuring-ibm-mq-java-client-to-use-mtls-e47a92a4bb33">IBM MQ — Spring Boot mTLS</a> was originally published in <a href="https://medium.com/where-3-worlds-meet">Where 3 Worlds Meet</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>