private static function _encodePositiveInteger(\GMP $num): string
    {
        $bin = gmp_export($num, 1, GMP_MSW_FIRST | GMP_BIG_ENDIAN);
        // if first bit is 1, prepend full zero byte
        // to represent positive two's complement
        if (ord($bin[0]) & 0x80) {
            $bin = chr(0x00) . $bin;
        }
        return $bin;
    }
private static function _encodePositiveInteger(\GMP $num): string
    {
        $bin = gmp_export($num, 1, GMP_MSW_FIRST | GMP_BIG_ENDIAN);
        // if first bit is 1, prepend full zero byte
        // to represent positive two's complement
        if (ord($bin[0]) & 0x80) {
            $bin = chr(0x00) . $bin;
        }
        return $bin;
    }
private static function _encodePositiveInteger ( \ GMP $ num ) : string { $ bin = gmp_export ( $ num , 1 , GMP_MSW_FIRST | GMP_BIG_ENDIAN ) ; // if first bit is 1, prepend full zero byte // to represent positive two's complement if ( ord ( $ bin [ 0 ] ) & 0x80 ) { $ bin = chr ( 0x00 ) . $ bin ; } return $ bin ; }
Encode positive integer to DER content.

@param \GMP $num
@return string
Encode positive integer to DER content .