1--TEST-- 2openssl_x509_parse() basic test for OpenSSL 0.9 3--SKIPIF-- 4<?php if (!extension_loaded("openssl")) print "skip"; 5if (OPENSSL_VERSION_NUMBER > 0x10000000) die("skip Output requires OpenSSL 0.9"); 6?> 7--FILE-- 8<?php 9$cert = "file://" . dirname(__FILE__) . "/cert.crt"; 10 11var_dump(openssl_x509_parse($cert)); 12var_dump(openssl_x509_parse($cert, false)); 13?> 14--EXPECTF-- 15array(12) { 16 ["name"]=> 17 string(96) "/C=BR/ST=Rio Grande do Sul/L=Porto Alegre/CN=Henrique do N. Angelo/emailAddress=hnangelo@php.net" 18 ["subject"]=> 19 array(5) { 20 ["C"]=> 21 string(2) "BR" 22 ["ST"]=> 23 string(17) "Rio Grande do Sul" 24 ["L"]=> 25 string(12) "Porto Alegre" 26 ["CN"]=> 27 string(21) "Henrique do N. Angelo" 28 ["emailAddress"]=> 29 string(16) "hnangelo@php.net" 30 } 31 ["hash"]=> 32 string(8) "%s" 33 ["issuer"]=> 34 array(5) { 35 ["C"]=> 36 string(2) "BR" 37 ["ST"]=> 38 string(17) "Rio Grande do Sul" 39 ["L"]=> 40 string(12) "Porto Alegre" 41 ["CN"]=> 42 string(21) "Henrique do N. Angelo" 43 ["emailAddress"]=> 44 string(16) "hnangelo@php.net" 45 } 46 ["version"]=> 47 int(2) 48 ["serialNumber"]=> 49 string(20) "12593567369101004962" 50 ["validFrom"]=> 51 string(13) "080630102843Z" 52 ["validTo"]=> 53 string(13) "080730102843Z" 54 ["validFrom_time_t"]=> 55 int(1214821723) 56 ["validTo_time_t"]=> 57 int(1217413723) 58 ["purposes"]=> 59 array(8) { 60 [1]=> 61 array(3) { 62 [0]=> 63 bool(true) 64 [1]=> 65 bool(true) 66 [2]=> 67 string(9) "sslclient" 68 } 69 [2]=> 70 array(3) { 71 [0]=> 72 bool(true) 73 [1]=> 74 bool(true) 75 [2]=> 76 string(9) "sslserver" 77 } 78 [3]=> 79 array(3) { 80 [0]=> 81 bool(true) 82 [1]=> 83 bool(true) 84 [2]=> 85 string(11) "nssslserver" 86 } 87 [4]=> 88 array(3) { 89 [0]=> 90 bool(true) 91 [1]=> 92 bool(true) 93 [2]=> 94 string(9) "smimesign" 95 } 96 [5]=> 97 array(3) { 98 [0]=> 99 bool(true) 100 [1]=> 101 bool(true) 102 [2]=> 103 string(12) "smimeencrypt" 104 } 105 [6]=> 106 array(3) { 107 [0]=> 108 bool(true) 109 [1]=> 110 bool(true) 111 [2]=> 112 string(7) "crlsign" 113 } 114 [7]=> 115 array(3) { 116 [0]=> 117 bool(true) 118 [1]=> 119 bool(true) 120 [2]=> 121 string(3) "any" 122 } 123 [8]=> 124 array(3) { 125 [0]=> 126 bool(true) 127 [1]=> 128 bool(true) 129 [2]=> 130 string(10) "ocsphelper" 131 } 132 } 133 ["extensions"]=> 134 array(3) { 135 ["subjectKeyIdentifier"]=> 136 string(59) "DB:7E:40:72:BD:5C:35:85:EC:29:29:81:12:E8:62:68:6A:B7:3F:7D" 137 ["authorityKeyIdentifier"]=> 138 string(202) "keyid:DB:7E:40:72:BD:5C:35:85:EC:29:29:81:12:E8:62:68:6A:B7:3F:7D 139DirName:/C=BR/ST=Rio Grande do Sul/L=Porto Alegre/CN=Henrique do N. Angelo/emailAddress=hnangelo@php.net 140serial:AE:C5:56:CC:72:37:50:A2 141" 142 ["basicConstraints"]=> 143 string(7) "CA:TRUE" 144 } 145} 146array(12) { 147 ["name"]=> 148 string(96) "/C=BR/ST=Rio Grande do Sul/L=Porto Alegre/CN=Henrique do N. Angelo/emailAddress=hnangelo@php.net" 149 ["subject"]=> 150 array(5) { 151 ["countryName"]=> 152 string(2) "BR" 153 ["stateOrProvinceName"]=> 154 string(17) "Rio Grande do Sul" 155 ["localityName"]=> 156 string(12) "Porto Alegre" 157 ["commonName"]=> 158 string(21) "Henrique do N. Angelo" 159 ["emailAddress"]=> 160 string(16) "hnangelo@php.net" 161 } 162 ["hash"]=> 163 string(8) "%s" 164 ["issuer"]=> 165 array(5) { 166 ["countryName"]=> 167 string(2) "BR" 168 ["stateOrProvinceName"]=> 169 string(17) "Rio Grande do Sul" 170 ["localityName"]=> 171 string(12) "Porto Alegre" 172 ["commonName"]=> 173 string(21) "Henrique do N. Angelo" 174 ["emailAddress"]=> 175 string(16) "hnangelo@php.net" 176 } 177 ["version"]=> 178 int(2) 179 ["serialNumber"]=> 180 string(20) "12593567369101004962" 181 ["validFrom"]=> 182 string(13) "080630102843Z" 183 ["validTo"]=> 184 string(13) "080730102843Z" 185 ["validFrom_time_t"]=> 186 int(1214821723) 187 ["validTo_time_t"]=> 188 int(1217413723) 189 ["purposes"]=> 190 array(8) { 191 [1]=> 192 array(3) { 193 [0]=> 194 bool(true) 195 [1]=> 196 bool(true) 197 [2]=> 198 string(10) "SSL client" 199 } 200 [2]=> 201 array(3) { 202 [0]=> 203 bool(true) 204 [1]=> 205 bool(true) 206 [2]=> 207 string(10) "SSL server" 208 } 209 [3]=> 210 array(3) { 211 [0]=> 212 bool(true) 213 [1]=> 214 bool(true) 215 [2]=> 216 string(19) "Netscape SSL server" 217 } 218 [4]=> 219 array(3) { 220 [0]=> 221 bool(true) 222 [1]=> 223 bool(true) 224 [2]=> 225 string(14) "S/MIME signing" 226 } 227 [5]=> 228 array(3) { 229 [0]=> 230 bool(true) 231 [1]=> 232 bool(true) 233 [2]=> 234 string(17) "S/MIME encryption" 235 } 236 [6]=> 237 array(3) { 238 [0]=> 239 bool(true) 240 [1]=> 241 bool(true) 242 [2]=> 243 string(11) "CRL signing" 244 } 245 [7]=> 246 array(3) { 247 [0]=> 248 bool(true) 249 [1]=> 250 bool(true) 251 [2]=> 252 string(11) "Any Purpose" 253 } 254 [8]=> 255 array(3) { 256 [0]=> 257 bool(true) 258 [1]=> 259 bool(true) 260 [2]=> 261 string(11) "OCSP helper" 262 } 263 } 264 ["extensions"]=> 265 array(3) { 266 ["subjectKeyIdentifier"]=> 267 string(59) "DB:7E:40:72:BD:5C:35:85:EC:29:29:81:12:E8:62:68:6A:B7:3F:7D" 268 ["authorityKeyIdentifier"]=> 269 string(202) "keyid:DB:7E:40:72:BD:5C:35:85:EC:29:29:81:12:E8:62:68:6A:B7:3F:7D 270DirName:/C=BR/ST=Rio Grande do Sul/L=Porto Alegre/CN=Henrique do N. Angelo/emailAddress=hnangelo@php.net 271serial:AE:C5:56:CC:72:37:50:A2 272" 273 ["basicConstraints"]=> 274 string(7) "CA:TRUE" 275 } 276} 277