PHP 7.0.6 Released

openssl_csr_get_subject

(PHP 5 >= 5.2.0, PHP 7)

openssl_csr_get_subjectReturns the subject of a CERT

Description

array openssl_csr_get_subject ( mixed $csr [, bool $use_shortnames = true ] )
Warning

This function is currently not documented; only its argument list is available.

User Contributed Notes

pdm at wp dot pl
8 months ago
openssl_csr_get_subject('somedomain.com',false);
return
array(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);
return
array(7) {
  ["C"]=> string "XX"
  ["ST"]=> string "xxxxxxxxx"
  ["L"]=> string "xxxxxxxx"
  ["O"]=> string "xxxxxxxxx"
  ["OU"]=>string "xxxx"
  ["CN"]=>string "xxx"
  ["emailAddress"]=>string "xxx"
}
stephan[at]strato-rz[dot]de
7 years ago
The returning assoziative array is indexed with the fields
in the subject so you should have a array key named CN,OU and so on.
mikko koivu
5 years ago
this function does not yet return SANs (subject alternative names) fields for UC certificates like those used in exchange 2007.
To Top