PHP code example of free2er / ed25519

1. Go to this page and download the library: Download free2er/ed25519 library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

free2er / ed25519 example snippets


use Free2er\Ed25519\Key;

$privateKey = Key::generate();

echo $privateKey->toPem();
echo $privateKey->toPublic()->toPem();

use Free2er\Ed25519\Key;

$privateKey = Key::createFromKeyFile('/path/to/private.key');

echo $privateKey->toPem();
echo $privateKey->toPublic()->toPem();

$publicKey = Key::createFromKeyFile('/path/to/public.key');

echo $publicKey->toPem();