1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
TcpClient client = new TcpClient(serveur, port);
if (!client.Connected)
return;
SslStream ssl = new SslStream(client.GetStream(), false);
X509CertificateCollection certifs = new X509CertificateCollection();
X509Certificate cert = X509Certificate.CreateFromCertFile("aps_developer_identity.cer");
certifs.Add(cert);
try
{
ssl.AuthenticateAsClient(serveur);
}
catch (AuthenticationException ex)
{
error += ex.Message + "\r\n";
if (ex.InnerException != null)
{
error += "Inner exception: " + ex.InnerException.Message +"\r\n";
}
}
client.Close(); |
Partager