src/fkooman/X509/CertParser.php
private function toDer()
    {
        $pattern = '/.*-----BEGIN CERTIFICATE-----(.*)-----END CERTIFICATE-----.*/msU';
        $replacement = '${1}';

        $plainPemData = preg_replace($pattern, $replacement, $this->pemCert);
        if (null === $plainPemData) {
            throw new RuntimeException('unable to extract the encoded DER data from the certificate');
        }

        // create one long string of the certificate which turns it into an
        // encoded DER cert
        $search = array(' ', "\t", "\n", "\r", "\0" , "\x0B");
        $encodedDerCert = str_replace($search, '', $plainPemData);

        return base64_decode($encodedDerCert);
    }
private function toDer()
    {
        $pattern = '/.*-----BEGIN CERTIFICATE-----(.*)-----END CERTIFICATE-----.*/msU';
        $replacement = '${1}';

        $plainPemData = preg_replace($pattern, $replacement, $this->pemCert);
        if (null === $plainPemData) {
            throw new RuntimeException('unable to extract the encoded DER data from the certificate');
        }

        // create one long string of the certificate which turns it into an
        // encoded DER cert
        $search = array(' ', "\t", "\n", "\r", "\0" , "\x0B");
        $encodedDerCert = str_replace($search, '', $plainPemData);

        return base64_decode($encodedDerCert);
    }
private function toDer ( ) { $ pattern = '/.*-----BEGIN CERTIFICATE-----(.*)-----END CERTIFICATE-----.*/msU' ; $ replacement = '${1}' ; $ plainPemData = preg_replace ( $ pattern , $ replacement , $ this -> pemCert ) ; if ( null === $ plainPemData ) { throw new RuntimeException ( 'unable to extract the encoded DER data from the certificate' ) ; } // create one long string of the certificate which turns it into an // encoded DER cert $ search = array ( ' ' , "\t" , "\n" , "\r" , "\0" , "\x0B" ) ; $ encodedDerCert = str_replace ( $ search , '' , $ plainPemData ) ; return base64_decode ( $ encodedDerCert ) ; }
Get the DER format of the certificate.
Get the DER format of the certificate .