D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
opt
/
psa
/
admin
/
plib
/
modules
/
letsencrypt
/
vendor
/
acmephp
/
ssl
/
Generator
/
EcKey
/
Filename :
EcKeyGenerator.php
back
Copy
<?php /* * This file is part of the Acme PHP project. * * (c) Titouan Galopin <galopintitouan@gmail.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace PleskLetsEncrypt\AcmePhp\Ssl\Generator\EcKey; use PleskLetsEncrypt\AcmePhp\Ssl\Generator\KeyOption; use PleskLetsEncrypt\AcmePhp\Ssl\Generator\OpensslPrivateKeyGeneratorTrait; use PleskLetsEncrypt\AcmePhp\Ssl\Generator\PrivateKeyGeneratorInterface; use PleskLetsEncrypt\AcmePhp\Ssl\PrivateKey; use PleskLetsEncrypt\Webmozart\Assert\Assert; /** * Generate random EC private key using OpenSSL. * * @author Jérémy Derussé <jeremy@derusse.com> */ class EcKeyGenerator implements PrivateKeyGeneratorInterface { use OpensslPrivateKeyGeneratorTrait; public function generatePrivateKey(KeyOption $keyOption) : PrivateKey { Assert::isInstanceOf($keyOption, EcKeyOption::class); return $this->generatePrivateKeyFromOpensslOptions(['private_key_type' => \OPENSSL_KEYTYPE_EC, 'curve_name' => $keyOption->getCurveName()]); } public function supportsKeyOption(KeyOption $keyOption) : bool { return $keyOption instanceof EcKeyOption; } }