Code

Certificate informations shown now
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 7 Jun 2005 08:57:56 +0000 (08:57 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 7 Jun 2005 08:57:56 +0000 (08:57 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@611 594d385d-05f5-0310-b6e9-bd551577e9d8

include/class_certificate.inc
plugins/personal/generic/class_user.inc
plugins/personal/generic/generic_certs.tpl

index c396ac0b211a95d954e25f9acd3ce06cbf3eca2b..1ff3cbda7ed19763c2247ab47b82044fbaa795c6 100755 (executable)
@@ -19,6 +19,7 @@ class certificate
     $this->data= "";
     $this->type= false;
     $this->error="";  
+    $this->info = array();
   } 
 
   /* Reads specified Certfile/string and convert it to PEM*/
@@ -80,22 +81,60 @@ class certificate
       /* Reset*/
       return(false);
     }
+  
+    $this->info(false);
+  
     /* Loaded a readable cert */
     return(true);
   }
 
   /* Returns Array with all containing data */
-  function info()
+  function info($ret = true)
   {
     if($this->type != PEM){
       $this->error = _("The Format must be PEM, to output certificate informations");
       return(false);
     } else {
     /* return an array with all given information */
-    return(openssl_x509_parse($this->data));
+    $this->info=openssl_x509_parse($this->data);
+    
+    if($ret)
+      return($this->info);
     }
   }
 
+  /* Return Functions */
+  function getvalidto_date()
+  {
+    return($this->info['validTo_time_t']);
+  } 
+
+  function getvalidfrom_date()
+  {
+    return($this->info['validFrom_time_t']);
+  }
+
+  function getname()
+  {
+    return($this->info['name']);
+  }
+
+  function getCN()
+  {
+    return($this->info['subject']['CN']);
+  }
+
+  function getO()
+  {
+    return($this->info['subject']['O']);
+  }
+
+  function getOU()
+  {
+    return($this->info['subject']['OU']);
+  }
+
+  
 
   /* Export Certificate to specified file, with specified method*/
   function export($type,$filename="temp")
index a7f0c6badcc4808b0f2c916f5a86d74050726c9f..c0f6b8611bb665eb4a44b01c06c183a7afc5f300 100644 (file)
@@ -385,7 +385,17 @@ class user extends plugin
       foreach(array("userCertificate", "userSMIMECertificate", "userPKCS12") as $cert){
         if ($this->$cert != ""){
           $smarty->assign("$cert"."_state", _("present"));
+          /* import certificate */
+          $certificate = new certificate;
+          $certificate->import($this->$cert);
+      
+          /* Read out data*/
+          $timeto   = ($certificate->getvalidto_date());
+          $timefrom = ($certificate->getvalidfrom_date());
+          $str = _("This Certificate is valid till ").date('d M Y',$timeto)." - ".str_replace("/"," , ",$certificate->getCN());
+          $smarty->assign($cert."info",$str);
         } else {
+          $smarty->assign($cert."info","");
           $smarty->assign("$cert"."_state", _("absent"));
         }
       }
index 8135061a77a7f7420d84a0f6f56b7e969a075726..f8d7e23425913f31aca64873e6d72afbbfb03e7a 100644 (file)
@@ -1,6 +1,5 @@
 <input type="hidden" name="MAX_FILE_SIZE" value="2000000">
-<table style="vertical-align:top; text-align:left;" cellpadding=4 border=0>
-
+<table style="vertical-align:top; text-align:left;" cellpadding=4 border=0 width="100%">
  <!-- Headline container -->
  <tr>
    <td colspan=2>
@@ -8,9 +7,8 @@
    </td>
 
  </tr>
-
  <tr>
-   <td>
+   <td width="250">
       {t}Standard certificate{/t} (<i>{$userCertificate_state}</i>)
    </td>
    <td>
      <input type=submit name="remove_userCertificate" value="{t}Remove{/t}">
    </td>
  </tr>
  <tr>
-   <td>
+       <td>
+               {t}Status{/t}
+       </td>
+       <td>
+               {$userCertificateinfo}
+       </td>
+ </tr>
+ </table>
+
+
+
+
+
+
+ <table style="vertical-align:top; text-align:left;border-top: 1px solid rgb(176,176,176);" width="100%" cellpadding=4 border=0>
+ <tr>
+   <td width="250">
       {t}S/MIME certificate{/t} (<i>{$userSMIMECertificate_state}</i>)
    </td>
-   <td>
+   <td >
      <input name="userSMIMECertificate_file" type="file" size="20" maxlength="255" accept="text/*.*">
      &nbsp;
      <input type=submit name="remove_userSMIMECertificate" value="{t}Remove{/t}">
    </td>
  </tr>
  <tr>
-   <td>
+    <td>
+        {t}Status{/t}
+    </td>
+    <td>
+        {$userSMIMECertificateinfo}
+    </td>
+ </tr>
+ </table>
+
+
+
+<table style="vertical-align:top; text-align:left;border-top: 1px solid rgb(176,176,176);" width="100%" cellpadding=4 border=0> 
+ <tr>
+   <td width="250">
       {t}PKCS12 certificate{/t} (<i>{$userPKCS12_state}</i>)
    </td>
    <td>
      <input type=submit name="remove_userPKCS12" value="{t}Remove{/t}">
    </td>
  </tr>
+ <tr>
+    <td>
+        {t}Status{/t}
+    </td>
+    <td>
+        {$userSMIMECertificateinfo}
+    </td>
+ </tr>
  
+
  {if $governmentmode eq "true"}
  <tr>
    <td>