public function createX509Certificate($privateKey)
    {
        $rsa = new RSA();
        $rsa->loadKey($privateKey);

        $issuer = new X509();
        $issuer->setPrivateKey($rsa);
        $issuer->setDN($this->getDn());

        $csr = new X509();
        $csr->setPrivateKey($rsa);
        $csr->setDN($issuer->getDN());

        $csr = $csr->saveCSR($csr->signCSR());

        $subject = new X509();
        $subject->loadCSR($csr);

        $x509 = new X509();
        $x509->setEndDate($this->getCertificateValidity());

        return $x509->saveX509($x509->sign($issuer, $subject));
    }
public function createX509Certificate($privateKey)
    {
        $rsa = new RSA();
        $rsa->loadKey($privateKey);

        $issuer = new X509();
        $issuer->setPrivateKey($rsa);
        $issuer->setDN($this->getDn());

        $csr = new X509();
        $csr->setPrivateKey($rsa);
        $csr->setDN($issuer->getDN());

        $csr = $csr->saveCSR($csr->signCSR());

        $subject = new X509();
        $subject->loadCSR($csr);

        $x509 = new X509();
        $x509->setEndDate($this->getCertificateValidity());

        return $x509->saveX509($x509->sign($issuer, $subject));
    }
public function createX509Certificate ( $ privateKey ) { $ rsa = new RSA ( ) ; $ rsa -> loadKey ( $ privateKey ) ; $ issuer = new X509 ( ) ; $ issuer -> setPrivateKey ( $ rsa ) ; $ issuer -> setDN ( $ this -> getDn ( ) ) ; $ csr = new X509 ( ) ; $ csr -> setPrivateKey ( $ rsa ) ; $ csr -> setDN ( $ issuer -> getDN ( ) ) ; $ csr = $ csr -> saveCSR ( $ csr -> signCSR ( ) ) ; $ subject = new X509 ( ) ; $ subject -> loadCSR ( $ csr ) ; $ x509 = new X509 ( ) ; $ x509 -> setEndDate ( $ this -> getCertificateValidity ( ) ) ; return $ x509 -> saveX509 ( $ x509 -> sign ( $ issuer , $ subject ) ) ; }
Create a X.509 certificate

@param string $privateKey

@return string
Create a X . 509 certificate