0

簡単な要約は次のとおりです。Windows7(64ビット)では正常に動作するWCFクライアント(.NET 4.0)がありますが、XP(32ビット)では失敗します。XPのお客様が多いので、これは大きな問題です。

  • クライアントは、サービスプロバイダーから提供されたwsdlファイルから生成されます。
  • サービスはSSLを介したSOAP1.2であり、MTOMを使用します
  • クライアント証明書はスマートカード(ActivIdentity)にあります

コードは次のとおりです。

        ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
        //System.Net.ServicePointManager.SecurityProtocol =System.Net.SecurityProtocolType.Tls;//.Ssl3;

        EndpointAddress addr = new EndpointAddress(g2bservice);
        B2GServiceClient client = new B2GServiceClient(NCTSBinding.Create(), addr);

        client.ClientCredentials.ClientCertificate.Certificate = ccer;  // one that is on SmartCard
        client.Endpoint.Behaviors.Add(new MyCustomBehavior());

        echo e = new echo();
        e.Msg = "Hello, World!";

        echoResponse r = client.echo(e);

このバインディングは次のように作成されます。

        BindingElement[] be = new BindingElement[2];
        be[0] = new NCTSMessageEncodingBindingElement();
        HttpsTransportBindingElement hbe = new HttpsTransportBindingElement();
        hbe.RequireClientCertificate = true;
        be[1] = hbe;
        CustomBinding _b = new CustomBinding(be);
        return _b;

ここで、NCTSMessageEncodingBindingは、オーバーライドされたMtomMessageEncodingBindingとほとんど同じではありませんIsContentTypeSupported(...)

したがって、このコードはWin7で機能し、スマートカードから「プライベートパーツ」を取得するためのPINを要求するダイアログが表示されます。XPでは、PINを入力するためのダイアログが発行されることはなく、代わりにエラーメッセージが表示されます。

"An error occurred while making the HTTP request to https://cistest.apis-it.hr:8446/g2bservis. This could be due to the fact that the server certificate is not configured properly with HTTP.SYS in the HTTPS case. This could also be caused by a mismatch of the security binding between the client and the server."

手がかりはありますか?XPとWin7のサポートインフラストラクチャの違いは何ですか?

少し更新:動作中のトレースログと動作していないトレースログが異なる太線に注意してください。何らかの理由で、Windows 7マシンでは、最初のメッセージのメッセージにサービス名(cistest.apis-it.hr)が含まれていますが、XPではこの情報がありません。このメッセージの後、XPのソケットは閉じられます...

Windows 7、動作例(同じコード):
System.Net情報:0:[3748] SecureChannel#23960260-証明書はタイプX509Certificate2で​​あり、秘密鍵が含まれています。
System.Net情報:0:[3748] AcquireCredentialsHandle(パッケージ= Microsoft統合セキュリティプロトコルプロバイダー、インテント=アウトバウンド、scc = System.Net.SecureCredential)
System.Net情報:0:[3748] InitializeSecurityContext(credential = System.Net.SafeFreeCredential_SECURITY、context =(null)、targetName = cistest.apis-it.hr、inFlags = ReplayDetect、SequenceDetect、Confidentiality、AllocateMemory、InitManualCredValidation)
System.Net情報:0:[3748] InitializeSecurityContext(In-Buffer length = 0、Out-Buffer length = 122、returned code = ContinueNeeded)。
System.Net.Sockets詳細:0:[3748] Socket#46340781 :: Send()
System.Net.Sockets詳細:0:[3748] Socket#46340781::Sendからのデータ
System.Net.Sockets詳細:0:[3748] 00000000:16 03 01 00 75 01 00 00-71 03 01 4E 67 4E 6A 26:.... u ... q..NgNj&
System.Net.Sockets詳細:0:[3748] 00000010:C6 C9 65 17 D7 EC C1 A1-15 72 E1 56 80 F4 5A BB:.. e......rV.Z。
System.Net.Sockets詳細:0:[3748] 00000020:A8 4C 50 54 84 D4 3E 86-29 68 CA 00 00 18 00 2F:.LPT ..>。)h ..... /
System.Net.Sockets詳細:0:[3748] 00000030:00 35 00 05 00 0A C0 13-C0 14 C0 09 C0 0A 00 32:.5 ............. 2
System.Net.Sockets詳細:0:[3748] 00000040:00 38 00 13 00 04 01 00-00 30 FF 01 00 01 00 00:.8 ....... 0 ..... ..
System.Net.Sockets詳細:0:[3748] 00000050:00 00 17 00 15 00 00 12-63 69 73 74 65 73 74 2E:........cistest。
System.Net.Sockets詳細:0:[3748] 00000060:61 70 69 73 2D 69 74 2E-68 72 00 0A 00 06 00 04:apis-it.hr ..... ..
System.Net.Sockets詳細:0:[3748] 00000070:00 17 00 18 00 0B 00 02-01 00:.........。
System.Net.Sockets詳細:0:[3748] Exiting Socket#46340781 :: Send()-> 122#122

XP、動作しない例(同じコード):
System.Net情報:0:[2272] SecureChannel#7307181-証明書はタイプX509Certificate2で​​あり、秘密鍵が含まれています。
System.Net情報:0:[2272] AcquireCredentialsHandle(パッケージ= Microsoft統合セキュリティプロトコルプロバイダー、インテント=アウトバウンド、scc = System.Net.SecureCredential)
System.Net情報:0:[2272] InitializeSecurityContext(credential = System.Net.SafeFreeCredential_SECURITY、context =(null)、targetName = cistest.apis-it.hr、inFlags = ReplayDetect、SequenceDetect、Confidentiality、AllocateMemory、InitManualCredValidation)
System.Net情報:0:[2272] InitializeSecurityContext(In-Buffer length = 0、Out-Buffer length = 77、returned code = ContinueNeeded)。
System.Net.Sockets詳細:0:[2272] Socket#32308990 :: Send()
System.Net.Sockets詳細:0:[2272] Socket#32308990::Sendからのデータ
System.Net.Sockets詳細:0:[2272] 00000000:16 03 01 00 48 01 00 00-44 03 01 4E 67 4E 1E C1:.... H ... D..NgN ..
System.Net.Sockets詳細:0:[2272] 00000010:32 BD E0 57 87 A8 68 8B-32 77 00 18 DE 3F 69 3D:2..W..h.2w ...?i =
System.Net.Sockets詳細:0:[2272] 00000020:D7 B1 7B 76 AD 26 A6 63-6B BB 49 00 00 16 00 04:.. {v。&。ck.I....。
System.Net.Sockets詳細:0:[2272] 00000030:00 05 00 0A 00 09 00 64-00 62 00 03 00 06 00 13:.......db....。
System.Net.Sockets詳細:0:[2272] 00000040:00 12 00 63 01 00 00 05-FF 01 00 01 00:...c........。
System.Net.Sockets詳細:0:[2272] Exiting Socket#32308990 :: Send()-> 77#77
System.Net.Sockets詳細:0:[2272] Socket#32308990 :: Receive()
System.Net.Sockets詳細:0:[2272] Socket#32308990::Receiveからのデータ
System.Net.Sockets詳細:0:[2272] 00000000:15 03 01 00 02:....。
..。
System.Net.Sockets詳細:0:[2272] Exiting Socket#32308990 :: Receive()-> 5#5
System.Net.Sockets詳細:0:[2272] Socket#32308990 :: Receive()
System.Net.Sockets詳細:0:[2272] Socket#32308990::Receiveからのデータ
System.Net.Sockets詳細:0:[2272] 00000005:02 28:。(
System.Net.Sockets詳細:0:[2272] Exiting Socket#32308990 :: Receive()-> 2#2
System.Net.Sockets詳細:0:[2272] Socket#32308990 :: Receive()
System.Net.Sockets詳細:0:[2272] Socket#32308990::Receiveからのデータ
System.Net.Sockets詳細:0:[2272] 00000007 ::
System.Net.Sockets詳細:0:[2272] Exiting Socket#32308990 :: Receive()-> 0#0
System.Net.Sockets詳細:0:[2272] Socket#32308990 :: Dispose()
4

1 に答える 1

1

さて、この問題を解決しようとして1か月ほど経った後、結論は、この問題は解決できないということです。少なくとも、ネイティブの.NETおよびOSのサポートでは解決できません。Windows XPは、MicrosoftがAES 256ビット暗号化、鍵交換用のRSAを使用したSHA256ビット署名をサポートするには古すぎるようです。世界にはまだXPを使用しているユーザーの40%がいるので、この決定は本当に奇妙です。

このようなサポートはWindowsServer2003に追加されています(2003年からXPにschannel.dllとrsaenh.dllを追加しようとしましたが、ある程度の進歩はありますが、理想からはほど遠いです)。

プレミアムテクニカルサポートの公式回答は次のとおりです。 「現在、状況は期待できません。過去に別のお客様からKB記事948963のXPバージョンを要求されましたが、この要求は製品グループによって拒否されました。これらのセキュリティ機能が導入されました。 Vistaでは、2つのプラットフォームの6〜7年の違いにより、XPに変更を加えることは困難です。」

したがって、SOAPとWebServicesについては、 .NETはお勧めしません。少なくとも、両方を制御しないエンタープライズサービスについてはお勧めしません。

はぁ!

于 2011-09-22T07:29:20.077 に答える