mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-12-27 19:54:57 +00:00
Merge pull request #23 from monnerat/newattrs
X509: handle multiple-valued attributes in setDNProp(). Fix setDN().
This commit is contained in:
commit
ec067c1f14
@ -1825,7 +1825,7 @@ class File_X509 {
|
|||||||
* Set a Distinguished Name property
|
* Set a Distinguished Name property
|
||||||
*
|
*
|
||||||
* @param String $propName
|
* @param String $propName
|
||||||
* @param String $propValue
|
* @param Mixed $propValue
|
||||||
* @access public
|
* @access public
|
||||||
* @return Boolean
|
* @return Boolean
|
||||||
*/
|
*/
|
||||||
@ -1839,12 +1839,13 @@ class File_X509 {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->dn['rdnSequence'][] = array(
|
foreach ((array) $propValue as $v)
|
||||||
array(
|
$this->dn['rdnSequence'][] = array(
|
||||||
'type' => $propName,
|
array(
|
||||||
'value'=> $propValue
|
'type' => $propName,
|
||||||
)
|
'value'=> $v
|
||||||
);
|
)
|
||||||
|
);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1912,14 +1913,18 @@ class File_X509 {
|
|||||||
* Set a Distinguished Name
|
* Set a Distinguished Name
|
||||||
*
|
*
|
||||||
* @param Mixed $dn
|
* @param Mixed $dn
|
||||||
|
* @param Boolean $merge optional
|
||||||
* @access public
|
* @access public
|
||||||
* @return Boolean
|
* @return Boolean
|
||||||
*/
|
*/
|
||||||
function setDN($dn)
|
function setDN($dn, $merge = false)
|
||||||
{
|
{
|
||||||
|
if (!$merge)
|
||||||
|
$this->dn = NULL;
|
||||||
|
|
||||||
if (is_array($dn)) {
|
if (is_array($dn)) {
|
||||||
if (isset($dn['rdnSequence'])) {
|
if (isset($dn['rdnSequence'])) {
|
||||||
$this->dn = $dn;
|
$this->dn = $dn; // No merge here.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user