Example #1
0
 /**
  * Loads all hostnames in the certificate.
  *
  * @return array
  */
 public function getHostnames()
 {
     // get all certificate alt names
     $altNames = $this->x509->getExtension('id-ce-subjectAltName');
     if ($altNames) {
         array_walk($altNames, function (&$value, $key) {
             $value = $value['dNSName'];
         });
     } else {
         $altNames = [];
     }
     $hostnames = array_merge($this->x509->getDNProp('CN') ?: [], $altNames);
     // array unique removes possible duplicates from CN also in altnames
     return array_unique($hostnames);
 }