openssl_csr_get_subject

(PHP 5 >= 5.2.0, PHP 7, PHP 8)

openssl_csr_get_subjectDevuelve el sujeto de un CERT

Descripción

openssl_csr_get_subject(mixed $csr, bool $use_shortnames = true): array
Advertencia

Esta función no está documentada actualmente, solamente se encuentra disponible la lista de parámetros.

add a note

User Contributed Notes 4 notes

up
1
pdm at wp dot pl
9 years ago
openssl_csr_get_subject('somedomain.com',false);returnarray(7) {  ["countryName"]=> string "XX"  ["stateOrProvinceName"]=> string "xxxxxxxxx"  ["localityName"]=> string "xxxxxxxx"  ["organizationName"]=> string "xxxxxxxxx"  ["organizationalUnitName"]=>string "xxxx"  ["commonName"]=>string "xxx"  ["emailAddress"]=>string "xxx"} openssl_csr_get_subject('somedomain.com',true);returnarray(7) {  ["C"]=> string "XX"  ["ST"]=> string "xxxxxxxxx"  ["L"]=> string "xxxxxxxx"  ["O"]=> string "xxxxxxxxx"  ["OU"]=>string "xxxx"  ["CN"]=>string "xxx"  ["emailAddress"]=>string "xxx"}
up
0
Steve
9 years ago
This function may not return name fields in the order they appear in the certificate.  For example, this CSR:-----BEGIN CERTIFICATE REQUEST-----MIHsMIGUAgEAMDIxEDAOBgNVBAsMB3VuaXQgIzExDDAKBgNVBAoMA29yZzEQMA4GA1UECwwHdW5pdCAjMjBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABGvZnFxGuVzJhOKPs5RNxZBS4vY6ERaqm5tKMGOhxLSfv/dpjDtNNdSHkIGNjYxclHYhxG0ku7BYPA5uPIjng1SgADAKBggqhkjOPQQDAgNHADBEAiB4GXhhbEU1UFTCe0dwJnKHTQuIxzYL5FnyhmKdixN/0gIgBXSm9S8L/oJ6rBxemin/V/xKv5jy4TEZuz84nnshxQQ=-----END CERTIFICATE REQUEST-----When processed by 'openssl -noout -subject' gives this:subject=/OU=unit #1/O=org/OU=unit #2On the other hand, 'var_dump( openssl_csr_get_subject( "..." ) )' will produce this:csr = array(2) {  ["OU"]=>  array(2) {    [0]=>    string(7) "unit #1"    [1]=>    string(7) "unit #2"  }  ["O"]=>  string(3) "org"}As you can see, ordering information (which may be important for some applications) is lost.
up
0
mikko koivu
15 years ago
this function does not yet return SANs (subject alternative names) fields for UC certificates like those used in exchange 2007.
up
-1
stephan[at]strato-rz[dot]de
16 years ago
The returning assoziative array is indexed with the fieldsin the subject so you should have a array key named CN,OU and so on.
To Top