Switched out pack/unpack and ip2long/long2ip with inet_pton/ntop for ipv6 encoding support in x509v3 subject alternative names

This commit is contained in:
metaclassing 2016-01-26 17:23:14 -06:00
parent bdc28b9453
commit 4735751bf5

View File

@ -2198,9 +2198,7 @@ class X509
*/
function _decodeIP($ip)
{
$ip = base64_decode($ip);
list(, $ip) = unpack('N', $ip);
return long2ip($ip);
return inet_ntop(base64_decode($ip));
}
/**
@ -2214,7 +2212,7 @@ class X509
*/
function _encodeIP($ip)
{
return base64_encode(pack('N', ip2long($ip)));
return base64_encode(inet_pton($ip));
}
/**