title: Signing an Xml Document using RSA-SHA256 signature method issue
body: <p>I am using the method below to sign Xml Documents:</p>
  
  <pre><code>public static XmlDocument SignDocument(XmlDocument doc)
      {
          string signatureCanonicalizationMethod = "http://www.w3.org/2001/10/xml-exc-c14n#";
          string signatureMethod = @"http://www.w3.org/2001/04/xmldsig-more#rsa-sha256";
          string digestMethod = @"http://www.w3.org/2001/04/xmlenc#sha256";
  
          string signatureReferenceURI = "#_73e63a41-156d-4fda-a26c-8d79dcade713";
  
          CryptoConfig.AddAlgorithm(typeof(RSAPKCS1SHA256SignatureDescription), signatureMethod);
  
          var signingCertificate = GetCertificate();
  
          SignedXml signer = new SignedXml(doc);
          signer.SigningKey = signingCertificate.PrivateKey;
          signer.KeyInfo = new KeyInfo();
          signer.KeyInfo.AddClause(new KeyInfoX509Data(signingCertificate));
  
          signer.SignedInfo.CanonicalizationMethod = signatureCanonicalizationMethod;
          signer.SignedInfo.SignatureMethod = signatureMethod;
  
          XmlDsigEnvelopedSignatureTransform envelopeTransform = new XmlDsigEnvelopedSignatureTransform();
          XmlDsigExcC14NTransform cn14Transform = new XmlDsigExcC14NTransform();
  
          Reference signatureReference = new Reference();
          signatureReference.Uri = signatureReferenceURI;
          signatureReference.AddTransform(envelopeTransform);
          signatureReference.AddTransform(cn14Transform);
          signatureReference.DigestMethod = digestMethod;
  
          signer.AddReference(signatureReference);
  
          signer.ComputeSignature();
          XmlElement signatureElement = signer.GetXml();
  
          doc.DocumentElement.AppendChild(signer.GetXml());
  
          return doc;
      }
  
  
          private static X509Certificate2 GetCertificate()
      {
  
          X509Store store = new X509Store(StoreName.My, StoreLocation.LocalMachine);
          store.Open(OpenFlags.ReadOnly);
          X509Certificate2 card = null;
          foreach (X509Certificate2 cert in store.Certificates)
          {
              if (!cert.HasPrivateKey) continue;
  
              if (cert.Thumbprint.Equals("a_certain_thumb_print", StringComparison.OrdinalIgnoreCase))
              {
                  card = cert;
                  break;
              }
          }
          store.Close();
  
          return card;
      }
  </code></pre>
  
  <p>An exception of type System.Security.Cryptography.CryptographicException is thrown when trying to compute the signature with the error message <strong>Invalid algorithm specified</strong>. Any ideas?</p>
  
  <p>Machine: Windows Server 2008 R2</p>
  
  <p>.Net Framework: 4.0.</p>
  
  <p>IDE: Visual Studio 2010.</p>