PixelFox Code

SHA-Zertifikat-Generator

Erstellt ein RSA-Schlüsselpaar (4096 Bit, SHA-512) und exportiert privaten und öffentlichen Schlüssel als .pem.

PHP

1 Datei805 Baktualisiert vor 21 Stunden

SHA-Cert Generator.php
PHP805 B
RohdateiHerunterladen
<?php
    //Enable Debbuging
    ini_set('display_errors', 1);
    ini_set('display_startup_errors', 1);
    error_reporting(E_ALL);

    $path = "PATH/FOR/THE/FILES";
    $config = array(
        "digest_alg" => "sha512",
        "private_key_bits" => 4096,
        "private_key_type" => OPENSSL_KEYTYPE_RSA,
    );
    
    // Create the private and public key
    $res = openssl_pkey_new($config);
    
    // 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"];
    
    file_put_contents($path . '/public-key.pem', $pubKey); 
    file_put_contents($path . '/private-key.pem', $privKey);

    echo "Saved certificates to: " . $path;
?>

Einbetten

Diesen Code auf einer beliebigen Seite einfügen.

Vorschau