2010-11-27 18 views

Respuesta

8

para generar un par de claves:?

<?php 
/* Create the private and public key */ 
$res = openssl_pkey_new(); 

/* Extract the private key from $res to $privKey */ 
openssl_pkey_export($res, $privKey); 

/* Extract the public key from $res to $pubKey */ 
$pubKey = openssl_pkey_get_details($res); 
$pubKey = $pubKey["key"]; 
?> 

para guardar la clave a un archivo de destino:

file_put_contents($file, $key); 
Cuestiones relacionadas