public void CanCreateCertificates() { var original = TestCertificateHelper.CreateSelfSignedCertificate( CertificateSubjectName, new[] { TestCertificateHelper.ClientAuthenticationOid, TestCertificateHelper.ServerAuthenticationOid }); var encoded = TestCertificateHelper.ConvertToBase64(original); var decoded = TestCertificateHelper.ConvertFromBase64(encoded); Assert.Equal(original, decoded); }
public void Configure(IConfiguration configuration, IClientBuilder clientBuilder) { clientBuilder.ConfigureApplicationParts(parts => parts.AddApplicationPart(typeof(IPingGrain).Assembly)); var encodedCertificate = configuration[CertificateConfigKey]; var localCertificate = TestCertificateHelper.ConvertFromBase64(encodedCertificate); clientBuilder.UseTls(localCertificate, options => { options.SslProtocols = System.Security.Authentication.SslProtocols.Tls12; options.RemoteCertificateValidation = (remoteCertificate, chain, errors) => { return(true); }; options.OnAuthenticateAsClient = (connection, sslOptions) => { sslOptions.TargetHost = CertificateSubjectName; }; }); }
public void Configure(ISiloBuilder hostBuilder) { hostBuilder.ConfigureApplicationParts(parts => parts.AddApplicationPart(typeof(IPingGrain).Assembly)); var config = hostBuilder.GetConfiguration(); var encodedCertificate = config[CertificateConfigKey]; var localCertificate = TestCertificateHelper.ConvertFromBase64(encodedCertificate); var certificateModeString = config[ClientCertificateModeKey]; var certificateMode = (RemoteCertificateMode)Enum.Parse(typeof(RemoteCertificateMode), certificateModeString); hostBuilder.UseTls(localCertificate, options => { options.SslProtocols = System.Security.Authentication.SslProtocols.Tls12; options.AllowAnyRemoteCertificate(); options.RemoteCertificateMode = RemoteCertificateMode.AllowCertificate; options.ClientCertificateMode = certificateMode; options.OnAuthenticateAsClient = (connection, sslOptions) => { sslOptions.TargetHost = CertificateSubjectName; }; }); }