小编D f*_*per的帖子

.NET 相互 SSL 握手“客户端身份验证”

过去几天我一直在解决这个问题,但一无所获。

场景是:

现场的 iOS 应用程序将调用我的 REST 服务 (.NET)。我的 REST 服务将使用相互 SSL 握手调用 Apache Web 服务。无论我收到什么数据,我都必须传回现场的 iOS 设备。

唯一的问题是 My REST Service 和 Apache Web 服务之间通信的第二部分。

客户端证书已使用客户端身份验证、数字证书、密钥加密的密钥用法进行签名。我的证书的根签名者已放置在 Apache 服务器上。如果我们尝试使用 Web 浏览器,我们可以毫无问题地执行握手。

我用来使用 SslStream 执行身份验证的示例代码。使用这种方法我得到一个错误说明

The message received was unexpected or badly formatted

管理 Apache Web 服务器的人说他们可以看到请求进来,但据他们说他们没有收到证书。

var certificate = @“certificate.cer”;
var hostAddress = “hostAddress";
var certificates = new X509Certificate2Collection(new X509Certificate2(certificate));
RunClient(hostAddress, 1316, certificates);

static void RunClient(string hostName, int port, X509Certificate2Collection certificates)
{
    TcpClient client = new TcpClient(hostName, port);
    SslStream sslStream = …
Run Code Online (Sandbox Code Playgroud)

.net c# apache authentication ssl

5
推荐指数
1
解决办法
1万
查看次数

标签 统计

.net ×1

apache ×1

authentication ×1

c# ×1

ssl ×1