コード例 #1
0
        public string SignDocument(string xml)
        {
            var doc = new SignedXmlDocument(xml);

            CrytoProvider.SignDocument(doc);
            var cdata = new XCData(doc.ToString());

            return(cdata.ToString());
        }
コード例 #2
0
        //public string SignXml(string xml)
        //{
        //  return xml;
        //}

        //public CDataWrapper Sign(CDataWrapper request)
        //{
        //  return new CDataWrapper() { Value = request.Value };
        //}

        public ResponseMessage SignXml(RequestMessage xml)
        {
            try
            {
                var doc = new SignedXmlDocument(xml.Xml.Value);
                CrytoProvider.SignDocument(doc);
                return(new ResponseMessage()
                {
                    Xml = doc.ToString()
                });
            }
            catch (Exception exception)
            {
                ErrorMessage += exception.Message + "\n" + exception.StackTrace;
            }
            return(new ResponseMessage {
                Xml = null, Error = ErrorMessage
            });
        }
コード例 #3
0
 static void Main(string[] args)
 {
     try
     {
         if (args.Length > 1)
         {
             var provider = new VipNetCrytoProvider(args[0], args[1]);
             var xml      = "";
             using (var file = File.OpenText("input.txt"))
             {
                 xml = file.ReadToEnd();
             }
             var doc = new SignedXmlDocument(xml);
             provider.SignDocument(doc);
             Console.WriteLine(doc.ToString());
         }
     }
     catch (Exception exc)
     {
         Console.WriteLine(exc.Message);
         Console.ReadKey();
         //throw;
     }
 }