Example #1
0
 public ClientCostumValidator(ICMSCommunication p)
 {
     proxy = p;
 }
Example #2
0
        public WCFClient(NetTcpBinding binding, EndpointAddress address, string clientCertificateName, ICMSCommunication proxy)
            : base(binding, address)
        {
            string cltCertCN = Formatter.ParseName(WindowsIdentity.GetCurrent().Name);

            this.Credentials.ServiceCertificate.Authentication.CertificateValidationMode  = System.ServiceModel.Security.X509CertificateValidationMode.Custom;
            this.Credentials.ServiceCertificate.Authentication.CustomCertificateValidator = new ClientCostumValidator(proxy);
            this.Credentials.ServiceCertificate.Authentication.RevocationMode             = X509RevocationMode.NoCheck;

            /// Set appropriate client's certificate on the channel. Use CertManager class to obtain the certificate based on the "cltCertCN"
            this.Credentials.ClientCertificate.Certificate = ClientGet.GetCertificateFromStorage(StoreName.My, StoreLocation.LocalMachine, clientCertificateName);

            factory = this.CreateChannel();
        }