Example #1
0
        public void EncryptedMsgWithConfigViaConfig()
        {
            X509Store my = new X509Store(StoreName.My, StoreLocation.CurrentUser);

            my.Open(OpenFlags.OpenExistingOnly | OpenFlags.ReadOnly);
            X509Certificate2Collection found = my.Certificates.Find(X509FindType.FindByThumbprint, "9c4227f1b9c7a52823829837f1a2e80690da8010", false);

            EBirthPostMaster pm = new EBirthPostMaster(
                SecurityInfo.CreateSendOnly(found[0]),
                new TTPPortTypeClient("notification"),
                new EtkDepotPortTypeClient("etk"));

            pm.VerifyEtk = false; //better to use it only for testing

            List <Recipient> recipients = new List <Recipient>();

            recipients.Add(new KnownRecipient("CBE", "0367302178", "EBIRTHTEST"));

            Object response = pm.TransferAndEncryptOnly(new FileStream("notification_kmehr.xml", FileMode.Open, FileAccess.Read), null, new ReadOnlyCollection <Recipient>(recipients));
        }
Example #2
0
        public void EncryptedMsgWithConfigViaConfig()
        {
            X509Store my = new X509Store(StoreName.My, StoreLocation.CurrentUser);

            my.Open(OpenFlags.OpenExistingOnly | OpenFlags.ReadOnly);
            X509Certificate2Collection found = my.Certificates.Find(X509FindType.FindByThumbprint, "9c4227f1b9c7a52823829837f1a2e80690da8010", false);

            NewsPostMaster pm = new NewsPostMaster(
                SecurityInfo.CreateSendOnly(found[0]),
                new ehBoxPublicationPortTypeClient("Publish"),
                new ehBoxConsultationPortTypeClient("Consult"),
                new EtkDepotPortTypeClient("etk"));
            //pm.VerifyEtk = false; //better to use it only for testing

            List <Recipient> recipients = new List <Recipient>();

            recipients.Add(new EhBoxRecipient("CBE", "0820563481", "INSTITUTION", "MyCareNet"));

            pm.Title = "eH-I supports ehBox";
            String responseId = (String)pm.TransferAndEncryptOnly(new MemoryStream(Encoding.UTF8.GetBytes("The eH-I library now support publication of encrypted messages to the ehBox")), null, new ReadOnlyCollection <Recipient>(recipients));

            Assert.IsFalse(String.IsNullOrWhiteSpace(responseId));
        }