0

I am trying to query Apple's feedback service in C# to get the device lists. But it throws:

Unknown exception:
System.ComponentModel.Win32Exception (0x80004005): An unknown error occurred while processing the certificate.

The error messgage says:

A call to SSPI failed, see inner exception.

Following is the code snippet I have implemented for communication with the feedback service. This is similar to 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);

I have searched multiple threads here but nothing seems to solve my problem. I have verified the certificate file and it is valid.

Yurii
  • 4,811
  • 7
  • 32
  • 41
HSharma
  • 385
  • 2
  • 18
  • What does the inner exception say? – antiduh Jul 14 '14 at 14:46
  • The inner exception is what I have already mentioned: Unknown exception: System.ComponentModel.Win32Exception (0x80004005): An unknown error occurred while processing the certificate. – HSharma Jul 15 '14 at 04:39

0 Answers0