X509: make it so ip addresses and domain names can be used together

This commit is contained in:
terrafrost 2013-10-09 14:51:34 -05:00
parent 9b53c45f04
commit a577a09a4f

View File

@ -3228,9 +3228,10 @@ class File_X509 {
$this->setExtension('id-ce-subjectKeyIdentifier', $subject->currentKeyIdentifier);
}
$altName = array();
if (isset($subject->domains) && count($subject->domains) > 1) {
$this->setExtension('id-ce-subjectAltName',
array_map(array('File_X509', '_dnsName'), $subject->domains));
$altName = array_map(array('File_X509', '_dnsName'), $subject->domains);
}
if (isset($subject->ipAddresses) && count($subject->ipAddresses)) {
@ -3244,10 +3245,14 @@ class File_X509 {
}
}
if (count($ipAddresses)) {
$this->setExtension('id-ce-subjectAltName', $ipAddresses);
$altName = array_merge($altName, $ipAddresses);
}
}
if (!empty($altName)) {
$this->setExtension('id-ce-subjectAltName', $altName);
}
if ($this->caFlag) {
$keyUsage = $this->getExtension('id-ce-keyUsage');
if (!$keyUsage) {