XMLSecurityDSig::get509XCert PHP Méthode

get509XCert() static public méthode

static public get509XCert ( $cert, $isPEMFormat = true )
    static function get509XCert($cert, $isPEMFormat = true)
    {
        $certs = XMLSecurityDSig::staticGet509XCerts($cert, $isPEMFormat);
        if (!empty($certs)) {
            return $certs[0];
        }
        return '';
    }

Usage Example

 public function add509Cert($cert, $isPEMFormat = TRUE)
 {
     $data = XMLSecurityDSig::get509XCert($cert, $isPEMFormat);
     if ($xpath = $this->getXPathObj()) {
         $query = "./secdsig:KeyInfo";
         $nodeset = $xpath->query($query, $this->sigNode);
         $keyInfo = $nodeset->item(0);
         if (!$keyInfo) {
             $inserted = FALSE;
             $keyInfo = $this->createNewSignNode('KeyInfo');
             if ($xpath = $this->getXPathObj()) {
                 $query = "./secdsig:Object";
                 $nodeset = $xpath->query($query, $this->sigNode);
                 if ($sObject = $nodeset->item(0)) {
                     $sObject->parentNode->insertBefore($keyInfo, $sObject);
                     $inserted = TRUE;
                 }
             }
             if (!$inserted) {
                 $this->sigNode->appendChild($keyInfo);
             }
         }
         $x509DataNode = $this->createNewSignNode('X509Data');
         $keyInfo->appendChild($x509DataNode);
         $x509CertNode = $this->createNewSignNode('X509Certificate', $data);
         $x509DataNode->appendChild($x509CertNode);
     }
 }
All Usage Examples Of XMLSecurityDSig::get509XCert