PHP Classes

File: local/keygen.php

Recommend this page to a friend!
  Classes of Scott Arciszewski  >  Certainty  >  local/keygen.php  >  Download  
File: local/keygen.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: Certainty
Manage SSL certificate authority file used by PHP
Author: By
Last change:
Date: 3 years ago
Size: 530 bytes
 

Contents

Class file image Download
<?php
require '../vendor/autoload.php';

if (
file_exists('keys.json')) {
    echo
'Keys already exist!', PHP_EOL;
    exit(
127);
}

$keypair = ParagonIE_Sodium_Compat::crypto_sign_keypair();
$secret = ParagonIE_Sodium_Compat::crypto_sign_secretkey($keypair);
$public = ParagonIE_Sodium_Compat::crypto_sign_publickey($keypair);

\
file_put_contents(
   
'keys.json',
    \
json_encode(
        [
           
'secret-key' => bin2hex($secret),
           
'public-key' => bin2hex($public)
        ],
       
JSON_PRETTY_PRINT
   
)
);

For more information send a message to info at phpclasses dot org.