<?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" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
    <channel>
        
        <title>
            <![CDATA[ b2b - freeCodeCamp.org ]]>
        </title>
        <description>
            <![CDATA[ Browse thousands of programming tutorials written by experts. Learn Web Development, Data Science, DevOps, Security, and get developer career advice. ]]>
        </description>
        <link>https://www.freecodecamp.org/news/</link>
        <image>
            <url>https://cdn.freecodecamp.org/universal/favicons/favicon.png</url>
            <title>
                <![CDATA[ b2b - freeCodeCamp.org ]]>
            </title>
            <link>https://www.freecodecamp.org/news/</link>
        </image>
        <generator>Eleventy</generator>
        <lastBuildDate>Tue, 09 Jun 2026 04:39:18 +0000</lastBuildDate>
        <atom:link href="https://www.freecodecamp.org/news/tag/b2b/rss.xml" rel="self" type="application/rss+xml" />
        <ttl>60</ttl>
        
            <item>
                <title>
                    <![CDATA[ How to verify AS2 message (SMIME) signatures with OpenSSL ]]>
                </title>
                <description>
                    <![CDATA[ By Rajind Ruparathna Error MDNs stating an error in the lines of “Signature verification failed” or “Decryption failed” are common for users who are just getting started with AS2 in any AS2 service. We have seen many such instances in our SaaS B2B AS... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-verify-as2-message-smime-signature-with-openssl-605c1affe3b/</link>
                <guid isPermaLink="false">66c355fbdae03919d93dc037</guid>
                
                    <category>
                        <![CDATA[ b2b ]]>
                    </category>
                
                    <category>
                        <![CDATA[ openssl ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Security ]]>
                    </category>
                
                    <category>
                        <![CDATA[ tech  ]]>
                    </category>
                
                    <category>
                        <![CDATA[ technology ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Tue, 19 Mar 2019 03:30:04 +0000</pubDate>
                <media:content url="https://cdn-media-1.freecodecamp.org/images/1*E_4R13d5-VasRRr_JA9bxg.jpeg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Rajind Ruparathna</p>
<p>Error MDNs stating an error in the lines of <strong>“Signature verification failed”</strong> or “Decryption failed” are common for users who are just getting started with AS2 in any AS2 service. We have seen many such instances in our SaaS B2B AS2 messaging platform the <a target="_blank" href="http://as2gateway.com/">AdroitLogic AS2Gateway.</a> With these kinds of errors, sometimes, it is important for the support team and also the user to be able to <a target="_blank" href="https://notebookbft.wordpress.com/2019/03/17/how-to-decrypt-an-as2-message-smime-with-openssl/">try the decryption</a> or signature verification manually to get more insight.</p>
<p>In this blog post, we will look at what the digital signature in AS2 protocol is, how to verify the signature of an AS2 message, and some tips on figuring out the cause for certain signature verification failures.</p>
<h3 id="heading-signature-in-as2-protocol">Signature in AS2 Protocol</h3>
<p>AS2 signature is essentially a digital signature which provides authentication, data integrity and non-repudiation to the AS2 communication.</p>
<ul>
<li>Authentication — Ensures that the receiver is transacting with the sender that he/she was meant to transact with (and not an impostor)</li>
<li>Data Integrity — Determines whether the file or data the receiver got was altered along the way</li>
<li>Non-Repudiation — Prevents the sender from denying that the messages they sent originated from them</li>
</ul>
<p><img src="https://cdn-media-1.freecodecamp.org/images/QOy4kQEnq9wNekhfJZpPYQpiRLrz2H9dLynA" alt="Image" width="508" height="171" loading="lazy"></p>
<p>As shown in the above figure, the sender’s private key is used when generating the signature, and thus for verification the sender’s public key is used.</p>
<h3 id="heading-lets-get-to-work">Let’s Get to Work!</h3>
<p>For demonstration purposes, we will be using an incoming AS2 message to the AS2Gateway. Since we are only focusing on signature verification in this blog post, the incoming AS2 message will not be encrypted or compressed. If you want to try this out with encryption, please take a look at my previous article on <a target="_blank" href="https://notebookbft.wordpress.com/2019/03/17/how-to-decrypt-an-as2-message-smime-with-openssl/">decrypting AS2 message with OpenSSL</a>.</p>
<h4 id="heading-downloading-raw-message-and-transport-headers">Downloading RAW Message and Transport Headers</h4>
<p>Once we have received an AS2 message, we can see the received message in the <strong>inbox view</strong> in AS2Gateway as shown below.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/7k7b4aSuzNZ8eN109UJUbmhT8bG4ec36uC-n" alt="Image" width="800" height="179" loading="lazy"></p>
<p>Then we can click on the message subject (in this case it is “Sample Signed Message”) to go to the <strong>detailed view</strong> of the received message as shown below.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/WqWJsiJo0MDxa9ptSkvvPAxyyacdrRLnmeHt" alt="Image" width="800" height="301" loading="lazy"></p>
<p>Now you can click on the <strong>“Raw Message”</strong> button and the <strong>“Download Transport Headers”</strong> button to download the unprocessed AS2 message payload and transport headers we received from the partner respectively. The raw message will be download to a file with name <em>message.raw</em> and the transport headers will be downloaded to a file with name <em>headers.raw</em>.</p>
<h4 id="heading-getting-the-senders-public-key">Getting the Sender’s Public Key</h4>
<p>Now that we have the raw message and transport headers, what we need next is the sender’s public key. We can directly download it by clicking the <strong>PEM</strong> (purple) button from the certificates view (shown below) in the AS2Gateway.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/uqKUE36b9ic7TzzfBY1YrZArVk5KZVVXcL8P" alt="Image" width="800" height="261" loading="lazy"></p>
<p>Before we proceed with the next steps, let’s make sure we have everything we need in place.</p>
<ul>
<li>Raw message (message.raw)</li>
<li>Transport headers (headers.raw)</li>
<li>Sender’s public key (cert.pem)</li>
</ul>
<h4 id="heading-analyzing-the-http-transport-headers">Analyzing the HTTP Transport Headers</h4>
<p>Let’s first take a look at the transport headers before we proceed.</p>
<p>As you can see, there are a bunch of headers. Let us focus only on a couple of important ones in the context of verifying the signature of the AS2 message.</p>
<ul>
<li>The <strong>content-type</strong> header suggests that we have a <strong>multi-part signed</strong> payload in the outer most layer and further it tells us that the <strong>multi-part boundary</strong> is denoted by the string “ — -=_Part_1_1702144111.1552838995900” for this AS2 message.</li>
<li>We also have the <strong>mime-version</strong> to be 1.0</li>
</ul>
<p>If you are interested in knowing more in-depth details, the best place to start would be the <a target="_blank" href="https://www.ietf.org/rfc/rfc4130.txt">AS2 RFC 4130</a>.</p>
<h4 id="heading-analyzing-the-raw-message">Analyzing the Raw Message</h4>
<p>Now, let us look at the raw message (message.raw). As per the content type transport header, we already know that the payload is a multi-part signed one. We can see it below. There you see two parts (separated by the multi-part boundary string as stated in the content-type transport header). One with the original payload (we see the payload in plain text since we did not encrypt or compress the payload for this demonstration). The other with the signature (<strong>application/pkcs7-signature</strong>).</p>
<h4 id="heading-adding-required-headers">Adding Required Headers</h4>
<p>Do you remember that we talked about a few important transport headers when we are looking at the transport headers? Now is the time to use them. We need to add those headers to our message.raw file so that the final output would be as follows. (Let’s take the new file as <strong>message_with_headers.raw</strong>) Note that the white space between the HTTP transport headers and the multi-part signed payload is intentional.</p>
<h3 id="heading-verifying-the-signature">Verifying the Signature…</h3>
<p>It’s time to run the decryption command. Here we use the <strong>‘smime’</strong> tool by OpenSSL.</p>
<pre><code>openssl smime -verify -noverify -<span class="hljs-keyword">in</span> message_with_headers.raw -signer cert.pem -out verified_payload.txt
</code></pre><p>Once you run the command you should get a message saying <strong>“Verification successful”</strong>. The verified payload would be in the file verified_payload.txt. Note that in this case, we will get the payload mime part as the output which would look something as follows.</p>
<p>Just for completion, let me add a note on an error I got while trying this. For me, the cause for this error was a mismatch in the multi-part boundary string in the content-type header with actual multi-part boundary string. Note that there are <strong>two preceding ‘-‘s</strong> when the multi-part boundary is used in a multi-part SMIME payload.</p>
<pre><code><span class="hljs-built_in">Error</span> reading S/MIME message <span class="hljs-number">4719224428</span>:error:<span class="hljs-number">0</span>DFFF0D2:asn1 encoding routines:CRYPTO_internal:no multipart body failure:<span class="hljs-regexp">/BuildRoot/</span>Library/Caches/com.apple.xbs/Sources/libressl/libressl<span class="hljs-number">-22.240</span><span class="hljs-number">.1</span>/libressl<span class="hljs-number">-2.6</span>/crypto/asn1/asn_mime.c:<span class="hljs-number">464</span>:
</code></pre><p>Further note that we have used the parameter <strong>‘-noverify’</strong> in the signature verification command. This is because the certificates we have used in this demo are self-signed certificates. If the ‘noverify’ param is not used, OpenSSL will try to verify the certificate first and will fail giving an error similar to following.</p>
<pre><code>Verification failure <span class="hljs-number">4567594604</span>:error:<span class="hljs-number">21</span>FFF075:PKCS7 routines:func(<span class="hljs-number">4095</span>):certificate verify error:<span class="hljs-regexp">/BuildRoot/</span>Library/Caches/com.apple.xbs/Sources/libressl/libressl<span class="hljs-number">-22.240</span><span class="hljs-number">.1</span>/libressl<span class="hljs-number">-2.6</span>/crypto/pkcs7/pk7_smime.c:<span class="hljs-number">340</span>:Verify error:self signed certificate
</code></pre><p>Cool. Signature verification is done and dusted. Even though we’ve looked at doing the signature verification entirely using command line tools in this article, this can be done using a few lines on Java code as well. I hope to cover it in a future article.</p>
<h3 id="heading-bonus-pack">Bonus Pack</h3>
<p>Before signing off, I would like to share some bonus details which would help you identify the cause for certain signature verification failure scenarios. The first one is on how to find out the signature algorithm used.</p>
<h4 id="heading-finding-out-the-signature-algorithm-used">Finding out the Signature Algorithm Used</h4>
<p>In order to find the signature algorithm used, we can use the <strong>asn1parse</strong> tool by OpenSSL. First, we need to separate out the signature part without the mime headers to a separate file as follows. Let’s call this file <strong>signature.raw</strong></p>
<p>Now, we can run the following command to get the asn1parse output.</p>
<pre><code>openssl asn1parse -i -<span class="hljs-keyword">in</span> signature.raw
</code></pre><p>The output would be as follows. If you can see below, the outer most part has type <strong>pkcs7-signedData,</strong> and after four or five lines we see <strong>sha1</strong> which is the signature algorithm used.</p>
<h4 id="heading-more-details-from-the-asn1parse-output">More Details from the asn1parse Output</h4>
<p>There are a few more details we can see and understand from the asn1parse output. Optionally when signing, the signing certificates are attached to the signature itself. That is what you see starting from the <strong>pkcs7-data</strong> section. The <strong>“INTEGER : 438EFDF3”</strong> is the signing cert serial number. You can also see the validation period of the certificate as shown below.</p>
<p><strong>258:d=7 hl=2 l= 13 prim: UTCTIME :051201134315Z</strong><br><strong>273:d=7 hl=2 l= 13 prim: UTCTIME :190810134315Z</strong></p>
<blockquote>
<p><em>Sending agents MUST encode signing time through the year 2049 as UTCTime. Signing times in 2050 or later MUST be encoded as GeneralizedTime. Agents MUST interpret the year field (YY) as follows: if YY is greater than or equal to 50, the year is interpreted as 19YY; if YY is less than 50, the year is interpreted as 20YY.</em></p>
<p><em>Regarding UTCTime from RFC 2311 — <a target="_blank" href="https://tools.ietf.org/html/rfc2311">https://tools.ietf.org/html/rfc2311</a></em></p>
</blockquote>
<p>In this case, the period which the certificate is valid is from UTC 2005/12/01 13:43:15 to 2019/08/10 13:43:15.</p>
<p>We also have the signing time at <strong>signingTime</strong> attribute as 190317161000Z which is UTC 2019/03/17 16:10:00. Note that during signature validation, in addition to the content hash matching, another check will be made to see if the signature was when the certificate was current. Basically, at the time of the signing, the certificate should be valid.</p>
<p>With some more knowledge in ASN.1 structure, we should be able to gain a lot more information from this. It’s time for me to sign off. Cheers! ?</p>
<h3 id="heading-call-to-action">Call To Action</h3>
<ul>
<li><strong>Clap.</strong> Appreciate and let others find this article.</li>
<li><strong>Comment.</strong> Share your views on this article.</li>
<li><strong>Follow me.</strong> <a target="_blank" href="https://medium.com/@rajindruparathna">Rajind Ruparathna</a> to receive updates on articles like this.</li>
<li><strong>Keep in touch.</strong> <a target="_blank" href="http://lk.linkedin.com/in/rajind">LinkedIn</a>, <a target="_blank" href="https://twitter.com/rajindrj">Twitter</a></li>
</ul>
<p><em>Originally published at <a target="_blank" href="https://notebookbft.wordpress.com/2019/03/19/how-to-verify-as2-message-smime-signature-with-openssl/">notebookbft.wordpress.com</a> on March 19, 2019.</em></p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to decrypt an AS2 message (SMIME) with OpenSSL ]]>
                </title>
                <description>
                    <![CDATA[ By Rajind Ruparathna I have been involved in the AdroitLogic AS2Gateway, a SaaS B2B AS2 messaging platform for almost two years now. One of the common issues we see in the users who are getting started with AS2 is decryption failure. In this blog pos... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-decrypt-an-as2-message-smime-with-openssl-d47fda5fd7db/</link>
                <guid isPermaLink="false">66c3516dd73001a6c0054bfd</guid>
                
                    <category>
                        <![CDATA[ b2b ]]>
                    </category>
                
                    <category>
                        <![CDATA[ openssl ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Security ]]>
                    </category>
                
                    <category>
                        <![CDATA[ tech  ]]>
                    </category>
                
                    <category>
                        <![CDATA[ technology ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Sun, 17 Mar 2019 08:33:15 +0000</pubDate>
                <media:content url="https://cdn-media-1.freecodecamp.org/images/1*mxwl0_gdFfhnpXeh8RozCA.jpeg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Rajind Ruparathna</p>
<p>I have been involved in the <a target="_blank" href="http://as2gateway.com/">AdroitLogic AS2Gateway</a>, a SaaS B2B AS2 messaging platform for almost two years now. One of the common issues we see in the users who are getting started with AS2 is decryption failure. In this blog post, we will look at what encryption and decryption are in AS2 protocol. We will cover how to decrypt an AS2 message and some tips on figuring out the cause for certain decryption failures.</p>
<h3 id="heading-encryption-in-as2-protocol">Encryption in AS2 Protocol</h3>
<p>AS2 protocol basically uses <strong>Public-key cryptography</strong> or <strong>asymmetric cryptography</strong> for encryption. There, the receiver’s public key is used for encryption and receiver’s private key is used for decryption as shown below.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*ldcGxyCd6CjjIYhokAZHzg.png" alt="Image" width="528" height="171" loading="lazy"></p>
<p>Assuming the receiver’s private key has not been compromised, encrypting data and messages offers the following security benefits.</p>
<ul>
<li><strong>Confidentiality</strong> — Ensures that only the intended recipient can decrypt and view the contents, that is the content is encrypted with the recipient’s public key. Hence it can only be decrypted with the receiver’s private key.</li>
<li><strong>Data Integrity</strong> — Determine whether the file or data the receiver got was altered along the way. Part of the decryption process involves verifying that the contents of the original encrypted message and the new decrypted contents match. The slightest change to the original content would cause the decryption process to fail.</li>
</ul>
<h3 id="heading-lets-get-to-work">Let’s get to work!</h3>
<p>For demonstration purposes, we will be using an incoming AS2 message to the AS2Gateway. Since we are only focusing on decryption in this blog post, the incoming AS2 message is not signed or compressed.</p>
<h4 id="heading-downloading-raw-message-and-transport-headers">Downloading Raw Message and Transport Headers</h4>
<p>Once we have received an AS2 message, we can see the received message in the <strong>inbox view</strong> in AS2Gateway as shown below.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*m_BskqHI_adR8UYuRgVmhA.png" alt="Image" width="800" height="180" loading="lazy"></p>
<p>Then we can click on the message subject (in this case it is “Sample Encrypted Message”) to go to the <strong>detailed view</strong> of the received message as shown below.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*NZL6lkKno6oIwoaCdI33QA.png" alt="Image" width="800" height="310" loading="lazy"></p>
<p>Now you can click on the <strong>“Raw Message”</strong> button and <strong>“Download Transport Headers”</strong> button to download the unprocessed AS2 message payload and transport headers we received from the partner, respectively. The raw message will be download to a file with name message.raw. The transport headers will be downloaded to a file with name headers.raw.</p>
<h4 id="heading-getting-the-receivers-public-and-private-key">Getting the Receiver’s Public and Private Key</h4>
<p>Now that we have the raw message and transport headers, we need the receiver’s public and private keys. As for the public key, you can directly download it by clicking the <strong>PEM</strong> (purple) button from the certificates view (shown below) in the AS2Gateway. For the private key, you will have to first download the JKS (identity.jks). You do this by clicking on the <strong>JKS</strong> (red) button from the certificates view and extract the private key from the JKS. Check out my <a target="_blank" href="https://notebookbft.wordpress.com/2019/01/10/extracting-private-key-from-java-keystore-jks/">step by step guide</a> on extracting private key from JKS for more details.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*jlG2mJOTDZSqX11Wueixjg.png" alt="Image" width="800" height="261" loading="lazy"></p>
<p>Note that you’ll need the key password and key store password when extracting the private key. If you do not remember them you can view more details on the certificate by clicking on the <strong>common name</strong> (in this case the common name on the relevant AS2 Station for this demonstration is “RJ_LOCAL”). From there you should be able to find the relevant passwords.</p>
<p>Before we proceed with the next steps, let’s make sure we have everything we need in place.</p>
<ul>
<li>Raw message (message.raw)</li>
<li>Transport headers (headers.raw)</li>
<li>Receiver’s private key (private_key.pem)</li>
<li>Receiver’s public key (cert.pem)</li>
</ul>
<h4 id="heading-analyzing-the-http-transport-headers">Analyzing the HTTP Transport Headers</h4>
<p>Let’s first take a look at the transport headers before we proceed.</p>
<p>As you can see, there are a bunch of headers and thus let us only focus on a couple of important ones in the context of decrypting the AS2 message.</p>
<ul>
<li>The <strong>content-type</strong> header suggests that we have an encrypted payload in the outer most layer.</li>
<li>The <strong>content-disposition</strong> header gives away the file name of the payload to be test_message.txt.</li>
<li>We also have the <strong>mime-version</strong> to be 1.0</li>
</ul>
<p>If you are interested in knowing more in-depth details the best place to start would be the <a target="_blank" href="https://www.ietf.org/rfc/rfc4130.txt">AS2 RFC 4130</a>.</p>
<p>So now, we know that the payload is encrypted (which should be the case since that is the type we selected for this demo). We know that the file name is test_message.txt. Great. Now we have almost everything we need to perform the decryption. Few more steps to go.</p>
<h4 id="heading-encoding-raw-message-in-base64">Encoding Raw Message in Base64</h4>
<p>Since we are working with an encrypted raw message here, it is always better to convert it to base64 so that we can safely play with it using text editors. Of course one can and should be able to proceed without converting it to base64 as well. I prefer to convert the raw message to base64 for convenience in the next steps. Let’s run the below command (here we use the <strong>‘base64’ command line tool</strong> ) to covert the raw message to base64. Note that it is very important to have the parameter ‘–break=64’ which breaks the base64 output to lines with 64 characters or else you might run into an error during decryption.</p>
<pre><code>base64 message.raw --<span class="hljs-keyword">break</span>=<span class="hljs-number">64</span> &gt; base64_message.raw
</code></pre><p>From now on, we will be working on following the base64_message.raw file.</p>
<h4 id="heading-adding-required-headers">Adding Required Headers</h4>
<p>Do you remember that we talked about a few important transport headers when we looking at the transport headers? Now is the time to use them. We need to add those headers to our base64_message.raw file so that the final output would be as follows. (Let’s take the new file as <strong>base64_message_with_headers.raw</strong>). Note that the white space between the headers and the base64 encoded payload is intentional. You might notice that in addition to the headers we talked about earlier, we have added <strong>‘content-transfer-encoding: base64’</strong> to denote that content is in base64.</p>
<h3 id="heading-decrypting">Decrypting…</h3>
<p>It’s time to run the decryption command. Here we use the <strong>‘smime’</strong> tool by OpenSSL.</p>
<pre><code>openssl smime -decrypt -<span class="hljs-keyword">in</span> base64_message_with_headers.raw -recip cert.pem -inkey private_key.pem &gt;&gt; test_message.txt
</code></pre><p>Once you run the command you should have the output in the test_message.txt file. Note that in this case, we will get the plain text output since we used a payload without compression and signing.</p>
<pre><code>This is a test message <span class="hljs-keyword">for</span> the demonstration <span class="hljs-keyword">of</span> AS2 decryption by OpenSSL.
</code></pre><p>As I stated before, if the base64 output is not split into lines with 64 characters, you may get an error similar to the following. I thought of adding that for completeness so that whoever else faces that issue may find the solution here.</p>
<p>That concludes the steps on decrypting the payload. Even though we’ve looked at doing the decryption entirely using command line tools in this article, this can be done using a few lines of Java code as well. I hope to cover it in a future article.</p>
<h3 id="heading-bonus-pack">Bonus Pack</h3>
<p>Before signing off, I would like to share some bonus details will would help you identify the cause for certain decryption failure scenarios. The first one is on how to find out the encryption algorithm used.</p>
<h4 id="heading-finding-out-the-encryption-algorithm-used">Finding out the Encryption Algorithm Used</h4>
<p>In order to find the encryption algorithm used, we can use the <strong>asn1parse</strong> tool by OpenSSL. Let us run the following command to get the asn1parse output. (Note that if you run the command without the ‘-inform der’ parameter you might get an error as ‘Error: offset too large’)</p>
<pre><code>openssl asn1parse -inform der -<span class="hljs-keyword">in</span> message.raw
</code></pre><p>The output would be as follows. If you can see below, there are roughly two main parts shown here in <a target="_blank" href="https://en.wikipedia.org/wiki/Abstract_Syntax_Notation_One">ASN.1 notation</a> as <strong>pkcs7-envelopedData</strong> part and <strong>pkcs7-data</strong> part. In pkcs7-data part, we have <strong>‘des-ede3-cbc’</strong> which is the encryption algorithm used.</p>
<h4 id="heading-finding-out-the-public-key-used-for-encryption">Finding out the Public Key Used for Encryption</h4>
<p>The bonus package is not done yet ;-). Sometimes it is important to figure out the certificate used in encryption to make sure if the sender has used the correct public key of the recipient. If you look at the <strong>asn1parse output</strong> above, you should see that we have <strong>commonName</strong>, <strong>organizationName</strong> etc in <strong>pkcs7-envelopedData</strong> section. These are the details on the certificate used to encrypt the AS2 payload.</p>
<p>Now after the <strong>countryName</strong> entry, you might see a line as follows.</p>
<p><strong>122:d=9 hl=2 l= 4 prim: PRINTABLESTRING :None</strong><br><strong>128:d=6 hl=2 l= 6 prim: INTEGER :01627AE13D2D</strong></p>
<p>This is the certificate serial in hex and with this, you can verify if the correct public has been used during the encryption.</p>
<p>That concludes the bonus pack. May all your AS2 decryption failures go away. ?</p>
<h3 id="heading-call-to-action">Call To Action</h3>
<ul>
<li><strong>Clap.</strong> Appreciate and let others find this article.</li>
<li><strong>Comment.</strong> Share your views on this article.</li>
<li><strong>Follow me.</strong> <a target="_blank" href="https://medium.com/@rajindruparathna">Rajind Ruparathna</a> to receive updates on articles like this.</li>
<li><strong>Keep in touch.</strong> <a target="_blank" href="http://lk.linkedin.com/in/rajind">LinkedIn</a>, <a target="_blank" href="https://twitter.com/rajindrj">Twitter</a></li>
</ul>
<p><em>Originally published at <a target="_blank" href="https://notebookbft.wordpress.com/2019/03/17/how-to-decrypt-an-as2-message-smime-with-openssl/">notebookbft.wordpress.com</a> on March 17, 2019.</em></p>
 ]]>
                </content:encoded>
            </item>
        
    </channel>
</rss>
