我希望“xml签名与x509 sha256”但这个代码只给签名(byte [])ı想签名xmldocument用这个x509请帮帮我
XmlDocument docc = new XmlDocument();
docc.Load("C:\\Users\\bera\\Desktop\\Sertifika\\aa.xml");
X509Store storeMyCurrentUser = new X509Store(StoreName.My, StoreLocation.CurrentUser);
storeMyCurrentUser.Open(OpenFlags.MaxAllowed);
X509Certificate2 certRCA = new X509Certificate2("C:\\Users\\bera\\Desktop\\RCA.p12", "0123456789");
if (!storeMyCurrentUser.Certificates.Contains(certRCA))
storeMyCurrentUser.Add(certRCA);
RSACryptoServiceProvider _provider = null;
//doc.OuterXml
byte[] data = Encoding.Default.GetBytes(doc.OuterXml);
if (certRCA.HasPrivateKey)
{
_provider = (RSACryptoServiceProvider)certRCA.PrivateKey;
byte[] sigedBytes = _provider.SignData(data, "SHA256");
string a= System.Text.Encoding.ASCII.GetString(sigedBytes);
Console.WriteLine(a);