Invalid length - Digital Signature - Convert From Base64
<p>I am implementing a digital signature and its verification between two of my applications. I am using C#/WCF to do this (sender). I use the below code to generate the signature.</p>

<pre><code>string signature = Convert.ToBase64String(encryptingkey.SignHash(hash, CryptoConfig.MapNameToOID("SHA1")));
</code></pre>

<p>The below code is used in my second application (receiver) to generate the byte array for validation.</p>

<pre><code>byte[] signatureByte = Convert.FromBase64String(signature);
</code></pre>

<p>This works fine when I have both the applications running on my local machine. However, when I deploy the second application to the server, I get the below error where I have the above statement Convert.FromBase64String(signature):</p>

<blockquote>
  <p>Invalid length for a Base-64 char array or string.</p>
</blockquote>

<p>I have the same certificate installed on my server and in my localmachine.</p>

<p>The sending application is a WCF service, and the receiving application is an ASP.NET MVC web application. I am posting the signature and some additional information to one of its controllers.</p>