free2er/ed25519

Ed25519 key tools

1.11.0 2020-03-16 18:47 UTC

This package is auto-updated.

Last update: 2024-12-17 05:21:54 UTC


README

Ed25519 key tools

Installation

This component can be installed with the Composer dependency manager.

  1. Install Composer

  2. Install the component as a dependency of your project

     composer require free2er/ed25519
    

Usage

Generate new key

use Free2er\Ed25519\Key;

$privateKey = Key::generate();

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

Create key from file

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();

OpenSSL commands

Generate private key

openssl genpkey -algorithm Ed25519 -out private.key

Extract public key

openssl pkey -in private.key -pubout -out public.key