public function add509Cert($cert, $isPEMFormat = TRUE)
{
$data = XMLSecurityDSig::get509XCert($cert, $isPEMFormat);
if ($xpath = $this->getXPathObj()) {
$query = "./secdsig:KeyInfo";
$nodeset = $xpath->query($query, $this->sigNode);
$keyInfo = $nodeset->item(0);
if (!$keyInfo) {
$inserted = FALSE;
$keyInfo = $this->createNewSignNode('KeyInfo');
if ($xpath = $this->getXPathObj()) {
$query = "./secdsig:Object";
$nodeset = $xpath->query($query, $this->sigNode);
if ($sObject = $nodeset->item(0)) {
$sObject->parentNode->insertBefore($keyInfo, $sObject);
$inserted = TRUE;
}
}
if (!$inserted) {
$this->sigNode->appendChild($keyInfo);
}
}
$x509DataNode = $this->createNewSignNode('X509Data');
$keyInfo->appendChild($x509DataNode);
$x509CertNode = $this->createNewSignNode('X509Certificate', $data);
$x509DataNode->appendChild($x509CertNode);
}
}