Exemple #1
0
        IDataSealer Create(Level level, EHealthP12 p12)
        {
            if ((level & Level.T_Level) == Level.T_Level)
            {
                throw new NotSupportedException("This method can't create timestamps");
            }

            X509Certificate2 cert = p12["authentication"];

            return(new TripleWrapper(
#if !NETFRAMEWORK
                       _loggerFactory,
#endif
                       level, cert, cert, null, p12.ToCollection()));
        }
Exemple #2
0
        IDataSealer CreateForTimemarkAuthority(Level level, EHealthP12 p12)
        {
            if ((level & Level.T_Level) != Level.T_Level)
            {
                throw new ArgumentException("This method should for a level that requires time marking");
            }

            X509Certificate2 cert = p12["authentication"];

            return(new TripleWrapper(
#if !NETFRAMEWORK
                       _loggerFactory,
#endif
                       level, cert, cert, null, p12.ToCollection()));
        }
Exemple #3
0
        public XadesTest()
        {
            var ehP12 = new EHealthP12(@"data\MYCARENET.p12", File.ReadAllText(@"data\MYCARENET.pwd"));

            auth       = ehP12["authentication"];
            sign       = ehP12["authentication"];
            extraCerts = ehP12.ToCollection();

            //load test document as xml
            document = new XmlDocument();
            document.PreserveWhitespace = true;
            document.Load(@"data\document.xml");


            //create the tsa
            tsa = new TimeStampAuthorityClient(new StsBinding(), new EndpointAddress("https://services-acpt.ehealth.fgov.be/TimestampAuthority/v2"));
            tsa.ClientCredentials.ClientCertificate.Certificate = auth;
        }
Exemple #4
0
        IDataSealer Create(Level level, ITimestampProvider timestampProvider, EHealthP12 p12)
        {
            if (timestampProvider == null)
            {
                throw new ArgumentNullException("timestampProvider", "A time-stamp provider is required with this method");
            }
            if ((level & Level.T_Level) != Level.T_Level)
            {
                throw new ArgumentException("This method should for a level that requires time stamping");
            }

            X509Certificate2 cert = p12["authentication"];

            return(new TripleWrapper(
#if !NETFRAMEWORK
                       _loggerFactory,
#endif
                       level, cert, cert, timestampProvider, p12.ToCollection()));
        }
Exemple #5
0
        public void ToCollection()
        {
            X509Certificate2Collection collection = p12.ToCollection();

            Assert.AreEqual(5, collection.Count);
        }
        public static IDataSealer CreateForTimemarkAuthority(Level level, EHealthP12 p12)
        {
            ValidateCertificates(p12["authentication"]);
            if ((level & Level.T_Level) != Level.T_Level) throw new ArgumentException("This method should for a level that requires time marking");

            return new TripleWrapper(level, p12["authentication"], null, null, p12.ToCollection());
        }
        public static IDataSealer Create(Level level, ITimestampProvider timestampProvider, EHealthP12 p12)
        {
            ValidateCertificates(p12["authentication"]);
            if (timestampProvider == null) throw new ArgumentNullException("timestampProvider", "A time-stamp provider is required with this method");
            if ((level & Level.T_Level) != Level.T_Level) throw new ArgumentException("This method should for a level that requires time stamping");

            return new TripleWrapper(level, p12["authentication"], null, timestampProvider, p12.ToCollection());
        }
        public static IDataSealer Create(Level level, EHealthP12 p12)
        {
            ValidateCertificates(p12["authentication"]);
            if ((level & Level.T_Level) == Level.T_Level) throw new NotSupportedException("This method can't create timestamps");

            return new TripleWrapper(level, p12["authentication"], null, null, p12.ToCollection());
        }