X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=include%2Fclass_certificate.inc;h=f7e784d5f6c5484640b9aa5f7f663a91c83b252e;hb=3e4be8c6a8a23bdeaada8a873ca63284c75e7d90;hp=c396ac0b211a95d954e25f9acd3ce06cbf3eca2b;hpb=2639ec522f6a933634f311e67f8c7aafdf00dc28;p=gosa.git diff --git a/include/class_certificate.inc b/include/class_certificate.inc index c396ac0b2..f7e784d5f 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,98 @@ 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)); + /* return an array with all given information */ + $this->info=openssl_x509_parse($this->data); + + if($ret) + return($this->info); + } + } + + /* Return Functions */ + function getvalidto_date() + { + if(isset($this->info['validTo_time_t'])){ + return($this->info['validTo_time_t']); + }else{ + return(false); + } + } + + function getvalidfrom_date() + { + if(isset($this->info['validFrom_time_t'])){ + return($this->info['validFrom_time_t']); + }else{ + return(false); + } + + } + + function getname() + { + if(isset($this->info['name'])){ + return($this->info['name']); + }else{ + return(false); + } + } + + function getCN() + { + if(isset($this->info['subject']['CN'])){ + return($this->info['subject']['CN']); + }else{ + return(false); + } + } + + function getO() + { + if(isset($this->info['subject']['O'])){ + return($this->info['subject']['O']); + }else{ + return(false); + } + } + + function getOU() + { + 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*/ function export($type,$filename="temp")