2017-09-22 3 views
-1

この問題に関するいくつかの質問がありました。ここで証明書の問題x.509 c#

は私の状況です:

FIRST:

私はこのような何かApp.configファイルに書くとき: 「リモート証明書を:私はその種類の通信見たより

<behaviors> 
    <endpointBehaviors> 
    <behavior name="CustomBehavior"> 
     <clientCredentials> 
     <clientCertificate findValue="1234*********" 
      x509FindType="FindByThumbprint" 
      storeLocation="LocalMachine" storeName="Root" /> 
     </clientCredentials> 
    </behavior> 
    </endpointBehaviors> 
    </behaviors> 

を検証手続きによって無効です。 "

SECOND:

 <behaviors> 
    <endpointBehaviors> 
    <behavior name="CustomBehavior"> 
     <clientCredentials> 
     <clientCertificate findValue="test" 
      x509FindType="FindBySubjectName" 
      storeLocation="LocalMachine" storeName="Root" /> 
     </clientCredentials> 
    </behavior> 
    </endpointBehaviors> 
    </behaviors> 

私は一種の通信ことがわかりたより: それはその名前で多くの証明書です。

mmcでローカルコンピュータに証明書をインストールしましたが、この証明書は信頼できる公開ルートにあります。また、私はIEがこの証明書を持っているかどうかをチェックし、また持っています。

私は、親指プリント、サブジェクト名、発行者名、シリアル番号、サブジェクトキー識別子などで自分の証明書を検索しようとしました。

UPDATE:私はあなたが追加する必要があるすべては解決策を見つけ :!

BasicHttpBinding basicHttpBinding =新しいBasicHttpBinding();

 basicHttpBinding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly; 

     basicHttpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows; 

     EndpointAddress endpoint = new EndpointAddress("http://testasp.asmx"); 

     RemoteSetup.RemoteSetupServiceSoapClient client = new RemoteSetup.RemoteSetupServiceSoapClient(basicHttpBinding, endpoint); 

     client.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation; 

     client.ChannelFactory.Credentials.Windows.ClientCredential = System.Net.CredentialCache.DefaultNetworkCredentials; 
+0

あなたのコードを適切にフォーマットしてください。 –

答えて

0

は、私は同様の問題のようなものを持っていたし、このような何かをやった:

System.Net.ServicePointManager.ServerCertificateValidationCallback += 
       new RemoteCertificateValidationCallback(ValidateRemoteCertificate); 

その後、手動で永続的にチェックし、返さtrue

private static bool ValidateRemoteCertificate(object sender, X509Certificate cert, 
           X509Chain chain, SslPolicyErrors policyErrors) 
{ 
    bool result = false; 
    if (cert.Subject.ToUpper().Contains("MY_CERT_ISSUER_NAME")) 
    { 
     result = true; 
    } 
    return result; 
} 
まず登録されたイベント ServerCertificateValidationCallback

"正しい"解決策が見つかりませんでしたが、これは静かに最善ではありませんが、役立つかもしれません。

関連する問題