openssl_csr_get_subject

(PHP 5 >= 5.2.0)

openssl_csr_get_subjectReturns the subject of a CERT

Описание

array openssl_csr_get_subject ( mixed $csr [, bool $use_shortnames = true ] )
Внимание

К настоящему времени эта функция еще не была документирована; для ознакомления доступен только список аргументов.

Коментарии

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.
2009-01-21 03:13:53
http://php5.kiev.ua/manual/ru/function.openssl-csr-get-subject.html
Автор:
this function does not yet return SANs (subject alternative names) fields for UC certificates like those used in exchange 2007.
2010-07-21 12:10:09
http://php5.kiev.ua/manual/ru/function.openssl-csr-get-subject.html
Автор:
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"
}
2015-08-21 13:11:29
http://php5.kiev.ua/manual/ru/function.openssl-csr-get-subject.html
Автор:
This function may not return name fields in the order they appear in the certificate.  For example, this CSR:

-----BEGIN CERTIFICATE REQUEST-----
MIHsMIGUAgEAMDIxEDAOBgNVBAsMB3VuaXQgIzExDDAKBgNVBAoMA29yZzEQMA4G
A1UECwwHdW5pdCAjMjBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABGvZnFxGuVzJ
hOKPs5RNxZBS4vY6ERaqm5tKMGOhxLSfv/dpjDtNNdSHkIGNjYxclHYhxG0ku7BY
PA5uPIjng1SgADAKBggqhkjOPQQDAgNHADBEAiB4GXhhbEU1UFTCe0dwJnKHTQuI
xzYL5FnyhmKdixN/0gIgBXSm9S8L/oJ6rBxemin/V/xKv5jy4TEZuz84nnshxQQ=
-----END CERTIFICATE REQUEST-----

When processed by 'openssl -noout -subject' gives this:

subject=/OU=unit #1/O=org/OU=unit #2

On 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.
2016-05-27 15:51:03
http://php5.kiev.ua/manual/ru/function.openssl-csr-get-subject.html

    Поддержать сайт на родительском проекте КГБ