public static function explodeDER(string $data): array
    {
        $offset = 0;
        $identifier = Identifier::fromDER($data, $offset);
        if (!$identifier->isConstructed()) {
            throw new DecodeException("Element is not constructed.");
        }
        $length = Length::expectFromDER($data, $offset);
        if ($length->isIndefinite()) {
            throw new DecodeException(
                'Explode not implemented for indefinite length encoding.');
        }
        $end = $offset + $length->intLength();
        $parts = [];
        while ($offset < $end) {
            // start of the element
            $idx = $offset;
            // skip identifier
            Identifier::fromDER($data, $offset);
            // decode element length
            $length = Length::expectFromDER($data, $offset)->intLength();
            // extract der encoding of the element
            $parts[] = substr($data, $idx, $offset - $idx + $length);
            // update offset over content
            $offset += $length;
        }
        return $parts;
    }
public static function explodeDER(string $data): array
    {
        $offset = 0;
        $identifier = Identifier::fromDER($data, $offset);
        if (!$identifier->isConstructed()) {
            throw new DecodeException("Element is not constructed.");
        }
        $length = Length::expectFromDER($data, $offset);
        if ($length->isIndefinite()) {
            throw new DecodeException(
                'Explode not implemented for indefinite length encoding.');
        }
        $end = $offset + $length->intLength();
        $parts = [];
        while ($offset < $end) {
            // start of the element
            $idx = $offset;
            // skip identifier
            Identifier::fromDER($data, $offset);
            // decode element length
            $length = Length::expectFromDER($data, $offset)->intLength();
            // extract der encoding of the element
            $parts[] = substr($data, $idx, $offset - $idx + $length);
            // update offset over content
            $offset += $length;
        }
        return $parts;
    }
public static function explodeDER ( string $ data ) : array { $ offset = 0 ; $ identifier = Identifier :: fromDER ( $ data , $ offset ) ; if ( ! $ identifier -> isConstructed ( ) ) { throw new DecodeException ( "Element is not constructed." ) ; } $ length = Length :: expectFromDER ( $ data , $ offset ) ; if ( $ length -> isIndefinite ( ) ) { throw new DecodeException ( 'Explode not implemented for indefinite length encoding.' ) ; } $ end = $ offset + $ length -> intLength ( ) ; $ parts = [ ] ; while ( $ offset < $ end ) { // start of the element $ idx = $ offset ; // skip identifier Identifier :: fromDER ( $ data , $ offset ) ; // decode element length $ length = Length :: expectFromDER ( $ data , $ offset ) -> intLength ( ) ; // extract der encoding of the element $ parts [ ] = substr ( $ data , $ idx , $ offset - $ idx + $ length ) ; // update offset over content $ offset += $ length ; } return $ parts ; }
Explode DER structure to DER encoded components that it contains.

@param string $data
@throws DecodeException
@return string[]
Explode DER structure to DER encoded components that it contains .