public void NewTsViaEHealth() { //Read this to enable TLS1.2 on old .Net Framework: //https://docs.microsoft.com/en-us/dotnet/framework/network-programming/tls#configuring-security-via-the-windows-registry var certs = new EHealthP12(@"EHealthP12/eHealth.acc-p12", File.ReadAllText(@"EHealthP12/eHealth.acc-p12.pwd")); var tsa = new TimeStampAuthorityClient(new StsBinding(), new EndpointAddress(new Uri("https://services-acpt.ehealth.fgov.be/TimestampAuthority/v2"))); tsa.ClientCredentials.ClientCertificate.Certificate = certs["authentication"]; var provider = new EHealthTimestampProvider(tsa); byte[] tsBytes = provider.GetTimestampFromDocumentHash(hash, "http://www.w3.org/2001/04/xmlenc#sha256"); File.WriteAllBytes(@"files/eHTs2.ts", tsBytes); TimeStampToken tst = tsBytes.ToTimeStampToken(); Assert.True(tst.IsMatch(new MemoryStream(msg))); IList <CertificateList> crls = new List <CertificateList>(); IList <BasicOcspResponse> ocps = new List <BasicOcspResponse>(); tst.Validate(crls, ocps); tst.Validate(crls, ocps, null); }
public EHIntegrationTest() { ECDSAConfig.Init(); //needed to enable ECDSA globally. wstEp = new EndpointAddress("https://services-int.ehealth.fgov.be/IAM/SecurityTokenService/v1"); //wstEp = new EndpointAddress("https://services-acpt.ehealth.fgov.be/IAM/SecurityTokenService/v1"); samlpEp = new EndpointAddress("https://services-int.ehealth.fgov.be/IAM/Saml11TokenService/v1"); //samlpEp = new EndpointAddress("https://services-acpt.ehealth.fgov.be/IAM/Saml11TokenService/v1"); var p12 = new EHealthP12("files/ehealth-01050399864-int.p12", File.ReadAllText("files/ehealth-01050399864-int.p12.pwd")); //var p12 = new EHealthP12("files/ehealth-79021802145-acc.p12", File.ReadAllText("files/ehealth-79021802145-acc.p12.pwd")); session = p12["authentication"]; issuer = new X509Certificate2("files/IAMINT.cer"); //issuer = new X509Certificate2("files/IAMACC.cer"); binding = new StsBinding() { BypassProxyOnLocal = false, UseDefaultWebProxy = false, ProxyAddress = new Uri("http://localhost:8080") }; }
public static void InitializeClass(TestContext ctx) { //Load eHealth certificates alice = new EHealthP12(GetAbsoluteTestFilePath("alice/alices_private_key_store.p12"), "test"); bob = new EHealthP12(GetAbsoluteTestFilePath("bob/bobs_private_key_store.p12"), "test"); AsymmetricAlgorithm key = RSA.Create(); String keyID = "myid"; }
public void MyClassInitialize(TestContext ctx) { var alice = new EHealthP12(GetAbsoluteTestFilePath("alice/old_alices_private_key_store.p12"), "test"); var bob = new EHealthP12(GetAbsoluteTestFilePath("bob/old_bobs_private_key_store.p12"), "test"); aliceSealer = EhDataSealerFactory.Create(Level.B_Level, alice); bobUnsealer = DataUnsealerFactory.Create(null, bob); anonUnsealer = DataUnsealerFactory.Create(null); }
public static void InitializeClass(TestContext ctx) { //Bob as decryption bobEtk = new EncryptionToken(Utils.ReadFully("bob/bobs_public_key.etk")); //Bob (and Alice) used for decryption alice = new EHealthP12("alice/alices_private_key_store.p12", "test"); bob = new EHealthP12("bob/bobs_private_key_store.p12", "test"); //create a tsa (fedict in this case) tsa = new Rfc3161TimestampProvider(); }
public static void InitializeClass(TestContext ctx) { //sign with generated key key = new WebKey(RSA.Create()); //Bob as decryption bobEtk = new EncryptionToken(File.ReadAllBytes("bob/bobs_public_key.etk")); //Bob (and Alice) used for decryption alice = new EHealthP12("alice/alices_private_key_store.p12", "test"); bob = new EHealthP12("bob/bobs_private_key_store.p12", "test"); //create a tsa (fedict in this case) tsa = new Rfc3161TimestampProvider(); }
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())); }
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())); }
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; }
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())); }
public void MyClassInitialize(TestContext ctx) { bob = new EHealthP12(GetAbsoluteTestFilePath("bob/bobs_private_key_store.p12"), "test"); alice = new EHealthP12(GetAbsoluteTestFilePath("alice/alices_private_key_store.p12"), "test"); //mcn = new EHealthP12(GetAbsoluteTestFilePath("mcn/MYCARENET.p12"), File.ReadAllText(GetAbsoluteTestFilePath("mcn/MYCARENET.pwd"))); }
public void setup() { p12 = new EHealthP12(@"..\..\EHealthP12\dummy.p12", "test001"); }
public void ConstuctorWithByteArray() { p12 = new EHealthP12(File.ReadAllBytes(@"..\..\EHealthP12\dummy.p12"), "test001"); Assert.AreEqual(5, p12.Keys.Count); }
public static void InitializeClass() { //Bob as decryption bobEtk = new EncryptionToken(Utils.ReadFully("../../bob/bobs_public_key.etk")); //Bob (and Alice) used for decryption alice = new EHealthP12("../../alice/alices_private_key_store.p12", "test"); bob = new EHealthP12("../../bob/bobs_private_key_store.p12", "test"); //create a tsa (fedict in this case) tsa = new Rfc3161TimestampProvider(); }
public void ConstuctorWithByteArray() { p12 = new EHealthP12(File.ReadAllBytes(@"EHealthP12/dummy.p12"), "test001"); Assert.AreEqual(5, p12.Keys.Count); }
public static void InitializeClass() { //Load eHealth certificates alice = new EHealthP12("../../alice/alices_private_key_store.p12", "test"); bob = new EHealthP12("../../bob/bobs_private_key_store.p12", "test"); }
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 EHealthP12Tests() { dummyP12 = new EHealthP12(@"EHealthP12/dummy.p12", "test001"); realP12 = new EHealthP12(@"EHealthP12\eHealth.acc-p12", File.ReadAllText(@"EHealthP12\eHealth.acc-p12.pwd")); }
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()); }
public static void setup(TestContext ctx) { p12 = new EHealthP12(@"EHealthP12\eHealth.acc-p12", File.ReadAllText(@"EHealthP12\eHealth.acc-p12.pwd")); }
public void MyClassInitialize() { var alice = new EHealthP12("../../alice/old_alices_private_key_store.p12", "test"); var bob = new EHealthP12("../../bob/old_bobs_private_key_store.p12", "test"); aliceSealer = EhDataSealerFactory.Create(Level.B_Level, alice); bobUnsealer = DataUnsealerFactory.Create(null, bob); anonUnsealer = DataUnsealerFactory.Create(null); }
public static void setup() { p12 = new EHealthP12(@"..\..\EHealthP12\SSIN=79021802145.p12", File.ReadAllText(@"..\..\EHealthP12\SSIN=79021802145.txt")); //p12 = new EHealthP12(@"..\..\EHealthP12\ehealth.p12", File.ReadAllText(@"..\..\EHealthP12\ehealth.txt")); }
public static void setupClass(TestContext ctx) { p12 = new EHealthP12(@"EHealthP12/dummy.p12", "test001"); }
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 void MyClassInitialize(TestContext ctx) { bob = new EHealthP12(GetAbsoluteTestFilePath("bob/bobs_private_key_store.p12"), "test"); }