I am using PHP openssl_sign to create a digital signature using the tutorial here. How can i convert $signature (which contains binary data) to Base64.
You can convert binary to base64 using base64_encode.
Just do:
base64_encode($signature);
Read more here: http://php.net/manual/en/function.base64-encode.php