void AddCertificate(CertificateResourceType type) { var data = ResourceManager.GetCertificateData(type); using (var x509 = BtlsProvider.CreateNative(data, BtlsX509Format.PEM)) chain.Add(x509); }
static BtlsX509 ReadFromStandardInput() { var text = Console.In.ReadToEnd(); var data = Encoding.UTF8.GetBytes(text); return(BtlsProvider.CreateNative(data, BtlsX509Format.PEM)); }
protected void SetupChain(TestContext ctx) { foreach (var type in Parameters.Types) { var data = ResourceManager.GetCertificateData(type); var x509 = BtlsProvider.CreateNative(data, BtlsX509Format.PEM); chain.Add(x509); } }
// [Martin] // [AsyncTest] public void Hello(TestContext ctx) { var chain = BtlsProvider.CreateNativeChain(); ctx.LogMessage("GOT CHAIN: {0}", chain); var tlsTestData = ResourceManager.GetCertificateData(CertificateResourceType.TlsTestXamDevNew); var tlsTestCaData = ResourceManager.GetCertificateData(CertificateResourceType.TlsTestXamDevCA); var tlsTest = BtlsProvider.CreateNative(tlsTestData, BtlsX509Format.PEM); var tlsTestCa = BtlsProvider.CreateNative(tlsTestCaData, BtlsX509Format.PEM); ctx.LogMessage("LET'S BUILD IT!"); chain.Add(tlsTest); chain.Add(tlsTestCa); var store = BtlsProvider.CreateNativeStore(); store.AddTrustedRoots(); var storeCtx = BtlsProvider.CreateNativeStoreCtx(); storeCtx.Initialize(store, chain); var param = BtlsProvider.GetVerifyParam_SslClient().Copy(); param.SetHost("test!"); param.AddHost("martin.xamdev.com"); var flags = param.GetFlags(); ctx.LogMessage("FLAGS: {0:x}", flags); // param.SetFlags (BoringX509VerifyFlags.CRL_CHECK); // param.SetPurpose (BoringX509Purpose.SMIME_ENCRYPT); param.SetTime(DateTime.Now.AddDays(3)); storeCtx.SetVerifyParam(param); ctx.LogMessage("CALLING VERIFY"); var ret = storeCtx.Verify(); ctx.LogMessage("VERIFY DONE: {0}", ret); var error = storeCtx.GetError(); ctx.LogMessage("VERIFY ERROR: {0}", error); ctx.LogMessage("STORE COUNT: {0}", store.GetCount()); }
public Task Initialize(TestContext ctx, CancellationToken cancellationToken) { return(Task.Run(() => { x509 = BtlsProvider.CreateNative(data, format); })); }
static BtlsX509 ReadFromFile(string filename) { var data = File.ReadAllBytes(filename); return(BtlsProvider.CreateNative(data, BtlsX509Format.PEM)); }