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.