我正在尝试通过来自IO::Socket::SSL at CSPAN的SSL示例。无法找到对象方法“SSL_ca_file”
我加SSL_ca_file
的例子:
$client->SSL_ca_file('ca-rsa-cert.pem')
|| die "failed to set CA certificate";
当我尝试执行脚本,我得到:
Can't locate object method "SSL_ca_file" via package "IO::Socket::SSL"
任何想法我可能是做错了?谷歌没有提出有用的回应。
编辑:当我尝试使用下面米勒的建议:
my $client = IO::Socket::SSL->new("example.com:8443",
SSL_ca_file => 'ca-rsa-cert.pem')
|| warn "I encountered a problem: ".IO::Socket::SSL::errstr();
我收到一个错误:
Odd number of elements in hash assignment at /usr/share/perl5/IO/Socket/IP.pm line 328.
I encountered a problem: IO::Socket::IP configuration failed error:00000000:lib(0):func(0):reason(0) at ./TestCert.pl line 6.
编辑:接着米勒提供的文档,一切运行良好:
my $client = IO::Socket::SSL->new(
PeerAddr => 'example.com',
PeerPort => '8443',
Proto => 'tcp',
SSL_ca_file => 'ca-rsa-cert.pem')
|| warn "I encountered a problem: ".IO::Socket::SSL::errstr();
该系统是Debian Wheezy(7.3,x64)。 PERL是5.14.2版本。
如果您查看文档顶部的使用示例,您将找到正确使用SSL_ca_file的方法。 –
Steffen - Under synopsis?这就是我作为基础项目/程序所使用的内容(并引用了参考文献)。但是使用示例不包含'SSL_ca_file'。 – jww
是的,在大纲中:http://search.cpan.org/~sullr/IO-Socket-SSL-1.969/lib/IO/Socket/SSL.pm - 并且这些参数甚至在大纲中的示例中进行了评论。 –