Example #1
0
 /**
  * @param string $certificate
  * @return boolean
  */
 private function checkAttest($certificate)
 {
     if (!$this->config->getAttestDir()) {
         return TRUE;
     }
     // @todo Original purpose is -1 which is undocumented. Is ANY ok to use here?
     // https://github.com/Yubico/php-u2flib-server/blob/cd49f97017c8415be3e190397565719b5319d2d6/src/u2flib_server/U2F.php#L192
     return openssl_x509_checkpurpose($certificate, X509_PURPOSE_ANY, array_map(function ($file) {
         return $file->getPathName();
     }, iterator_to_array(Finder::findFiles('*.pem')->from($this->config->getAttestDir()), FALSE))) === TRUE;
 }