连接到APN反馈服务时,对sspi的调用失败

时间:2014-07-14 13:26:13

标签: c# apple-push-notifications pushsharp

我正在尝试在C#中查询Apple的反馈服务以获取设备列表。但它抛出:

  

未知例外:
  System.ComponentModel.Win32Exception(0x80004005):处理证书时发生未知错误。

错误混乱说:

  

对SSPI的调用失败,请参阅内部异常。

以下是我实施的与反馈服务进行通信的代码段。这类似于PushSharp API:

X509Certificate2 certName = new 
    X509Certificate2(File.ReadAllBytes("CertificateFile.p12"));

X509Certificate2Collection certs = new X509Certificate2Collection(certName);

string hostName = "feedback.sandbox.push.apple.com";

TcpClient tcpClientF = new TcpClient(hostName, 2196)

SslStream sslStreamF = new SslStream(
    tcpClientF.GetStream(), 
    true,
    (sender, cert, chain, sslErrs) => { return true; },
    (sender, targetHost, localCerts, remoteCert, acceptableIssuers) => 
        { return certName; });

sslStreamF.AuthenticateAsClient(hostName, certs, SslProtocols.Tls, false);

我在这里搜索了多个线程但似乎没有解决我的问题。我已经验证了证书文件,它是有效的。

0 个答案:

没有答案
相关问题