此问题是my last question的扩展名。
基本上,最后一个问题是如何将证书转换为perl,而且我已经使用Web::ID
包完成了..
my $webid = Web::ID->new(certificate => $ENV{SSL_CLIENT_CERT});
我通过调用blessed($webid)
和Dumper($webid)
但是我仍然无法调用$webid->uri
,这是应该为我设置的属性。事实上,我不能调用$webid->certificate
所以基本上我还是无法解析SAN。
修改
所以现在直接使用Web::ID::Certificate
包我可以直接遍历SAN数组。
my $cert = Web::ID::Certificate->new(pem => $ENV{SSL_CLIENT_CERT});
foreach (@{ $cert->subject_alt_names }) {
print "SAN: ", $_->type, " = ", $_->value;
}
所以我的问题得到了回答......但是......我仍然感到困惑......
我想我不明白为什么Web::ID
的{{1}}没有被设定?
为什么我的uri
属性都没有设置?
EDIT2 :
$webid
答案 0 :(得分:2)
适合我。我写过这个小剧本:
use strict;
use warnings;
use Web::ID;
printf "%s: %s\n", $_, $_->VERSION for qw(
Web::ID
Crypt::X509
RDF::RDFa::Parser
RDF::Trine
RDF::Query
);
print Web::ID->new(certificate => <<'END')->uri, "\n";
-----BEGIN CERTIFICATE-----
MIIDlzCCAn+gAwIBAgIJAI6PdfUNmz5oMA0GCSqGSIb3DQEBCwUAMEgxCzAJBgNV
BAYTAlhYMREwDwYDVQQHDAhJbnRlcm5ldDEQMA4GA1UECgwHQml0bWFyazEUMBIG
A1UEAwwLbGVhdGhhbi5uZXQwIBcNMTQxMDMxMTI1NjAzWhgPMjExNDEwMDcxMjU2
MDNaMEgxCzAJBgNVBAYTAlhYMREwDwYDVQQHDAhJbnRlcm5ldDEQMA4GA1UECgwH
Qml0bWFyazEUMBIGA1UEAwwLbGVhdGhhbi5uZXQwggEiMA0GCSqGSIb3DQEBAQUA
A4IBDwAwggEKAoIBAQCna/Lvihx5nD3LbjfLo0vDIQkkSR6u/bKbwm346VJBVRh6
/K5gHM19os7ZeNp8GlArl0OGtF5QSf+TGHt0hD8RtgACJumdn/oATYGvGfdwnLu0
vUD9XHc6wzl+thvp7cT1Dw8BtEvUi+e4UBpIJMXCJkMt+Er23Mn288EbSGsC8q1u
ga6Vp4toX4/fSuDEHAlEGeVhWCJfHy26lpaHPPuLTUfr1/8b1TiYI19rit4HK/wS
MfKfXkLXc2a+Clr+/girqa60Q9zXP0GjQRawZ/B8WHVKBkE3DqOp/jEtEytS7Ojv
2ieylYT+/IhiQgqVS6CgE6vZ65PRzuQOItFoNaV7AgMBAAGjgYEwfzAvBgNVHREE
KDAmhhVodHRwOi8vbGVhdGhhbi5uZXQvI2mBDTFAbGVhdGhhbi5uZXQwHQYDVR0O
BBYEFIBUZ3r+B/dc900RyvhlVXq4Znf9MB8GA1UdIwQYMBaAFIBUZ3r+B/dc900R
yvhlVXq4Znf9MAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAE/adF6C
MJHoh1IxnwrvPLZ0S66XD0xPHlQ6ZKvuKqTX2nakf7vXaSzFCkoXJ6Vbv19NXpqZ
28jRBCgv0rszT8ODICApp65XsFc67w5S2/+soIDKs3ZLuKBPvRu6x7cPIeSDfj2J
w6fQ9dXOSzUmdPCoorudrW+L/CmKI8Tn2I2KQah6p9HGh0/XnxXob0kGkGeJF5sR
WOLQOUT+HpEjAy3Eeu1nygxqscaTESKv+0hLV7yHHzJl9TJRFbNw4zYzU3h8t8M+
pSu3SD4YC3HixmZarz7fV36zWaAxJBHRtBkbOwgOMBY4wzfpMPPV4fQ61Qio8DLR
lN7nzvuQD+BA4OQ=
-----END CERTIFICATE-----
END
它产生以下输出:
Web::ID: 1.927
Crypt::X509: 0.51
RDF::RDFa::Parser: 1.097
RDF::Trine: 1.010
RDF::Query: 2.912
http://leathan.net/#i
如果你有这些模块的最新版本,那么你应该没问题。
答案 1 :(得分:0)
具体问题是没有安装“RDF :: RDFa :: Parser”。
cpan install RDF::RDFa::Parser
解决了我的问题。