From: hickert Date: Tue, 7 Jun 2005 08:57:56 +0000 (+0000) Subject: Certificate informations shown now X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=c9365358239084f85f6f24c5d1296a26cec16f25;p=gosa.git Certificate informations shown now git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@611 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/include/class_certificate.inc b/include/class_certificate.inc index c396ac0b2..1ff3cbda7 100755 --- a/include/class_certificate.inc +++ b/include/class_certificate.inc @@ -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") diff --git a/plugins/personal/generic/class_user.inc b/plugins/personal/generic/class_user.inc index a7f0c6bad..c0f6b8611 100644 --- a/plugins/personal/generic/class_user.inc +++ b/plugins/personal/generic/class_user.inc @@ -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")); } } diff --git a/plugins/personal/generic/generic_certs.tpl b/plugins/personal/generic/generic_certs.tpl index 8135061a7..f8d7e2342 100644 --- a/plugins/personal/generic/generic_certs.tpl +++ b/plugins/personal/generic/generic_certs.tpl @@ -1,6 +1,5 @@ - - +
- - - - + + +
@@ -8,9 +7,8 @@
+ {t}Standard certificate{/t} ({$userCertificate_state}) @@ -19,20 +17,47 @@
+ + {t}Status{/t} + + {$userCertificateinfo} +
+ + + + + + + + + - - - + + +
{t}S/MIME certificate{/t} ({$userSMIMECertificate_state}) +  
+ + {t}Status{/t} + + {$userSMIMECertificateinfo} +
+ + + + + + + + + + + {if $governmentmode eq "true"}
{t}PKCS12 certificate{/t} ({$userPKCS12_state}) @@ -41,7 +66,16 @@
+ {t}Status{/t} + + {$userSMIMECertificateinfo} +