projects
/
GitHub
/
Stricted
/
Domain-Control-Panel.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
6a2c67f
)
add omments to DNSSECUtil class
author
Stricted
<info@stricted.de>
Sun, 22 Feb 2015 20:52:16 +0000
(21:52 +0100)
committer
Stricted
<info@stricted.de>
Sun, 22 Feb 2015 20:52:16 +0000
(21:52 +0100)
lib/util/DNSSECUtil.class.php
patch
|
blob
|
blame
|
history
diff --git
a/lib/util/DNSSECUtil.class.php
b/lib/util/DNSSECUtil.class.php
index d17f1a480ecc84106e83149d3fd1ed9fe6a94474..c0cb159d29669155780242c5532c5f9884dc9511 100644
(file)
--- a/
lib/util/DNSSECUtil.class.php
+++ b/
lib/util/DNSSECUtil.class.php
@@
-8,6
+8,14
@@
namespace dns\util;
*/
class DNSSECUtil {
*/
class DNSSECUtil {
+ /**
+ * calculate the DS record for parent zone
+ *
+ * @param string $owner
+ * @param string $algorithm
+ * @param string $publicKey
+ * @return array
+ */
public static function calculateDS ($owner, $algorithm, $publicKey) {
$owner = self::convertOwner($owner);
$flags = '0101';
public static function calculateDS ($owner, $algorithm, $publicKey) {
$owner = self::convertOwner($owner);
$flags = '0101';
@@
-23,6
+31,12
@@
class DNSSECUtil {
return array('sha1' => $sha1, 'sha256' => $sha256);
}
return array('sha1' => $sha1, 'sha256' => $sha256);
}
+ /**
+ * convert the domain name to HEX
+ *
+ * @param string $owner
+ * @return string
+ */
public static function convertOwner ($owner) {
$return = '';
public static function convertOwner ($owner) {
$return = '';
@@
-49,7
+63,13
@@
class DNSSECUtil {
return $return;
}
return $return;
}
- public static function validatePublicKey ($content) {
+ /**
+ * validate DNSSEC public key
+ *
+ * @param string $content
+ * @return boolean
+ */
+ public static function validatePublicKey ($content) {
$pattern = "; This is a (key|zone)-signing key, keyid (?P<keyid>[0-9]+), for (?P<domain>[\s\S]+)\.\n";
$pattern .= "; Created: (?P<created>[0-9]+) \(([a-z0-9: ]+)\)\n";
$pattern .= "; Publish: (?P<publish>[0-9]+) \(([a-z0-9: ]+)\)\n";
$pattern = "; This is a (key|zone)-signing key, keyid (?P<keyid>[0-9]+), for (?P<domain>[\s\S]+)\.\n";
$pattern .= "; Created: (?P<created>[0-9]+) \(([a-z0-9: ]+)\)\n";
$pattern .= "; Publish: (?P<publish>[0-9]+) \(([a-z0-9: ]+)\)\n";
@@
-75,6
+95,12
@@
class DNSSECUtil {
return true;
}
return true;
}
+ /**
+ * validate DNSSEC private key
+ *
+ * @param string $content
+ * @return boolean
+ */
public static function validatePrivateKey ($content) {
$pattern = "Private-key-format: v([0-9a-z.]+)\n";
$pattern .= "Algorithm: (?P<algorithm>[0-9]+) \(([0-9a-z\-]+)\)\n";
public static function validatePrivateKey ($content) {
$pattern = "Private-key-format: v([0-9a-z.]+)\n";
$pattern .= "Algorithm: (?P<algorithm>[0-9]+) \(([0-9a-z\-]+)\)\n";
@@
-88,7
+114,7
@@
class DNSSECUtil {
$pattern .= "Created: (?P<created>[0-9]+)\n";
$pattern .= "Publish: (?P<publish>[0-9]+)\n";
$pattern .= "Activate: (?P<activate>[0-9]+)(\n)?";
$pattern .= "Created: (?P<created>[0-9]+)\n";
$pattern .= "Publish: (?P<publish>[0-9]+)\n";
$pattern .= "Activate: (?P<activate>[0-9]+)(\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))) {
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))) {