Signer/DataSigner.php
private function DERtoECDSA($der, $partLength)
    {
        $hex = unpack('H*', $der)[1];
        if ('30' !== mb_substr($hex, 0, 2, '8bit')) { // SEQUENCE
            throw new DataSigningException('Invalid signature provided');
        }
        if ('81' === mb_substr($hex, 2, 2, '8bit')) { // LENGTH > 128
            $hex = mb_substr($hex, 6, null, '8bit');
        } else {
            $hex = mb_substr($hex, 4, null, '8bit');
        }
        if ('02' !== mb_substr($hex, 0, 2, '8bit')) { // INTEGER
            throw new DataSigningException('Invalid signature provided');
        }

        $Rl = hexdec(mb_substr($hex, 2, 2, '8bit'));
        $R = $this->retrievePositiveInteger(mb_substr($hex, 4, $Rl * 2, '8bit'));
        $R = str_pad($R, $partLength, '0', STR_PAD_LEFT);

        $hex = mb_substr($hex, 4 + $Rl * 2, null, '8bit');
        if ('02' !== mb_substr($hex, 0, 2, '8bit')) { // INTEGER
            throw new DataSigningException('Invalid signature provided');
        }
        $Sl = hexdec(mb_substr($hex, 2, 2, '8bit'));
        $S = $this->retrievePositiveInteger(mb_substr($hex, 4, $Sl * 2, '8bit'));
        $S = str_pad($S, $partLength, '0', STR_PAD_LEFT);

        return pack('H*', $R.$S);
    }
private function DERtoECDSA($der, $partLength)
    {
        $hex = unpack('H*', $der)[1];
        if ('30' !== mb_substr($hex, 0, 2, '8bit')) { // SEQUENCE
            throw new DataSigningException('Invalid signature provided');
        }
        if ('81' === mb_substr($hex, 2, 2, '8bit')) { // LENGTH > 128
            $hex = mb_substr($hex, 6, null, '8bit');
        } else {
            $hex = mb_substr($hex, 4, null, '8bit');
        }
        if ('02' !== mb_substr($hex, 0, 2, '8bit')) { // INTEGER
            throw new DataSigningException('Invalid signature provided');
        }

        $Rl = hexdec(mb_substr($hex, 2, 2, '8bit'));
        $R = $this->retrievePositiveInteger(mb_substr($hex, 4, $Rl * 2, '8bit'));
        $R = str_pad($R, $partLength, '0', STR_PAD_LEFT);

        $hex = mb_substr($hex, 4 + $Rl * 2, null, '8bit');
        if ('02' !== mb_substr($hex, 0, 2, '8bit')) { // INTEGER
            throw new DataSigningException('Invalid signature provided');
        }
        $Sl = hexdec(mb_substr($hex, 2, 2, '8bit'));
        $S = $this->retrievePositiveInteger(mb_substr($hex, 4, $Sl * 2, '8bit'));
        $S = str_pad($S, $partLength, '0', STR_PAD_LEFT);

        return pack('H*', $R.$S);
    }
private function DERtoECDSA ( $ der , $ partLength ) { $ hex = unpack ( 'H*' , $ der ) [ 1 ] ; if ( '30' !== mb_substr ( $ hex , 0 , 2 , '8bit' ) ) { // SEQUENCE throw new DataSigningException ( 'Invalid signature provided' ) ; } if ( '81' === mb_substr ( $ hex , 2 , 2 , '8bit' ) ) { // LENGTH > 128 $ hex = mb_substr ( $ hex , 6 , null , '8bit' ) ; } else { $ hex = mb_substr ( $ hex , 4 , null , '8bit' ) ; } if ( '02' !== mb_substr ( $ hex , 0 , 2 , '8bit' ) ) { // INTEGER throw new DataSigningException ( 'Invalid signature provided' ) ; } $ Rl = hexdec ( mb_substr ( $ hex , 2 , 2 , '8bit' ) ) ; $ R = $ this -> retrievePositiveInteger ( mb_substr ( $ hex , 4 , $ Rl * 2 , '8bit' ) ) ; $ R = str_pad ( $ R , $ partLength , '0' , STR_PAD_LEFT ) ; $ hex = mb_substr ( $ hex , 4 + $ Rl * 2 , null , '8bit' ) ; if ( '02' !== mb_substr ( $ hex , 0 , 2 , '8bit' ) ) { // INTEGER throw new DataSigningException ( 'Invalid signature provided' ) ; } $ Sl = hexdec ( mb_substr ( $ hex , 2 , 2 , '8bit' ) ) ; $ S = $ this -> retrievePositiveInteger ( mb_substr ( $ hex , 4 , $ Sl * 2 , '8bit' ) ) ; $ S = str_pad ( $ S , $ partLength , '0' , STR_PAD_LEFT ) ; return pack ( 'H*' , $ R . $ S ) ; }
Convert a DER signature into ECDSA.

The code is a copy/paste from another lib (web-token/jwt-core) which is not compatible with php <= 7.0

@see https://github.com/web-token/jwt-core/blob/master/Util/ECSignature.php
Convert a DER signature into ECDSA .