It seems to me that you are using the publik key incorrectly. First, check if the LicenceVerifier.PubKey.xml file is installed with the Build Action setting for the embedded resource.
Then run this code in debugging:
typeof(Program).Assembly.GetManifestResourceNames()
, GetManifestResourceStream. , :
var asm = typeof(Program).Assembly;
s = asm.GetManifestResourceStream(asm.GetName().Name + ".LicenceVerifier.PubKey.xml");
, :
var subFolder = "NAME";
var asm = typeof(Program).Assembly;
s = asm.GetManifestResourceStream(asm.GetName().Name + "." + subFolder + ".LicenceVerifier.PubKey.xml");
, , . :
private static string SignXml(XmlDocument xmlDoc)
{
...
return csp.ToXmlString(false);
}
public static Boolean VerifyXml(XmlDocument doc, string xmlKey)
{
RSACryptoServiceProvider csp = new RSACryptoServiceProvider();
csp.FromXmlString(xmlKey);
...
}
var xmlKey = SignXml(xml);
var res = VerifyXml(xml, xmlKey);
, LicenceVerifier.PubKey.xml xml, SignXml.