Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP how to encode binary data to base 64

Tags:

php

base64

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.

like image 318
beesasoh Avatar asked Oct 20 '14 08:10

beesasoh


2 Answers

You can convert binary to base64 using base64_encode.

like image 51
Sjoerd Avatar answered Sep 19 '22 02:09

Sjoerd


Just do:

base64_encode($signature);

Read more here: http://php.net/manual/en/function.base64-encode.php

like image 37
Matt Kent Avatar answered Sep 22 '22 02:09

Matt Kent