Hi Team,
I am trying to create and verify signature using DSA algo. where in return result = false and I am getting a error in the below part of code.
ERROR: value cannot be null parameter value: value
CODE:
public bool CheckSignature(string signedxmldata)
{
Console.WriteLine("Verifying ");
bool result = false;
XmlDocument objDSAKeyPairXMLdocument = new XmlDocument();
objDSAKeyPairXMLdocument.Load("C:/Users/sowmya_sirsi/XMLSignatureDSAPublicKey.xml");
string strDSAKeyPairXML = objDSAKeyPairXMLdocument.InnerXml;
// Create a SignedXml.
SignedXml signedXml = new SignedXml();
//// Uncomment these lines if you intend to comment KeyInfo in the previous function
DSA objDSAkeyPair = DSA.Create();
objDSAkeyPair.FromXmlString(strDSAKeyPairXML);
KeyInfo keyInfo = new KeyInfo();
keyInfo.AddClause(new DSAKeyValue(objDSAkeyPair));
signedXml.KeyInfo = keyInfo;
// Load the XML.
XmlDocument xmlDocument = new XmlDocument();
xmlDocument.LoadXml(signedxmldata);
xmlDocument.PreserveWhitespace = true;
try
{
XmlNodeList nodeList = xmlDocument.GetElementsByTagName("Signature");
string Short_Fall = string.Empty;
foreach (XmlNode node in nodeList)
{
Short_Fall = node.InnerText;
}
string respass = "Shree";
string bankpass = "";
signedXml.LoadXml((XmlElement)nodeList[0]);
if (signedXml.CheckSignature())
{
result = true;
Console.WriteLine("Signature check OK");
}
else
{
Console.WriteLine("Signature check FAILED");
}
}
catch(Exception e)
{
Console.WriteLine("Exception..." + e.Message); // value cannot be null parameter value: value
}
return result;
}
Can anyone please suggest me where am I going wrong?
Thanks