add omments to DNSSECUtil class
authorStricted <info@stricted.de>
Sun, 22 Feb 2015 20:52:16 +0000 (21:52 +0100)
committerStricted <info@stricted.de>
Sun, 22 Feb 2015 20:52:16 +0000 (21:52 +0100)
lib/util/DNSSECUtil.class.php

index d17f1a480ecc84106e83149d3fd1ed9fe6a94474..c0cb159d29669155780242c5532c5f9884dc9511 100644 (file)
@@ -8,6 +8,14 @@ namespace dns\util;
  */
 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';
@@ -23,6 +31,12 @@ class DNSSECUtil {
                return array('sha1' => $sha1, 'sha256' => $sha256);
        }
        
+       /**
+        * convert the domain name to HEX
+        *
+        * @param       string  $owner
+        * @return      string
+        */
        public static function convertOwner ($owner) {
                $return = '';
                
@@ -49,7 +63,13 @@ class DNSSECUtil {
                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";
@@ -75,6 +95,12 @@ class DNSSECUtil {
                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";
@@ -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)?";
-
+               
                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))) {