Code

- Corrected debian bugnumbers
[gosa.git] / include / class_certificate.inc
old mode 100755 (executable)
new mode 100644 (file)
index 1ff3cbd..f7e784d
@@ -81,9 +81,9 @@ class certificate
       /* Reset*/
       return(false);
     }
-  
+
     $this->info(false);
-  
+
     /* Loaded a readable cert */
     return(true);
   }
@@ -95,45 +95,83 @@ class certificate
       $this->error = _("The Format must be PEM, to output certificate informations");
       return(false);
     } else {
-    /* return an array with all given information */
-    $this->info=openssl_x509_parse($this->data);
-    
-    if($ret)
-      return($this->info);
+      /* return an array with all given information */
+      $this->info=openssl_x509_parse($this->data);
+
+      if($ret)
+        return($this->info);
     }
   }
 
   /* Return Functions */
   function getvalidto_date()
   {
-    return($this->info['validTo_time_t']);
+    if(isset($this->info['validTo_time_t'])){
+      return($this->info['validTo_time_t']);
+    }else{
+      return(false);
+    }
   } 
 
   function getvalidfrom_date()
   {
-    return($this->info['validFrom_time_t']);
+    if(isset($this->info['validFrom_time_t'])){
+      return($this->info['validFrom_time_t']);
+    }else{
+      return(false);
+    }
+
   }
 
   function getname()
   {
-    return($this->info['name']);
+    if(isset($this->info['name'])){
+      return($this->info['name']);
+    }else{
+      return(false);
+    }
   }
 
   function getCN()
   {
-    return($this->info['subject']['CN']);
+    if(isset($this->info['subject']['CN'])){
+      return($this->info['subject']['CN']);
+    }else{
+      return(false);
+    }
   }
 
   function getO()
   {
-    return($this->info['subject']['O']);
+    if(isset($this->info['subject']['O'])){
+      return($this->info['subject']['O']);
+    }else{
+      return(false);
+    }
   }
 
   function getOU()
   {
-    return($this->info['subject']['OU']);
+    if(isset($this->info['subject']['OU'])){
+      return($this->info['subject']['OU']);
+    }else{
+      return(false);
+    }
+  }
+
+  function getSerialNumber()
+  {
+    if(isset($this->info['serialNumber'])){
+      return($this->info['serialNumber']);
+    }else{
+      return(false);
+    }
   }
 
+  function isvalid()
+  {
+    return (($this->type != false)&&(count($this->info)>1));
+  }
   
 
   /* Export Certificate to specified file, with specified method*/