public void Run() { int type = 2; XmlDocument doc = null; SignedMortalityReasonType smrt = null; bool useSTS = true; // url: http://pan.certifikat.dk/sts/ /* if(type==0) * { * smrt = CreateInstancePart1(); * doc = SignParts(smrt, true, false, GetMOCESCertificate()); * } * else if(type==1) * { * smrt = CreateInstancePart2(); * doc = SignParts(smrt, false, true, GetMOCESCertificate()); * } * else if (type == 2) * { * smrt = CreateInstancePart1AndPart2ForSameCertificate(); * doc = SignParts(smrt, true, true, GetMOCESCertificate()); * } * else if (type == 3) * { * smrt = CreateInstancePart1AndPart2ForDifferentCertificates(); * doc = SignParts(smrt, true, false, GetSKSMOCESCertificate()); * smrt = (SignedMortalityReasonType)Deserialize(doc.OuterXml, smrt.GetType()); * doc = SignParts(smrt, false, true, GetMOCESCertificate()); * } * //doc.Save(OutFileName); * * // Standard verifier * //bool bOK = VerifyDetachedSignature(OutFileName); * * smrt = (SignedMortalityReasonType)Deserialize(doc.OuterXml, smrt.GetType()); */ try { if (useSTS) { AxisStsFacadeService sts = new AxisStsFacadeService(); sts.SetPolicy(new DGWSPolicy(GetSKSMOCESCertificate(), GetSKSVOCESCertificate(), true)); Object o = sts.issueIdCard(null); int g = 5; } MortalityRegistrationService service = new MortalityRegistrationService(); service.SetPolicy(new DGWSPolicy(GetMOCESCertificate(), GetSKSVOCESCertificate(), false)); bool b = service.Report(smrt); // bool b = service.RemoveReport("{B460D543-4627-4FEE-A310-367151256F32}"); System.Diagnostics.Debug.WriteLine(b); } catch (Exception e) { Console.Out.Write(e.ToString()); System.Diagnostics.Debug.WriteLine(e.ToString()); } }
static void Main(string[] args) { try { bool useSTS = true; // X509Certificate2 MOCESCert = GetMOCESCertificate(); // X509Certificate2 VOCESCert = GetVOCESCertificate(); X509Certificate2 MOCESCert = GetSTSMOCESCertificate(); X509Certificate2 VOCESCert = GetSTSVOCESCertificate(); DGWSCard10Type card; if (useSTS) { DGWSCard101Type idCard = GetIDCardVersion101(); idCard.Sign(MOCESCert); // DGWSCard101Type idCard = GetSystemIDCardVersion101(); // idCard.Sign(VOCESCert); XElement x = IDP.CallIdp(idCard, "SEI", "http://pan.certifikat.dk/sts/services/SecurityTokenService"); card = new DGWSCard101Type(x); } else { // card = GetIDCardVersion101(); // card = GetIDCardVersion11(); card = GetSystemIDCardVersion101(); // card.Sign(MOCESCert); card.Sign(VOCESCert); } MortalityRegistrationService service = new MortalityRegistrationService(); service.SetPolicy(new DGWSPolicy(card, VOCESCert)); // service.SetPolicy(new DGWSPolicy(card, MOCESCert)); MortalityReasonType mort = Helper.CreateTestDocument_Part1And2(); // MortalityReasonType mort = Helper.CreateTestDocument_Part1(); String s = service.Report(mort); System.Diagnostics.Debug.WriteLine(s); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } }