namespace dns\page;
use dns\system\DNS;
use dns\system\User;
+use dns\util\DNSSECUtil;
/**
* @author Jan Altensen (Stricted)
$soa = DNS::getDB()->fetch_array($res);
$records = array();
+ $ds = array();
$sql = "SELECT * FROM dns_sec WHERE zone = ?";
$res = DNS::getDB()->query($sql, array($_GET['id']));
while ($row = DNS::getDB()->fetch_array($res)) {
+ if ($row['type'] == 'KSK') {
+ preg_match("/".$soa['origin']." IN DNSKEY 257 3 ([0-9]+) ([\s\S]+)/i", $row['public'], $match);
+ preg_match("/; This is a key-signing key, keyid ([0-9]+), for ".$soa['origin']."/i", $row['public'], $match2);
+ if (!empty($match) && !empty($match2)) {
+ if ($match[1] == $row['algo']) {
+ $ds = DNSSECUtil::calculateDS($soa['origin'], $match[1], $match[2]);
+ $ds['algo'] = $match[1];
+ $ds['keyid'] = $match2[1];
+ }
+ }
+ }
$records[] = $row;
}
- DNS::getTPL()->assign(array("records" => $records, "soa" => $soa));
+ DNS::getTPL()->assign(array("records" => $records, "soa" => $soa, 'ds' => $ds));
}
}
$string = hex2bin($owner.$flags.$protocol.$algorithm.$publicKey);
- $sha1 = sha1($string);
- $sha256 = hash('sha256', $string);
+ $sha1 = strtoupper(sha1($string));
+ $sha256 = strtoupper(hash('sha256', $string));
return array('sha1' => $sha1, 'sha256' => $sha256);
}
- public static convertOwner ($owner) {
+ public static function convertOwner ($owner) {
$return = '';
$data = explode(".", $owner);
$pattern .= "; Created: (?P<created>[0-9]+) \(([a-z0-9: ]+)\)\n";
$pattern .= "; Publish: (?P<publish>[0-9]+) \(([a-z0-9: ]+)\)\n";
$pattern .= "; Activate: (?P<activate>[0-9]+) \(([a-z0-9: ]+)\)\n";
- $pattern .= "([\s\S]+). IN DNSKEY 25(6|7) 3 (?P<algorithm>[0-9]+) (?P<key>[\s\S]+)";
+ $pattern .= "([\s\S]+). IN DNSKEY 25(6|7) 3 (?P<algorithm>[0-9]+) (?P<key>[\s\S]+)(\n)?";
preg_match('/'.$pattern.'/i', $content, $matches);
if (!empty($matches)) {
if (!in_array($matches['algorithm'], array(1, 2, 3, 5, 6, 7, 8, 10, 12, 13, 14))) {
$pattern .= "Coefficient: (?P<coefficient>[\s\S]+)\n";
$pattern .= "Created: (?P<created>[0-9]+)\n";
$pattern .= "Publish: (?P<publish>[0-9]+)\n";
- $pattern .= "Activate: (?P<activate>[0-9]+)";
+ $pattern .= "Activate: (?P<activate>[0-9]+)(\n)?";
preg_match('/'.$pattern.'/i', $content, $matches);
if (!empty($matches)) {