From 4735751bf50278bccb297dff69bef949b0f1abbd Mon Sep 17 00:00:00 2001 From: metaclassing Date: Tue, 26 Jan 2016 17:23:14 -0600 Subject: [PATCH] Switched out pack/unpack and ip2long/long2ip with inet_pton/ntop for ipv6 encoding support in x509v3 subject alternative names --- phpseclib/File/X509.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/phpseclib/File/X509.php b/phpseclib/File/X509.php index 14624c09..c8a0a8ad 100644 --- a/phpseclib/File/X509.php +++ b/phpseclib/File/X509.php @@ -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)); } /**