Potpiši podatke privatnim ključem

Potpiši podatke privatnim ključem:

<?php
/* Generiraj potpis iz privatnog ključa trgovca */
$fp = fopen( 'private-key.pem', 'r');
$priv_key = fread($fp, 8192);
fclose($fp);
$pkeyid = openssl_get_privatekey($priv_key);
// generiranje potpisa
openssl_sign($data, $signature, $pkeyid);
// brisanje kljuca iz memorije
openssl_free_key($pkeyid);
// kodiranje vrijednosti u BASE64
$b64sign = base64_encode($signature);
?>

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.