如何通过vb .net连接到ios APN

时间:2012-04-18 08:05:28

标签: ios vb.net notifications push pkcs#12

我在开箱即用苹果的沙箱服务器方面有一些不可思议的事情。我真的不知道这只是我的程序错误还是我的证书。

让我们看看:

Using client As New TcpClient()
        client.Connect("gateway.sandbox.push.apple.com", 2195)
        Using networkStream As NetworkStream = client.GetStream()
            Console.WriteLine("Client connected.")

            Dim clientCertificate As New X509Certificate("certfile.p12", "PASS")
            Dim clientCertificateCollection As New X509CertificateCollection(New X509Certificate(0) {clientCertificate})

            ' Create an SSL stream that will close the client's stream.
            Dim sslStream As New SslStream(client.GetStream(), False, AddressOf ValidateServerCertificate, Nothing)

            Try
                sslStream.AuthenticateAsClient("gateway.sandbox.push.apple.com", clientCertificateCollection, SslProtocols.Default, False)
            Catch ex As AuthenticationException
                Console.WriteLine("Exception: {0}", ex.Message)
                If ex.InnerException IsNot Nothing Then
                    Console.WriteLine("Inner exception: {0}", ex.InnerException.Message)
                End If
                Console.WriteLine("Authentication failed - closing the connection.")
                client.Close()
                Return
            End Try
        End Using
    End Using

我收到以下错误:“SSPI-Call失败”。

现在我的问题是,我必须在钥匙串中导出哪个证书?我的私钥,aps_provisioning,apple开发证书或我的开发人员证书?

提前致谢!

0 个答案:

没有答案