free2er / ed25519
Ed25519 key tools
1.11.0
2020-03-16 18:47 UTC
Requires
- php: ^7.4
- ext-gmp: *
- ext-sodium: *
- fgrosse/phpasn1: ^2.1
Requires (Dev)
- ext-openssl: *
- free2er/coding-standard: ^1.1
- phpunit/phpunit: ^8.5
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.
-
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