1--TEST-- 2openssl_x509_parse() tests 3--SKIPIF-- 4<?php if (!extension_loaded("openssl")) print "skip"; 5if (OPENSSL_VERSION_NUMBER < 0x10000000) die("skip Output requires OpenSSL 1.0"); 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(15) { 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 ["signatureTypeSN"]=> 59 string(8) "RSA-SHA1" 60 ["signatureTypeLN"]=> 61 string(21) "sha1WithRSAEncryption" 62 ["signatureTypeNID"]=> 63 int(65) 64 ["purposes"]=> 65 array(9) { 66 [1]=> 67 array(3) { 68 [0]=> 69 bool(true) 70 [1]=> 71 bool(true) 72 [2]=> 73 string(9) "sslclient" 74 } 75 [2]=> 76 array(3) { 77 [0]=> 78 bool(true) 79 [1]=> 80 bool(true) 81 [2]=> 82 string(9) "sslserver" 83 } 84 [3]=> 85 array(3) { 86 [0]=> 87 bool(true) 88 [1]=> 89 bool(true) 90 [2]=> 91 string(11) "nssslserver" 92 } 93 [4]=> 94 array(3) { 95 [0]=> 96 bool(true) 97 [1]=> 98 bool(true) 99 [2]=> 100 string(9) "smimesign" 101 } 102 [5]=> 103 array(3) { 104 [0]=> 105 bool(true) 106 [1]=> 107 bool(true) 108 [2]=> 109 string(12) "smimeencrypt" 110 } 111 [6]=> 112 array(3) { 113 [0]=> 114 bool(true) 115 [1]=> 116 bool(true) 117 [2]=> 118 string(7) "crlsign" 119 } 120 [7]=> 121 array(3) { 122 [0]=> 123 bool(true) 124 [1]=> 125 bool(true) 126 [2]=> 127 string(3) "any" 128 } 129 [8]=> 130 array(3) { 131 [0]=> 132 bool(true) 133 [1]=> 134 bool(true) 135 [2]=> 136 string(10) "ocsphelper" 137 } 138 [9]=> 139 array(3) { 140 [0]=> 141 bool(false) 142 [1]=> 143 bool(true) 144 [2]=> 145 string(13) "timestampsign" 146 } 147 } 148 ["extensions"]=> 149 array(3) { 150 ["subjectKeyIdentifier"]=> 151 string(59) "DB:7E:40:72:BD:5C:35:85:EC:29:29:81:12:E8:62:68:6A:B7:3F:7D" 152 ["authorityKeyIdentifier"]=> 153 string(202) "keyid:DB:7E:40:72:BD:5C:35:85:EC:29:29:81:12:E8:62:68:6A:B7:3F:7D 154DirName:/C=BR/ST=Rio Grande do Sul/L=Porto Alegre/CN=Henrique do N. Angelo/emailAddress=hnangelo@php.net 155serial:AE:C5:56:CC:72:37:50:A2 156" 157 ["basicConstraints"]=> 158 string(7) "CA:TRUE" 159 } 160} 161array(15) { 162 ["name"]=> 163 string(96) "/C=BR/ST=Rio Grande do Sul/L=Porto Alegre/CN=Henrique do N. Angelo/emailAddress=hnangelo@php.net" 164 ["subject"]=> 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 ["hash"]=> 178 string(8) "%s" 179 ["issuer"]=> 180 array(5) { 181 ["countryName"]=> 182 string(2) "BR" 183 ["stateOrProvinceName"]=> 184 string(17) "Rio Grande do Sul" 185 ["localityName"]=> 186 string(12) "Porto Alegre" 187 ["commonName"]=> 188 string(21) "Henrique do N. Angelo" 189 ["emailAddress"]=> 190 string(16) "hnangelo@php.net" 191 } 192 ["version"]=> 193 int(2) 194 ["serialNumber"]=> 195 string(20) "12593567369101004962" 196 ["validFrom"]=> 197 string(13) "080630102843Z" 198 ["validTo"]=> 199 string(13) "080730102843Z" 200 ["validFrom_time_t"]=> 201 int(1214821723) 202 ["validTo_time_t"]=> 203 int(1217413723) 204 ["signatureTypeSN"]=> 205 string(8) "RSA-SHA1" 206 ["signatureTypeLN"]=> 207 string(21) "sha1WithRSAEncryption" 208 ["signatureTypeNID"]=> 209 int(65) 210 ["purposes"]=> 211 array(9) { 212 [1]=> 213 array(3) { 214 [0]=> 215 bool(true) 216 [1]=> 217 bool(true) 218 [2]=> 219 string(10) "SSL client" 220 } 221 [2]=> 222 array(3) { 223 [0]=> 224 bool(true) 225 [1]=> 226 bool(true) 227 [2]=> 228 string(10) "SSL server" 229 } 230 [3]=> 231 array(3) { 232 [0]=> 233 bool(true) 234 [1]=> 235 bool(true) 236 [2]=> 237 string(19) "Netscape SSL server" 238 } 239 [4]=> 240 array(3) { 241 [0]=> 242 bool(true) 243 [1]=> 244 bool(true) 245 [2]=> 246 string(14) "S/MIME signing" 247 } 248 [5]=> 249 array(3) { 250 [0]=> 251 bool(true) 252 [1]=> 253 bool(true) 254 [2]=> 255 string(17) "S/MIME encryption" 256 } 257 [6]=> 258 array(3) { 259 [0]=> 260 bool(true) 261 [1]=> 262 bool(true) 263 [2]=> 264 string(11) "CRL signing" 265 } 266 [7]=> 267 array(3) { 268 [0]=> 269 bool(true) 270 [1]=> 271 bool(true) 272 [2]=> 273 string(11) "Any Purpose" 274 } 275 [8]=> 276 array(3) { 277 [0]=> 278 bool(true) 279 [1]=> 280 bool(true) 281 [2]=> 282 string(11) "OCSP helper" 283 } 284 [9]=> 285 array(3) { 286 [0]=> 287 bool(false) 288 [1]=> 289 bool(true) 290 [2]=> 291 string(18) "Time Stamp signing" 292 } 293 } 294 ["extensions"]=> 295 array(3) { 296 ["subjectKeyIdentifier"]=> 297 string(59) "DB:7E:40:72:BD:5C:35:85:EC:29:29:81:12:E8:62:68:6A:B7:3F:7D" 298 ["authorityKeyIdentifier"]=> 299 string(202) "keyid:DB:7E:40:72:BD:5C:35:85:EC:29:29:81:12:E8:62:68:6A:B7:3F:7D 300DirName:/C=BR/ST=Rio Grande do Sul/L=Porto Alegre/CN=Henrique do N. Angelo/emailAddress=hnangelo@php.net 301serial:AE:C5:56:CC:72:37:50:A2 302" 303 ["basicConstraints"]=> 304 string(7) "CA:TRUE" 305 } 306} 307