devportal
Last change
on this file since 2855bd1 was
bbe2084,
checked in by Angelo Osorio <danielking.321@…>, 5 years ago
|
Portal funcional
|
-
Property mode set to
100644
|
File size:
544 bytes
|
Rev | Line | |
---|
[bbe2084] | 1 | <?php |
---|
| 2 | |
---|
| 3 | // Crea una sesión |
---|
| 4 | session_start(); |
---|
| 5 | |
---|
| 6 | // Se genera el par de claves solo si no han sido generadas |
---|
| 7 | if (empty($_SESSION["private_key_pem"]) && (empty($_SESSION["public_key_pem"]) )) { |
---|
| 8 | |
---|
| 9 | // Generado de la |
---|
| 10 | $new_key_pair = openssl_pkey_new(array( |
---|
| 11 | "private_key_bits" => 2048, |
---|
| 12 | "private_key_type" => OPENSSL_KEYTYPE_RSA, |
---|
| 13 | )); |
---|
| 14 | |
---|
| 15 | // Private Key |
---|
| 16 | openssl_pkey_export($new_key_pair, $_SESSION["private_key_pem"]); |
---|
| 17 | |
---|
| 18 | // Public Key |
---|
| 19 | $details = openssl_pkey_get_details($new_key_pair); |
---|
| 20 | $_SESSION["public_key_pem"] = $details['key']; |
---|
| 21 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.