D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
opt
/
psa
/
admin
/
plib
/
modules
/
sslit
/
vendor
/
acmephp
/
ssl
/
Generator
/
DsaKey
/
Filename :
DsaKeyGenerator.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 PleskSslIt\AcmePhp\Ssl\Generator\DsaKey; use PleskSslIt\AcmePhp\Ssl\Generator\KeyOption; use PleskSslIt\AcmePhp\Ssl\Generator\OpensslPrivateKeyGeneratorTrait; use PleskSslIt\AcmePhp\Ssl\Generator\PrivateKeyGeneratorInterface; use PleskSslIt\Webmozart\Assert\Assert; /** * Generate random DSA private key using OpenSSL. * * @author Jérémy Derussé <jeremy@derusse.com> */ class DsaKeyGenerator implements PrivateKeyGeneratorInterface { use OpensslPrivateKeyGeneratorTrait; /** * @param DsaKeyOption|KeyOption $keyOption */ public function generatePrivateKey(KeyOption $keyOption) { Assert::isInstanceOf($keyOption, DsaKeyOption::class); return $this->generatePrivateKeyFromOpensslOptions(['private_key_type' => \OPENSSL_KEYTYPE_DSA, 'private_key_bits' => $keyOption->getBits()]); } public function supportsKeyOption(KeyOption $keyOption) { return $keyOption instanceof DsaKeyOption; } }