public static function fromCSR(CertificationRequest $cr): self
    {
        $cri = $cr->certificationRequestInfo();
        $tbs_cert = new self($cri->subject(), $cri->subjectPKInfo(), new Name(),
            Validity::fromStrings(null, null));
        // if CSR has Extension Request attribute
        if ($cri->hasAttributes()) {
            $attribs = $cri->attributes();
            if ($attribs->hasExtensionRequest()) {
                $tbs_cert = $tbs_cert->withExtensions(
                    $attribs->extensionRequest()
                        ->extensions());
            }
        }
        // add Subject Key Identifier extension
        $tbs_cert = $tbs_cert->withAdditionalExtensions(
            new SubjectKeyIdentifierExtension(false,
                $cri->subjectPKInfo()
                    ->keyIdentifier()));
        return $tbs_cert;
    }
public static function fromCSR(CertificationRequest $cr): self
    {
        $cri = $cr->certificationRequestInfo();
        $tbs_cert = new self($cri->subject(), $cri->subjectPKInfo(), new Name(),
            Validity::fromStrings(null, null));
        // if CSR has Extension Request attribute
        if ($cri->hasAttributes()) {
            $attribs = $cri->attributes();
            if ($attribs->hasExtensionRequest()) {
                $tbs_cert = $tbs_cert->withExtensions(
                    $attribs->extensionRequest()
                        ->extensions());
            }
        }
        // add Subject Key Identifier extension
        $tbs_cert = $tbs_cert->withAdditionalExtensions(
            new SubjectKeyIdentifierExtension(false,
                $cri->subjectPKInfo()
                    ->keyIdentifier()));
        return $tbs_cert;
    }
public static function fromCSR ( CertificationRequest $ cr ) : self { $ cri = $ cr -> certificationRequestInfo ( ) ; $ tbs_cert = new self ( $ cri -> subject ( ) , $ cri -> subjectPKInfo ( ) , new Name ( ) , Validity :: fromStrings ( null , null ) ) ; // if CSR has Extension Request attribute if ( $ cri -> hasAttributes ( ) ) { $ attribs = $ cri -> attributes ( ) ; if ( $ attribs -> hasExtensionRequest ( ) ) { $ tbs_cert = $ tbs_cert -> withExtensions ( $ attribs -> extensionRequest ( ) -> extensions ( ) ) ; } } // add Subject Key Identifier extension $ tbs_cert = $ tbs_cert -> withAdditionalExtensions ( new SubjectKeyIdentifierExtension ( false , $ cri -> subjectPKInfo ( ) -> keyIdentifier ( ) ) ) ; return $ tbs_cert ; }
Initialize from certification request.

Note that signature is not verified and must be done by the caller.

@param CertificationRequest $cr
@return self
Initialize from certification request .