title: Hash X509 certificate with SHA 256 in c#
body: <p>I work on an EBICS implementation in C# and I need to send to my bank the hash of my three certificates in <strong>SHA256 format</strong> in order to enable EBICS link with it. </p>
  
  <p>I generated them in C# with BouncyCastle and now I have a <code>X509Certificate2</code> object. </p>
  
  <p>So to hash my certificate I used the following code : </p>
  
  <pre><code>String HashCertificate = Certificat.GetCertHashString();
  </code></pre>
  
  <p>And he return me the following result : </p>
  
  <blockquote>
    <p>21952A5F79CA3232A656794EE4532BECF5AE3960</p>
  </blockquote>
  
  <p>But the length don't match with the lenght of the hash of the bank certificate : </p>
  
  <blockquote>
    <p>57436AD3D09989ED74F4FCCDBF7668C43F8BF87C933F90B065ED442A22E5B0BF</p>
  </blockquote>
  
  <p>So I think the <code>GetCertHashString()</code> function return the hash of the certificate in <strong>SHA1</strong> format and I have no idea how I can hash it in <strong>SHA256</strong>. </p>
  
  <p>Can you help me please ? </p>
  
  <p>Thank you in advance</p>