public function addSecdns($secdns)
{
/* @var eppSecDNS $secdns */
if (!$this->extension) {
$this->extension = $this->createElement('extension');
$this->getCommand()->appendChild($this->extension);
}
$seccreate = $this->createElement('secDNS:create');
$seccreate->setAttribute('xmlns:secDNS', 'urn:ietf:params:xml:ns:secDNS-1.1');
if ($secdns->getKeytag()) {
/*
* Keytag found, assuming client wants to add dnssec data via dsData interface
* http://tools.ietf.org/search/rfc5910#section-4.1
*/
$secdsdata = $this->createElement('secDNS:dsData');
$secdsdata->appendChild($this->createElement('secDNS:keyTag', $secdns->getKeytag()));
$secdsdata->appendChild($this->createElement('secDNS:alg', $secdns->getAlgorithm()));
$secdsdata->appendChild($this->createElement('secDNS:digestType', $secdns->getDigestType()));
$secdsdata->appendChild($this->createElement('secDNS:digest', $secdns->getDigest()));
if ($secdns->getPubkey()) {
/*
* Pubkey found, adding option key data to the request
*/
$seckeydata = $this->createElement('secDNS:keyData');
$seckeydata->appendChild($this->createElement('secDNS:flags', $secdns->getFlags()));
$seckeydata->appendChild($this->createElement('secDNS:protocol', $secdns->getProtocol()));
$seckeydata->appendChild($this->createElement('secDNS:alg', $secdns->getAlgorithm()));
$seckeydata->appendChild($this->createElement('secDNS:pubKey', $secdns->getPubkey()));
$secdsdata->appendChild($seckeydata);
}
$seccreate->appendChild($secdsdata);
} else {
/*
* Keytag not found, assuming client wants to add dnssec data via keyData interface
* http://tools.ietf.org/search/rfc5910#section-4.2
*/
$seckeydata = $this->createElement('secDNS:keyData');
$seckeydata->appendChild($this->createElement('secDNS:flags', $secdns->getFlags()));
$seckeydata->appendChild($this->createElement('secDNS:protocol', $secdns->getProtocol()));
$seckeydata->appendChild($this->createElement('secDNS:alg', $secdns->getAlgorithm()));
$seckeydata->appendChild($this->createElement('secDNS:pubKey', $secdns->getPubkey()));
$seccreate->appendChild($seckeydata);
}
$this->extension->appendChild($seccreate);
// Put session id at the end of the EPP command chain
$this->addSessionId();
}