/ / $data is assumed to contain the data to be signed / / fetch private key from file and ready it $fp = fopen( "/ src / openssl-0.9.6 / demos / sign / key.pem", "r"); $priv_key = fread($fp, 8192); fclose($fp); $pkeyid = openssl_get_privatekey($priv_key); / / compute signature openssl_sign($data, $signature, $pkeyid); / / free the key from memory openssl_free_key($pkeyid);
?php / / On suppose que $data contient les données à signer / / lecture de la clé publique pour chaque destinataire $fp = fopen( "/ src / openssl-0.9.6 / demos / sign / key.pem", "r"); $priv_key = fread($fp, 8192); fclose($fp); $pkeyid = openssl_get_privatekey($priv_key); / / calcule de la signature openssl_sign($data, $signature, $pkeyid); / / libère les clés de la mémoire openssl_free_key($pkeyid);?