diff --git a/phpseclib/File/X509.php b/phpseclib/File/X509.php index a4b27b81..cf77cc94 100644 --- a/phpseclib/File/X509.php +++ b/phpseclib/File/X509.php @@ -3355,6 +3355,28 @@ class X509 return false; } + /** + * Get all requested CSR extensions + * + * Returns the list of extensions if there are any and false if not + * + * @param array $csr optional + * @return mixed + */ + public function getRequestedCertificateExtensions(array $csr = null) + { + if (empty($csr)) { + $csr = $this->currentCert; + } + + $requestedExtensions = $this->getAttribute('pkcs-9-at-extensionRequest'); + if ($requestedExtensions === false) { + return false; + } + + return $this->getAttribute('pkcs-9-at-extensionRequest')[0]; + } + /** * Returns a list of all CSR attributes in use *