Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sockets/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法使用perl IO::Socket::SSL与gateway.push.apple.com完成SSL握手_Perl_Sockets_Ssl_Apple Push Notifications - Fatal编程技术网

无法使用perl IO::Socket::SSL与gateway.push.apple.com完成SSL握手

无法使用perl IO::Socket::SSL与gateway.push.apple.com完成SSL握手,perl,sockets,ssl,apple-push-notifications,Perl,Sockets,Ssl,Apple Push Notifications,我对这类事情很陌生,不知道自己做错了什么 在Mojolicous应用程序中,我正在努力连接到Apple推送通知SSL套接字。我想向应用发送推送通知 调试信息: DEBUG: .../IO/Socket/SSL.pm:2700: new ctx 138351632 DEBUG: .../IO/Socket/SSL.pm:612: socket not yet connected DEBUG: .../IO/Socket/SSL.pm:614: socket connected DEBUG: ...

我对这类事情很陌生,不知道自己做错了什么

在Mojolicous应用程序中,我正在努力连接到Apple推送通知SSL套接字。我想向应用发送推送通知

调试信息:

DEBUG: .../IO/Socket/SSL.pm:2700: new ctx 138351632
DEBUG: .../IO/Socket/SSL.pm:612: socket not yet connected
DEBUG: .../IO/Socket/SSL.pm:614: socket connected
DEBUG: .../IO/Socket/SSL.pm:636: ssl handshake not started
DEBUG: .../IO/Socket/SSL.pm:669: using SNI with hostname gateway.push.apple.com
DEBUG: .../IO/Socket/SSL.pm:704: request OCSP stapling
DEBUG: .../IO/Socket/SSL.pm:736: call Net::SSLeay::connect
DEBUG: .../IO/Socket/SSL.pm:2601: did not get stapled OCSP response
DEBUG: .../IO/Socket/SSL.pm:2554: ok=0 [1] /O=Entrust.net/OU=www.entrust.net/CPS_2048 incorp. by ref. (limits liab.)/OU=(c) 1999 Entrust.net Limited/CN=Entrust.net Certification     Authority (2048)/C=US/O=Entrust, Inc./OU=www.entrust.net/rpa is incorporated by reference/OU=(c) 2009 Entrust, Inc./CN=Entrust Certification Authority - L1C
DEBUG: .../IO/Socket/SSL.pm:739: done Net::SSLeay::connect -> -1
DEBUG: .../IO/Socket/SSL.pm:742: SSL connect attempt failed
DEBUG: .../IO/Socket/SSL.pm:742: local error: SSL connect attempt failed error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
DEBUG: .../IO/Socket/SSL.pm:745: fatal SSL error: SSL connect attempt failed error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
DEBUG: ...5.18/IO/Socket.pm:48: ignoring less severe local error 'IO::Socket::IP configuration failed', keep 'SSL connect attempt failed error:14090086:SSL     routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed'
DEBUG: .../IO/Socket/SSL.pm:2733: free ctx 138351632 open=138351632
DEBUG: .../IO/Socket/SSL.pm:2738: free ctx 138351632 callback
DEBUG: .../IO/Socket/SSL.pm:2745: OK free ctx 138351632
代码剪切位:

use IO::Socket::SSL qw(debug3);

my $cl = IO::Socket::SSL->new(
  PeerHost => 'gateway.push.apple.com',
  # PeerHost => 'gateway.sandbox.push.apple.com',
  PeerPort => '2195',
  SSL_verify_mode => SSL_VERIFY_PEER,
  SSL_ca_file => '/var/www/foo/bar/cert/ck.pem',
);

我不知道从这里去哪里或做什么?

我弄明白了:我使用了错误的通行短语!我能够实现更简单的perl模块
Net::APNS

use Net::APNS;

my %settings = (
  cert   => "$Cert_file",
  key    => "$Cert_key_file",
  passwd => "$passphrase",
);

if(my $Notifier = Net::APNS->new->notify(\%settings)) {
  $Notifier->write({
    devicetoken => "$device_token",
    message     => "$message",
    sound       => 'default',
    badge       => 1
  });

  return 1 if defined($Notifier) and ref($Notifier) eq "Net::APNS::Notification";
}

谢谢你的所有意见

服务器端的ssl证书出现问题。检查ssl证书是否有效?我猜
/var/www/foo/bar/cert/ck.pem
不包含对从服务器获得的证书进行签名的CA。但是如果不知道这个文件的内容,就很难判断。除此之外,我认为这个服务需要一个客户端证书,您需要使用SSL\u cert\u文件和SSL\u key\u文件来指定它。我发现:我使用的密码短语不正确!我能够实现更简单的perl模块
Net::APNS